Class: Foursquared::Response::Venue
- Inherits:
-
Object
- Object
- Foursquared::Response::Venue
- Defined in:
- lib/foursquared/response/venue.rb
Overview
Venue response
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#been_here ⇒ Integer
The number of times the acting user has been to this venue.
-
#canonical_url ⇒ String
The canonical url for this venue.
-
#categories ⇒ Array<Foursquared::Response::Category>
Array of categories that have been applied to this venue.
-
#checkin(options = {}) ⇒ Hash
Checkin at this venue.
-
#contact ⇒ Hash
The contact details for the venue.
-
#created_at ⇒ Time
The time at which the venue was added.
-
#description ⇒ String
Venue description.
-
#dislike? ⇒ Boolean
Whether the current user has disliked this venue.
-
#flags ⇒ Hash
Present only for venues returned in Explore search results.
-
#here_now ⇒ Hash
The users who have checked in here now.
-
#hours ⇒ Hash
Contains the hours during the week that the venue is open along with any named hours segments in a human-readable format.
-
#id ⇒ String
The venue ID.
-
#initialize(client, response) ⇒ Venue
constructor
A new instance of Venue.
-
#like? ⇒ Boolean
Whether the current user has liked this venue.
-
#likes ⇒ Hash
Users who like the venue.
-
#listed ⇒ Hash
A grouped response of lists that contain this venue.
-
#location ⇒ Hash
The location details for the venue.
-
#mayor ⇒ Foursquared::Response::User
The mayor of the venue.
-
#menu ⇒ Hash
Menu information for the venue.
-
#name ⇒ String
The venue name.
-
#photos ⇒ Hash
The venue photos.
-
#phrases ⇒ Array<Hash>
An array of phrases applied to this menu.
-
#price ⇒ Hash
An object containing the price tier from 1 (least pricey) - 4 (most pricey) and a message describing the price tier.
-
#rating ⇒ Float
The rating for this venue.
-
#reasons ⇒ Hash
Count and items of reasons that have been applied at this venue.
-
#roles ⇒ Array
Present if and only if the current user has at least one assigned role for this venue.
-
#short_url ⇒ String
The shortened url for the venue.
-
#specials ⇒ Hash
Count and items of specials at the venue.
-
#specials_nearby ⇒ Array<Foursquared::Response::Special>
Specials available at nearby venues.
-
#stats ⇒ Hash
Contains checkinsCount , usersCount , and tipCount.
-
#tags ⇒ Array<String>
Array of string tags for this venue.
-
#time_zone ⇒ String
The time zone.
-
#tips ⇒ Hash
The tips for this venue.
-
#url ⇒ Object
URL of the venue’s website, typically provided by the venue manager.
-
#verified? ⇒ Boolean
Whether this is a verified venue.
Constructor Details
#initialize(client, response) ⇒ Venue
Returns a new instance of Venue.
7 8 9 10 |
# File 'lib/foursquared/response/venue.rb', line 7 def initialize client, response @client = client @response = response end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/foursquared/response/venue.rb', line 5 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/foursquared/response/venue.rb', line 5 def response @response end |
Instance Method Details
#been_here ⇒ Integer
The number of times the acting user has been to this venue
204 205 206 |
# File 'lib/foursquared/response/venue.rb', line 204 def been_here response["beenHere"]["count"] if response["beenHere"] end |
#canonical_url ⇒ String
The canonical url for this venue
44 45 46 |
# File 'lib/foursquared/response/venue.rb', line 44 def canonical_url response["canonicalUrl"] end |
#categories ⇒ Array<Foursquared::Response::Category>
Array of categories that have been applied to this venue
50 51 52 |
# File 'lib/foursquared/response/venue.rb', line 50 def categories response["categories"].map!{|category| Foursquared::Response::Category.new(client, category)} if response["categories"] end |
#checkin(options = {}) ⇒ Hash
Checkin at this venue
261 262 263 264 265 |
# File 'lib/foursquared/response/venue.rb', line 261 def checkin ={} .merge!({:venueId => id}) checkin_response = post("/checkins/add", )["response"] {:checkin => Foursquared::Response::Checkin.new(self, checkin_response["checkin"]), :notifications => response["notifications"]} end |
#contact ⇒ Hash
The contact details for the venue
26 27 28 |
# File 'lib/foursquared/response/venue.rb', line 26 def contact response["contact"] end |
#created_at ⇒ Time
The time at which the venue was added
158 159 160 |
# File 'lib/foursquared/response/venue.rb', line 158 def created_at Time.at(response["createdAt"]) if response["createdAt"] end |
#description ⇒ String
Venue description
122 123 124 |
# File 'lib/foursquared/response/venue.rb', line 122 def description response["description"] end |
#dislike? ⇒ Boolean
Whether the current user has disliked this venue.
79 80 81 |
# File 'lib/foursquared/response/venue.rb', line 79 def dislike? response["dislike"] end |
#flags ⇒ Hash
Present only for venues returned in Explore search results.
210 211 212 |
# File 'lib/foursquared/response/venue.rb', line 210 def flags response["flags"] end |
#here_now ⇒ Hash
The users who have checked in here now
234 235 236 237 238 239 240 241 242 |
# File 'lib/foursquared/response/venue.rb', line 234 def here_now @here_now = response["hereNow"] if @here_now @here_now["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(client, item)} end end @here_now end |
#hours ⇒ Hash
Contains the hours during the week that the venue is open along with any named hours segments in a human-readable format.
104 105 106 |
# File 'lib/foursquared/response/venue.rb', line 104 def hours response["hours"] end |
#id ⇒ String
The venue ID
14 15 16 |
# File 'lib/foursquared/response/venue.rb', line 14 def id response["id"] end |
#like? ⇒ Boolean
Whether the current user has liked this venue.
73 74 75 |
# File 'lib/foursquared/response/venue.rb', line 73 def like? response["like"] end |
#likes ⇒ Hash
Users who like the venue
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/foursquared/response/venue.rb', line 134 def likes likes_response = client.get("/venues/#{id}/likes")["response"] @likes = {} if likes_response["likes"] @likes.merge!(likes_response["likes"]) if @likes["groups"] @likes["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(client, item)} end end end @likes end |
#listed ⇒ Hash
A grouped response of lists that contain this venue
194 195 196 197 198 199 200 |
# File 'lib/foursquared/response/venue.rb', line 194 def listed @listed = response["listed"] @listed["groups"].each do |group| @listed["items"].map!{|item| Foursquared::Response::List.new(client, item)} end @listed end |
#location ⇒ Hash
The location details for the venue
32 33 34 |
# File 'lib/foursquared/response/venue.rb', line 32 def location response["location"] end |
#mayor ⇒ Foursquared::Response::User
The mayor of the venue
128 129 130 |
# File 'lib/foursquared/response/venue.rb', line 128 def mayor Foursquared::Response::User.new(response["mayor"]["user"]) if response["mayor"] and response["mayor"]["user"] end |
#menu ⇒ Hash
Menu information for the venue.
98 99 100 |
# File 'lib/foursquared/response/venue.rb', line 98 def response["menu"] end |
#name ⇒ String
The venue name
20 21 22 |
# File 'lib/foursquared/response/venue.rb', line 20 def name response["name"] end |
#photos ⇒ Hash
The venue photos
222 223 224 225 226 227 228 229 230 |
# File 'lib/foursquared/response/venue.rb', line 222 def photos @photos = response["photos"] if @photos @photos["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::Photo.new(client, item)} end end @photos end |
#phrases ⇒ Array<Hash>
An array of phrases applied to this menu
110 111 112 |
# File 'lib/foursquared/response/venue.rb', line 110 def phrases response["phrases"] end |
#price ⇒ Hash
An object containing the price tier from 1 (least pricey) - 4 (most pricey) and a message describing the price tier.
67 68 69 |
# File 'lib/foursquared/response/venue.rb', line 67 def price response["price"] end |
#rating ⇒ Float
The rating for this venue
85 86 87 |
# File 'lib/foursquared/response/venue.rb', line 85 def response["rating"] end |
#reasons ⇒ Hash
Count and items of reasons that have been applied at this venue
116 117 118 |
# File 'lib/foursquared/response/venue.rb', line 116 def reasons response["reasons"] end |
#roles ⇒ Array
Present if and only if the current user has at least one assigned role for this venue.
216 217 218 |
# File 'lib/foursquared/response/venue.rb', line 216 def roles response["roles"] end |
#short_url ⇒ String
The shortened url for the venue
182 183 184 |
# File 'lib/foursquared/response/venue.rb', line 182 def short_url response["shortUrl"] end |
#specials ⇒ Hash
Count and items of specials at the venue
150 151 152 153 154 |
# File 'lib/foursquared/response/venue.rb', line 150 def specials @specials = response["specials"] @specials["items"].map!{|item| Foursquared::Response::Special.new(client, item)} if @specials @specials end |
#specials_nearby ⇒ Array<Foursquared::Response::Special>
Specials available at nearby venues
246 247 248 |
# File 'lib/foursquared/response/venue.rb', line 246 def specials_nearby response["specialsNearby"].map{|special| Foursquared::Response::Special.new(client, special)} if response["specialsNearby"] end |
#stats ⇒ Hash
Contains checkinsCount , usersCount , and tipCount.
56 57 58 |
# File 'lib/foursquared/response/venue.rb', line 56 def stats response["stats"] end |
#tags ⇒ Array<String>
Array of string tags for this venue
176 177 178 |
# File 'lib/foursquared/response/venue.rb', line 176 def response["tags"] end |
#time_zone ⇒ String
The time zone
188 189 190 |
# File 'lib/foursquared/response/venue.rb', line 188 def time_zone response["timeZone"] end |
#tips ⇒ Hash
The tips for this venue
164 165 166 167 168 169 170 171 172 |
# File 'lib/foursquared/response/venue.rb', line 164 def tips @tips = response["tips"] if @tips["groups"] @tips["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::Tip.new(client, item)} end end @tips end |
#url ⇒ Object
URL of the venue’s website, typically provided by the venue manager.
61 62 63 |
# File 'lib/foursquared/response/venue.rb', line 61 def url response["url"] end |
#verified? ⇒ Boolean
Whether this is a verified venue
38 39 40 |
# File 'lib/foursquared/response/venue.rb', line 38 def verified? response["verified"] end |