Module: Foursquared::Venues
- Included in:
- Client
- Defined in:
- lib/foursquared/venues.rb
Overview
Venues module
Instance Method Summary collapse
-
#add_venue(options = {}) ⇒ Object
Add a venue.
-
#explore_venues(options = {}) ⇒ Object
Explore Recommended and Popular Venues.
-
#flag_venue(venue_id, options = {}) ⇒ Object
Flag a Venue.
-
#like_venue(venue_id, options = {}) ⇒ Hash
Like or unlike a venue.
-
#managed_venues ⇒ Array<Foursquared::Response::Venue>
Get a list of venues the current user manages.
-
#propose_venue_edit(venue_id, options = {}) ⇒ Object
Propose an Edit to a Venue.
-
#search_venues(options = {}) ⇒ Array
Returns a list of venues near the current location, optionally matching a search term.
-
#trending_venues(options = {}) ⇒ Array
Returns a list of venues near the current location with the most people currently checked in.
-
#venue(venue_id) ⇒ Foursquared::Response::Venue
Venue detail.
-
#venue_categories ⇒ Array<Foursquared::Response::Category>
Returns a hierarchical list of categories applied to venues.
-
#venue_events(venue_id) ⇒ Hash
Gives information about the current events at a place.
-
#venue_hours(venue_id) ⇒ Array
Returns hours for a venue.
-
#venue_likes(venue_id) ⇒ Hash
Returns a list of venues similar to the specified venue.
-
#venue_lists(venue_id, options = {}) ⇒ Hash
The lists that this venue appears on.
-
#venue_photos(venue_id, options = {}) ⇒ Hash
Returns photos for a venue.
Instance Method Details
#add_venue(options = {}) ⇒ Object
Add a venue
30 31 32 33 |
# File 'lib/foursquared/venues.rb', line 30 def add_venue ={} response = post("/venues/add", )["response"] Foursquared::Response::Venue.new(self, response["venue"]) end |
#explore_venues(options = {}) ⇒ Object
Explore Recommended and Popular Venues
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/foursquared/venues.rb', line 58 def explore_venues ={} response = get("/venues/explore", )["response"] response["groups"].each do |group| response["items"].each do |item| item["venue"] = Foursquared::Response::Venue.new(self, item["venue"]) item["tips"].map!{|tip| Foursquared::Response::List.new(self, tip)} end end response end |
#flag_venue(venue_id, options = {}) ⇒ Object
Flag a Venue
184 185 186 |
# File 'lib/foursquared/venues.rb', line 184 def flag_venue venue_id, ={} response = post("/venues/#{venue_id}/flag", ) end |
#like_venue(venue_id, options = {}) ⇒ Hash
Like or unlike a venue
193 194 195 196 197 198 199 |
# File 'lib/foursquared/venues.rb', line 193 def like_venue venue_id, ={} response = post("/venues/#{venue_id}/like", )["response"]["likes"] response["groups"].each do |group| response["items"].map!{|item| Foursquared::Response::User.new(self, item)} end response end |
#managed_venues ⇒ Array<Foursquared::Response::Venue>
Get a list of venues the current user manages.
71 72 73 74 |
# File 'lib/foursquared/venues.rb', line 71 def managed_venues response = get("/venues/managed")["response"] @venues = response["venues"].collect{|venue| Foursquared::Response::Venue.new(self, venue)} end |
#propose_venue_edit(venue_id, options = {}) ⇒ Object
Propose an Edit to a Venue
213 214 215 |
# File 'lib/foursquared/venues.rb', line 213 def propose_venue_edit venue_id, ={} response = post("/venues/#{venue_id}", ) end |
#search_venues(options = {}) ⇒ Array
Returns a list of venues near the current location, optionally matching a search term.
94 95 96 97 |
# File 'lib/foursquared/venues.rb', line 94 def search_venues ={} response = get("/venues/search", )["response"] @venues = response["venues"].collect{|venue| Foursquared::Response::Venue.new(self, venue)} end |
#trending_venues(options = {}) ⇒ Array
Returns a list of venues near the current location with the most people currently checked in.
105 106 107 108 |
# File 'lib/foursquared/venues.rb', line 105 def trending_venues ={} response = get("/venues/trending", )["response"] @venues = response["venues"].collect{|venue| Foursquared::Response::Venue.new(self, venue)} end |
#venue(venue_id) ⇒ Foursquared::Response::Venue
Venue detail
9 10 11 12 |
# File 'lib/foursquared/venues.rb', line 9 def venue venue_id response = get("/venues/#{venue_id}")["response"] @venue = Foursquared::Response::Venue.new(self, response["venue"]) end |
#venue_categories ⇒ Array<Foursquared::Response::Category>
Returns a hierarchical list of categories applied to venues.
37 38 39 40 |
# File 'lib/foursquared/venues.rb', line 37 def venue_categories response = get("/venues/categories")["response"] response["categories"].collect{|category| Foursquared::Response::Category.new(self, category) } end |
#venue_events(venue_id) ⇒ Hash
Gives information about the current events at a place.
113 114 115 116 117 118 |
# File 'lib/foursquared/venues.rb', line 113 def venue_events venue_id response = get("/venues/#{venue_id}/events")["response"] @events = response["events"] @events["items"].map!{|item| Foursquared::Response::Event.new(self, item)} @events end |
#venue_hours(venue_id) ⇒ Array
Returns hours for a venue.
123 124 125 |
# File 'lib/foursquared/venues.rb', line 123 def venue_hours venue_id response = get("/venues/#{venue_id}/hours")["response"]["hours"] end |
#venue_likes(venue_id) ⇒ Hash
Returns a list of venues similar to the specified venue.
130 131 132 133 134 135 136 |
# File 'lib/foursquared/venues.rb', line 130 def venue_likes venue_id response = get("/venues/#{venue_id}/likes")["response"]["likes"] response["groups"].each do |group| response["items"].map!{|item| Foursquared::Response::User.new(self, item)} end response end |
#venue_lists(venue_id, options = {}) ⇒ Hash
The lists that this venue appears on.
145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/foursquared/venues.rb', line 145 def venue_lists venue_id, ={} response = get("/venues/#{venue_id}/lists", )["response"]["lists"] if response["groups"] response["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::Lists.new(self, item)} if group["items"] end else response["items"].map!{|item| Foursquared::Response::Lists.new(self, item)} end response end |
#venue_photos(venue_id, options = {}) ⇒ Hash
Returns photos for a venue.
164 165 166 167 168 |
# File 'lib/foursquared/venues.rb', line 164 def venue_photos venue_id, ={} response = get("/venues/#{venue_id}/photos", )["response"]["photos"] response["items"].map!{|item| Foursquared::Response::Photo.new(self, item)} response end |