Module: Catch::Place
- Included in:
- Client
- Defined in:
- lib/catch/place.rb
Instance Method Summary collapse
-
#add_place(latitude, longitude, params = {}) ⇒ Object
Add a place.
-
#delete_place(id) ⇒ Object
Deletes the place.
-
#modify_place(id, params = {}) ⇒ Object
Modifies the properties of a place.
-
#place(id) ⇒ Object
Returns a place by id.
-
#places(params = {}) ⇒ Object
Lists all places for the user.
Instance Method Details
#add_place(latitude, longitude, params = {}) ⇒ Object
Add a place
Waiting on annotations
32 33 34 35 36 37 38 |
# File 'lib/catch/place.rb', line 32 def add_place(latitude, longitude, params={}) params[:latitude] = latitude params[:longitude] = longitude payload = params.map {|k,v| "#{k}=#{v}"}.join("&") response = connection.put "places", payload response.body.result end |
#delete_place(id) ⇒ Object
Deletes the place
63 64 65 |
# File 'lib/catch/place.rb', line 63 def delete_place(id) connection.delete("places/#{id}").body.status == 'ok' end |
#modify_place(id, params = {}) ⇒ Object
Modifies the properties of a place
Waiting on annotations
54 55 56 57 58 |
# File 'lib/catch/place.rb', line 54 def modify_place(id, params={}) payload = params.map {|k,v| "#{k}=#{v}"}.join("&") response = connection.post "places/#{id}", payload response.body.result end |
#place(id) ⇒ Object
Returns a place by id
16 17 18 |
# File 'lib/catch/place.rb', line 16 def place(id) connection.get("places/#{id}").body end |
#places(params = {}) ⇒ Object
Lists all places for the user
6 7 8 9 10 11 |
# File 'lib/catch/place.rb', line 6 def places(params={}) connection.get do |req| req.url("places") req.params.merge!(params) end.body.result end |