Module: Foursquared::Lists
- Included in:
- Client
- Defined in:
- lib/foursquared/lists.rb
Overview
Lists module
Instance Method Summary collapse
-
#add_list(options = {}) ⇒ Foursquared::Response::List
Add a List.
-
#add_list_item(list_id, options = {}) ⇒ Foursquared::Response::ListItem
Add an Item to a list.
-
#delete_list_item(list_id, options = {}) ⇒ Hash
Delete an item from the list.
-
#list(list_id, options = {}) ⇒ Foursquared::Response::List
Gives details about a list.
-
#suggest_list_photo(list_id, options = {}) ⇒ Hash
Suggests photos that may be appropriate for a list item.
-
#suggest_list_tip(list_id, options = {}) ⇒ Object
Suggests tips that may be appropriate for a list item.
-
#suggest_list_venues(list_id) ⇒ Array
Suggests venues that may be appropriate for a list.
Instance Method Details
#add_list(options = {}) ⇒ Foursquared::Response::List
Add a List
24 25 26 27 |
# File 'lib/foursquared/lists.rb', line 24 def add_list ={} response = post("/lists/add", )["response"] Foursquared::Response::List.new(self, response["list"]) end |
#add_list_item(list_id, options = {}) ⇒ Foursquared::Response::ListItem
Add an Item to a list
79 80 81 82 |
# File 'lib/foursquared/lists.rb', line 79 def add_list_item list_id, ={} @item = post("/lists/#{list_id}/additem", )["response"]["item"] Foursquared::Response::ListItem.new(client, @item) if @item end |
#delete_list_item(list_id, options = {}) ⇒ Hash
Delete an item from the list
91 92 93 94 95 |
# File 'lib/foursquared/lists.rb', line 91 def delete_list_item list_id, ={} @items = client.post("/lists/#{list_id}/deleteitem", )["response"]["items"] @items["items"].map!{|item| Foursquared::Response::ListItem.new(client, item)} @list_items end |
#list(list_id, options = {}) ⇒ Foursquared::Response::List
Gives details about a list.
12 13 14 15 |
# File 'lib/foursquared/lists.rb', line 12 def list list_id, ={} response = get("/lists/#{list_id}", )["response"] @list = Foursquared::Response::List.new(self, response["list"]) end |
#suggest_list_photo(list_id, options = {}) ⇒ Hash
Suggests photos that may be appropriate for a list item.
34 35 36 37 38 39 40 41 42 |
# File 'lib/foursquared/lists.rb', line 34 def suggest_list_photo list_id, ={} @photos = get("/lists/#{list_id}/suggestphoto", )["response"]["photos"] if @photos @photos.each_key do |key| key["items"] = key["items"].collect{|photo| Foursquared::Response::Photo.new(client, photo)} end end @photos end |
#suggest_list_tip(list_id, options = {}) ⇒ Object
Suggests tips that may be appropriate for a list item
59 60 61 62 63 64 65 66 67 |
# File 'lib/foursquared/lists.rb', line 59 def suggest_list_tip list_id, ={} @tips = get("/lists/#{list_id}/suggesttip", )["response"]["tips"] if @tips @tips.each_key do |key| key["items"].map!{|item| Foursquared::Response::Photo.new(client, item)} end end @tips end |
#suggest_list_venues(list_id) ⇒ Array
Suggests venues that may be appropriate for a list.
47 48 49 50 51 52 53 |
# File 'lib/foursquared/lists.rb', line 47 def suggest_list_venues list_id @suggested_venues = get("/lists/#{list_id}/suggestvenues")["response"]["suggestedVenues"] @suggested_venues.each do |item| item["venue"] = Foursquared::Response::Venue.new(self, item["venue"]) end @suggested_venues end |