Commit graph

80 commits

Author SHA1 Message Date
Tom Hughes
8dae890a76 Fix rubocop warnings 2017-10-05 19:18:38 +01:00
Andy Allan
6f89da05d1 Use current_user to represent the currently logged in user.
This is already used by the oauth plugin, and is a general rails convention.
2017-07-12 16:10:50 +01:00
Tom Hughes
ff97501ed0 Remove all use of the :text option to render
It doesn't actually do what it says, as it sets the content type
to text/html not text/plain so is just confusing and as a result
has been deprecated in newer rails versions.
2017-06-02 19:12:05 +01:00
Tom Hughes
5d3ecffa28 Fix new rubocop warnings 2016-02-05 13:35:26 +00:00
Tom Hughes
51c5be98f7 Test some missing cases in the way controller 2015-03-08 18:01:19 +00:00
Tom Hughes
9fb8f5a84b Drop the old output_compression plugin
The production servers all have mod_deflate enabled anyway, which
almost certainly does a better job of compression than this.
2015-03-01 10:52:28 +00:00
Tom Hughes
dbe165bbb3 Fix some rubocop rails style issues 2015-02-26 00:12:54 +00:00
Tom Hughes
dc2a2c8ebd Standardise on double quoted strings 2015-02-20 19:47:26 +00:00
Tom Hughes
ef7f3d800c Fix most auto-correctable rubocop issues 2015-02-20 08:56:16 +00:00
Tom Hughes
34e3e51456 Cleanup trailing whitespace 2015-02-20 08:56:16 +00:00
Paul Norman
a1a5706203 Make the multi-get calls throw 400 errors on invalid input
Also refactor ways and relations to use the same structure as nodes
2013-08-04 10:54:45 +01:00
Tom Hughes
3880ac5de8 Replace :nothing => true with :text => ""
Using `:nothing => true` confusingly actually causes a single space
to be sent as the content by rails.
2013-07-19 11:14:55 +01:00
Tom Hughes
e6a1003509 Avoid reading nodes twice in WayController#full 2013-04-01 14:18:21 +01:00
Tom Hughes
071c3581e9 Disable CSRF token verification for API methods 2011-11-14 09:42:55 +00:00
Tom Hughes
986f1c61fa Use last_modified method instead of setting the header manually 2011-11-14 09:42:44 +00:00
Tom Hughes
226c41be69 Update ActiveRecord queries to use arel 2011-11-14 09:42:44 +00:00
Thomas Wood
ec26e06706 5 character patch to only output duplicated nodes once in a way/full call
Unit tests not run - problems on this system
Fixes #2327
2009-09-29 02:55:35 +00:00
Matt Amos
b8f6dbd403 Adding initial version of the OAuth token authentication method. This adds basic OAuth support for registering apps, getting and revoking keys, etc... The tokens come with 6 separate permissions bits; read/write user preferences, write diaries, write API and read/write GPS traces. Needs more tests. 2009-06-22 16:54:37 +00:00
Tom Hughes
2f3e23f6eb Move to version 2.3.2 of rails. 2009-06-04 08:08:24 +00:00
Tom Hughes
d2f2dc1778 Optimise data loading for browsing ways. 2009-05-31 11:14:19 +00:00
Tom Hughes
b38684e59e Add a global timeout that is applied to most API requests. 2009-05-20 22:18:36 +00:00
Matt Amos
3d0ca940d2 Using an around_handler for catching and rendering errors in most of the API controller methods. This simplifies the code and makes errors and error messages a bit more consistent. Also added a utility method for checking the HTTP method. 2009-05-20 17:39:59 +00:00
Tom Hughes
4eafa04ff8 Reject uploads unless the user has made their edits pubic. 2009-04-16 21:50:20 +00:00
Tom Hughes
5449cf4adc Merge 14394:14533 from trunk. 2009-04-16 21:11:12 +00:00
Tom Hughes
45dfd0f05f Fix spelling mistake. 2009-04-15 08:03:26 +00:00
Tom Hughes
09fdee5493 Add a "database readonly" state that allows all writes to the database
to be suppressed.
2009-04-14 14:27:30 +00:00
Shaun McDonald
fac8b5d28a Log the request on a few requests when there is a bad request, probably should do this in a few more places. This makes it easier to see why we are getting errors/bad requests. 2008-12-12 19:04:28 +00:00
Andy Allan
7058d836f7 use boolean flags when using boolean columns 2008-11-07 13:24:18 +00:00
Matt Amos
6339473cb7 Added tests for ways_for_node. Altered behaviour to not return deleted ways. Fixed ways fixture where most recent history != current. 2008-10-21 10:52:52 +00:00
Matt Amos
b56f57ec43 Fixed up delete methods on nodes, ways and relations to return the new version number and added some more tests. 2008-10-14 14:27:12 +00:00
Matt Amos
1e5782f579 Fixed up way controller tests for API 0.6. 2008-10-13 15:40:32 +00:00
Shaun McDonald
fb5f39f19a Creating consistency check for creation of nodes, way and relations. Moving some creation code from the controller to the model, and adding error handling on create errors. 2008-10-13 15:39:21 +00:00
Shaun McDonald
24b21e4a29 additional consistency checks. making the error message for the number of nodes use the configured number of nodes, rather than a hard coded number. minor improvements to the way controller functional tests. Not sure if they should be turned into integration tests. 2008-10-12 22:32:51 +00:00
Shaun McDonald
3d24694add moving the conistency checks for updates and deletes to library, hopefully got the updates and deletes working now. 2008-10-09 16:22:05 +00:00
Shaun McDonald
328d47e506 Fixing a bug in my foreign keys. I can now upload and download nodes and ways using JOSM in the new API. 2008-10-03 17:09:58 +00:00
Gabriel Ebner
7151fa05e4 api06: simplify exception handling and add exception handling to the diff
upload.
2008-05-13 12:15:06 +00:00
Gabriel Ebner
ea1961e3ce api06: s/delete_with_relations_and_history/delete_with_history/g 2008-05-12 21:10:38 +00:00
Gabriel Ebner
86b4d1bc2c api06: Move version-checking into the models, raising an exception on mismatch
(still not implemented for delete requests though.)
2008-05-12 21:05:11 +00:00
Christopher Schmidt
618908319c prevent update of any object without providing the correct/current
version as part of the XML. This affects update-only at this time: 
DELETE doesn't work the same way because we don't provide the data as 
part of a DELETE
2008-05-11 21:49:33 +00:00
Christopher Schmidt
7a216c0ce6 Make edits return version numbers as plain text strings 2008-05-11 19:47:19 +00:00
Gabriel Ebner
6ebb7045fe api06: Fix diff uploading (still doesn't give a useful response):
Modification and deletion works fine now.  Rollback also works apparently.
Just auto increment doesn't get reset.
2008-05-04 15:16:58 +00:00
Gabriel Ebner
3d6e1c67fb api06: Preliminary support for diff uploading. This will not return anything
useful and the code will need some heavy refactoring.
2008-05-04 13:52:43 +00:00
Gabriel Ebner
6ae23bed90 split_node_tags:
- Use InnoDB.
  - Put version column on the current_* tables.
  - Use transactions (untested).
2008-05-03 16:27:49 +00:00
Tom Hughes
9ff462e96c Remove pointless return statement. 2008-02-03 15:55:19 +00:00
Tom Hughes
59e2349b5a Make ways_for_node work with the multipart primary key stuff. 2008-01-28 08:54:45 +00:00
Steve Coast
bbd769304c dont eager load tags (false primary key fucks all sorts of things up) and move delete way logic to model so that amf_controller can use it (plan is to do this with all of the methods. sigh.) 2008-01-25 14:32:45 +00:00
Steve Coast
db33aa6ff6 begin rdoc documentation 2008-01-24 12:53:21 +00:00
Steve Coast
3e355d7dc0 emit last-modified headers on nodes and ways 2008-01-21 17:41:57 +00:00
Tom Hughes
f09b16cade When asked for ways which use a node, or relations which use some given
object, return 200 OK with an empty document if not matches are found
rather than 400 Bad Request (for ways) or 404 Not Found (for relations).
2007-11-24 14:47:50 +00:00
Tom Hughes
e4df9a8219 Allow objects to be resurrected. 2007-10-31 15:52:36 +00:00