Module: Foursquare2::Venues
- Included in:
- Client
- Defined in:
- lib/foursquare2/venues.rb
Instance Method Summary collapse
-
#add_venue(options = {}) ⇒ Object
Add a venue.
-
#edit_venue(venue_id, options = {}) ⇒ Object
Make changes to a venue.
-
#explore_venues(options = {}) ⇒ Object
Explore venues.
-
#flag_venue(venue_id, options = {}) ⇒ Object
Flag a venue as having a problem.
-
#herenow(venue_id, options = {}) ⇒ Object
Returns a list of users that are currently checked into a venue.
-
#managed_venue_stats(venue_id, options = {}) ⇒ Object
Get venue stats over a given time range.
-
#managed_venues ⇒ Object
Returns a list of venues managed.
-
#mark_venue_todo(venue_id, options = {}) ⇒ Object
Mark a venue as todo for the authenticated user.
-
#propose_venue_edit(venue_id, options = {}) ⇒ Object
Propose a venue edit.
-
#search_venues(options = {}) ⇒ Object
Search for venues.
-
#search_venues_by_tip(options = {}) ⇒ Object
Search for venues by tip.
-
#suggest_completion_venues(options = {}) ⇒ Object
Suggest venue completions.
-
#trending_venues(ll, options = {}) ⇒ Object
Search for trending venues.
-
#venue(venue_id) ⇒ Object
Retrieve information about a venue.
-
#venue_categories ⇒ Object
Retrieve information about all venue categories.
-
#venue_events(venue_id) ⇒ Object
Get the events currently taking place at a venue.
-
#venue_hours(venue_id) ⇒ Object
Get venue hours information.
-
#venue_likes(venue_id) ⇒ Object
Returns friends and a total count of users who have liked this venue.
-
#venue_links(venue_id) ⇒ Object
Retrieve links for a venue.
-
#venue_listed(venue_id, options = {}) ⇒ Object
Returns the lists that this venue appears on.
-
#venue_menus(venue_id) ⇒ Object
Retrieve menus for a venue.
-
#venue_nextvenues(venue_id) ⇒ Object
Returns venues that people often check in to after the current venue.
-
#venue_similar(venue_id) ⇒ Object
Returns a list of venues similar to the specified venue.
-
#venues_timeseries(options = {}) ⇒ Object
Get daily venue stats for a list of venues over a time range.
Instance Method Details
#add_venue(options = {}) ⇒ Object
Add a venue
92 93 94 95 96 97 |
# File 'lib/foursquare2/venues.rb', line 92 def add_venue(={}) response = connection.post do |req| req.url "venues/add", end return_error_or_body(response, response.body.response.venue) end |
#edit_venue(venue_id, options = {}) ⇒ Object
Make changes to a venue
163 164 165 166 167 168 |
# File 'lib/foursquare2/venues.rb', line 163 def edit_venue(venue_id, ={}) response = connection.post do |req| req.url "venues/#{venue_id}/edit", end return_error_or_body(response, response.body.response) end |
#explore_venues(options = {}) ⇒ Object
Explore venues
184 185 186 187 188 189 |
# File 'lib/foursquare2/venues.rb', line 184 def explore_venues(={}) response = connection.get do |req| req.url "venues/explore", end return_error_or_body(response, response.body.response) end |
#flag_venue(venue_id, options = {}) ⇒ Object
Flag a venue as having a problem
118 119 120 121 122 123 |
# File 'lib/foursquare2/venues.rb', line 118 def flag_venue(venue_id, ={}) response = connection.post do |req| req.url "venues/#{venue_id}/flag", end return_error_or_body(response, response.body.response) end |
#herenow(venue_id, options = {}) ⇒ Object
Returns a list of users that are currently checked into a venue
param [String] venue_id The ID of the venue managed by the current user
225 226 227 228 229 230 |
# File 'lib/foursquare2/venues.rb', line 225 def herenow(venue_id, ={}) response = connection.get do |req| req.url "venues/#{venue_id}/herenow", end return_error_or_body(response, response.body.response) end |
#managed_venue_stats(venue_id, options = {}) ⇒ Object
Get venue stats over a given time range. Client instance should represent an OAuth user who is the venue owner. Note: returns more detailed statistics than the basic stats returned when calling venue(venue_id)
param [String] venue_id The ID of the venue managed by the current user
251 252 253 254 255 256 |
# File 'lib/foursquare2/venues.rb', line 251 def managed_venue_stats(venue_id, ={}) response = connection.get do |req| req.url "venues/#{venue_id}/stats", end return_error_or_body(response, response.body.response) end |
#managed_venues ⇒ Object
Returns a list of venues managed
236 237 238 239 240 241 |
# File 'lib/foursquare2/venues.rb', line 236 def managed_venues() response = connection.get do |req| req.url "venues/managed" end return_error_or_body(response, response.body.response.venues) end |
#mark_venue_todo(venue_id, options = {}) ⇒ Object
Mark a venue as todo for the authenticated user
105 106 107 108 109 110 |
# File 'lib/foursquare2/venues.rb', line 105 def mark_venue_todo(venue_id, ={}) response = connection.post do |req| req.url "venues/#{venue_id}/marktodo", end return_error_or_body(response, response.body.response) end |
#propose_venue_edit(venue_id, options = {}) ⇒ Object
Propose a venue edit
138 139 140 141 142 143 |
# File 'lib/foursquare2/venues.rb', line 138 def propose_venue_edit(venue_id, ={}) response = connection.post do |req| req.url "venues/#{venue_id}/proposeedit", end return_error_or_body(response, response.body.response) end |
#search_venues(options = {}) ⇒ Object
Search for venues
24 25 26 27 28 29 |
# File 'lib/foursquare2/venues.rb', line 24 def search_venues(={}) response = connection.get do |req| req.url "venues/search", end return_error_or_body(response, response.body.response) end |
#search_venues_by_tip(options = {}) ⇒ Object
Search for venues by tip
55 56 57 58 59 60 61 62 |
# File 'lib/foursquare2/venues.rb', line 55 def search_venues_by_tip(={}) tips = search_tips() venues = [] tips.each do |tip| venues << tip['venue'] end venues end |
#suggest_completion_venues(options = {}) ⇒ Object
Suggest venue completions. Returns a list of mini-venues partially matching the search term, near the location.
201 202 203 204 205 206 |
# File 'lib/foursquare2/venues.rb', line 201 def suggest_completion_venues(={}) response = connection.get do |req| req.url "venues/suggestCompletion", end return_error_or_body(response, response.body.response) end |
#trending_venues(ll, options = {}) ⇒ Object
Search for trending venues
38 39 40 41 42 43 44 |
# File 'lib/foursquare2/venues.rb', line 38 def trending_venues(ll, ={}) [:ll] = ll response = connection.get do |req| req.url "venues/trending", end return_error_or_body(response, response.body.response) end |
#venue(venue_id) ⇒ Object
Retrieve information about a venue
param [String] venue_id The ID of the venue
8 9 10 11 |
# File 'lib/foursquare2/venues.rb', line 8 def venue(venue_id) response = connection.get("venues/#{venue_id}") return_error_or_body(response, response.body.response.venue) end |
#venue_categories ⇒ Object
Retrieve information about all venue categories.
66 67 68 69 |
# File 'lib/foursquare2/venues.rb', line 66 def venue_categories response = connection.get("venues/categories") return_error_or_body(response, response.body.response.categories) end |
#venue_events(venue_id) ⇒ Object
Get the events currently taking place at a venue.
param [String] venue_id The ID of the venue
288 289 290 291 |
# File 'lib/foursquare2/venues.rb', line 288 def venue_events(venue_id) response = connection.get("venues/#{venue_id}/events") return_error_or_body(response, response.body.response) end |
#venue_hours(venue_id) ⇒ Object
Get venue hours information.
param [String] venue_id The ID of the venue
279 280 281 282 |
# File 'lib/foursquare2/venues.rb', line 279 def venue_hours(venue_id) response = connection.get("venues/#{venue_id}/hours") return_error_or_body(response, response.body.response) end |
#venue_likes(venue_id) ⇒ Object
Returns friends and a total count of users who have liked this venue.
param [String] venue_id The ID of the venue to get likes for
297 298 299 300 |
# File 'lib/foursquare2/venues.rb', line 297 def venue_likes(venue_id) response = connection.get("venues/#{venue_id}/likes") return_error_or_body(response, response.body.response) end |
#venue_links(venue_id) ⇒ Object
Retrieve links for a venue.
param [String] venue_id The ID of the venue
75 76 77 78 |
# File 'lib/foursquare2/venues.rb', line 75 def venue_links(venue_id) response = connection.get("venues/#{venue_id}/links") return_error_or_body(response, response.body.response.links) end |
#venue_listed(venue_id, options = {}) ⇒ Object
Returns the lists that this venue appears on.
param [String] venue_id ID of a venue to get lists for.
309 310 311 312 313 314 |
# File 'lib/foursquare2/venues.rb', line 309 def venue_listed(venue_id, ={}) response = connection.get do |req| req.url "venues/#{venue_id}/listed", end return_error_or_body(response, response.body.response) end |
#venue_menus(venue_id) ⇒ Object
Retrieve menus for a venue.
param [String] venue_id The ID of the venue
212 213 214 215 |
# File 'lib/foursquare2/venues.rb', line 212 def (venue_id) response = connection.get("venues/#{venue_id}/menu") return_error_or_body(response, response.body.response) end |
#venue_nextvenues(venue_id) ⇒ Object
Returns venues that people often check in to after the current venue. Up to 5 venues are returned in each query, and results are sorted by how many people have visited that venue after the current one. Homes are never returned in results.
param [String] venue_id Required. ID of the venue you want to see next venue information about
320 321 322 323 |
# File 'lib/foursquare2/venues.rb', line 320 def venue_nextvenues(venue_id) response = connection.get("venues/#{venue_id}/nextvenues") return_error_or_body(response, response.body.response) end |
#venue_similar(venue_id) ⇒ Object
Returns a list of venues similar to the specified venue.
param [String] venue_id The venue you want similar venues for.
329 330 331 332 |
# File 'lib/foursquare2/venues.rb', line 329 def venue_similar(venue_id) response = connection.get("venues/#{venue_id}/similar") return_error_or_body(response, response.body.response) end |
#venues_timeseries(options = {}) ⇒ Object
Get daily venue stats for a list of venues over a time range. Client instance should represent an OAuth user who is the venues owner.
267 268 269 270 271 272 273 |
# File 'lib/foursquare2/venues.rb', line 267 def venues_timeseries(={}) [:venueId] = [:venueId].join(',') # Transforms the array into a 'comma-separated list' of ids. response = connection.get do |req| req.url "venues/timeseries", end return_error_or_body(response, response.body.response) end |