jackpine / biketag-ios

http://biketag.jackpine.me
1 stars 1 forks source link

API endpoint: Get current spot #7

Closed michaelkirk closed 9 years ago

michaelkirk commented 9 years ago

example response

GET api.biketag.org/v1/games/1/spots/current
{
  spot:  { 
    id: 123,
    user_id: 456,
    image_url: "https://biketag.s3.aws.com/foo/bar/1235.jpg",
    captured_at: "2015-03-12 16:12:01 PDT" 
  }
}

Note: currently we're using the device ID as a user id. I'm hoping to push off inventing a log flow, but... maybe it's not worth thinking through the process of handling the API upgrade.

Note the /games/1 in the url - Currently here is only one game, but I'm confident we'll want to eventually support multiple simultaneous games - adding this prefix let's us be forward compatible with what the multi game API might look like. I hope I don't regret that.

michaelkirk commented 9 years ago

I changed the requirements slightly, based on the seat-of-my-pants design.

This became a method on the GamesController, not on the spots collection.

GET api.biketag.org/v1/games/1/spots/current

{
  "spot": {
    "id":3,
    "created_at":"2015-03-17T01:54:09.641Z",
    "image_url":"http://biketag-development.s3.amazonaws.com/spots/images/000/000/003/medium/952_lucile.jpg?1426557241"
    "url":"http://192.168.59.103:3000/api/v1/games/1/spot/3.json",
    "user_id":1,
    "user_name":"michael"
  }
}
michaelkirk commented 9 years ago

FYI this was delivered with: michaelkirk/biketag-api@aa7311fe18f8c6fde69037c9c60beb84b066b5c9 and michaelkirk/biketag-api@b7ab6f52c5176812c96007e29e3306873d5c037c

michaelkirk commented 9 years ago

I suppose this doesn't do anything until there is some client code to make use of it =).

michaelkirk commented 9 years ago

OK! Client code here: https://github.com/michaelkirk/biketag/commit/10657994257f8c720649e0213f4ea9868cc5f855

And some progress indicator polish here: https://github.com/michaelkirk/biketag/commit/60783d2dbdbc979a2dca157aa9dde869c42cb5dc