Skip to content

Instantly share code, notes, and snippets.

@sgoodwin
Created August 25, 2014 13:30
Show Gist options
  • Save sgoodwin/5d92b496e0e2a1f82759 to your computer and use it in GitHub Desktop.
Save sgoodwin/5d92b496e0e2a1f82759 to your computer and use it in GitHub Desktop.
An example API to test offline queuing.
require 'sinatra'
require 'sinatra/json'
items = { "234" => { "name" => "Pokemon", "isLiked" => false, "id" => "234" } }
get '/' do
hash = { "data" => items.values }
json hash
end
put '/' do
item = items[params[:item_id]]
item["isLiked"] = !item["isLiked"]
puts items
200
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment