Class: Foursquared::Response::Venue

Inherits:
Object
  • Object
show all
Defined in:
lib/foursquared/response/venue.rb

Overview

Venue response

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/foursquared/response/venue.rb', line 5

def client
  @client
end

#responseObject (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_hereInteger

The number of times the acting user has been to this venue

Returns:

  • (Integer)


204
205
206
# File 'lib/foursquared/response/venue.rb', line 204

def been_here
  response["beenHere"]["count"] if response["beenHere"]
end

#canonical_urlString

The canonical url for this venue

Returns:

  • (String)


44
45
46
# File 'lib/foursquared/response/venue.rb', line 44

def canonical_url
  response["canonicalUrl"]
end

#categoriesArray<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

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :eventId (String)

    The event the user is checking in to.

  • :shout (String)

    A message about your check-in

  • :mentions (String)

    Semicolon-delimited list of mentions

  • :broadcast (String)

    Who to broadcast this check-in to

  • :ll (String)

    Latitude and longitude of the user’s location.

  • :llAcc (String)

    Accuracy of the user’s latitude and longitude, in meters

  • :alt (String)

    Altitude of the user’s location, in meters.

  • :altAcc (String)

    Vertical accuracy of the user’s location, in meters.

Returns:

  • (Hash)

    A checkin object and the post checkin notifications



261
262
263
264
265
# File 'lib/foursquared/response/venue.rb', line 261

def checkin options={}
  options.merge!({:venueId => id})
  checkin_response = post("/checkins/add", options)["response"]
  {:checkin => Foursquared::Response::Checkin.new(self, checkin_response["checkin"]), :notifications => response["notifications"]}
end

#contactHash

The contact details for the venue

Returns:

  • (Hash)


26
27
28
# File 'lib/foursquared/response/venue.rb', line 26

def contact
  response["contact"]
end

#created_atTime

The time at which the venue was added

Returns:

  • (Time)


158
159
160
# File 'lib/foursquared/response/venue.rb', line 158

def created_at
  Time.at(response["createdAt"]) if response["createdAt"]
end

#descriptionString

Venue description

Returns:

  • (String)


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.

Returns:

  • (Boolean)


79
80
81
# File 'lib/foursquared/response/venue.rb', line 79

def dislike?
  response["dislike"]
end

#flagsHash

Present only for venues returned in Explore search results.

Returns:

  • (Hash)


210
211
212
# File 'lib/foursquared/response/venue.rb', line 210

def flags
  response["flags"]
end

#here_nowHash

The users who have checked in here now

Returns:

  • (Hash)

    count and groups of users



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

#hoursHash

Contains the hours during the week that the venue is open along with any named hours segments in a human-readable format.

Returns:

  • (Hash)


104
105
106
# File 'lib/foursquared/response/venue.rb', line 104

def hours
  response["hours"]
end

#idString

The venue ID

Returns:

  • (String)


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.

Returns:

  • (Boolean)


73
74
75
# File 'lib/foursquared/response/venue.rb', line 73

def like?
  response["like"]
end

#likesHash

Users who like the venue

Returns:

  • (Hash)


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

#listedHash

A grouped response of lists that contain this venue

Returns:

  • (Hash)


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

#locationHash

The location details for the venue

Returns:

  • (Hash)


32
33
34
# File 'lib/foursquared/response/venue.rb', line 32

def location
  response["location"]
end

#mayorFoursquared::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 information for the venue.

Returns:

  • (Hash)


98
99
100
# File 'lib/foursquared/response/venue.rb', line 98

def menu
  response["menu"]
end

#nameString

The venue name

Returns:

  • (String)


20
21
22
# File 'lib/foursquared/response/venue.rb', line 20

def name
  response["name"]
end

#photosHash

The venue photos

Returns:

  • (Hash)

    count and groups of 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

#phrasesArray<Hash>

An array of phrases applied to this menu

Returns:

  • (Array<Hash>)


110
111
112
# File 'lib/foursquared/response/venue.rb', line 110

def phrases
  response["phrases"]
end

#priceHash

An object containing the price tier from 1 (least pricey) - 4 (most pricey) and a message describing the price tier.

Returns:

  • (Hash)


67
68
69
# File 'lib/foursquared/response/venue.rb', line 67

def price
  response["price"]
end

#ratingFloat

The rating for this venue

Returns:

  • (Float)


85
86
87
# File 'lib/foursquared/response/venue.rb', line 85

def rating
  response["rating"]
end

#reasonsHash

Count and items of reasons that have been applied at this venue

Returns:

  • (Hash)


116
117
118
# File 'lib/foursquared/response/venue.rb', line 116

def reasons
  response["reasons"]
end

#rolesArray

Present if and only if the current user has at least one assigned role for this venue.

Returns:

  • (Array)


216
217
218
# File 'lib/foursquared/response/venue.rb', line 216

def roles
  response["roles"]
end

#short_urlString

The shortened url for the venue

Returns:

  • (String)


182
183
184
# File 'lib/foursquared/response/venue.rb', line 182

def short_url
  response["shortUrl"]
end

#specialsHash

Count and items of specials at the venue

Returns:

  • (Hash)


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_nearbyArray<Foursquared::Response::Special>

Specials available at nearby venues

Returns:



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

#statsHash

Contains checkinsCount , usersCount , and tipCount.

Returns:

  • (Hash)


56
57
58
# File 'lib/foursquared/response/venue.rb', line 56

def stats
  response["stats"]
end

#tagsArray<String>

Array of string tags for this venue

Returns:

  • (Array<String>)


176
177
178
# File 'lib/foursquared/response/venue.rb', line 176

def tags
  response["tags"]
end

#time_zoneString

The time zone

Returns:

  • (String)


188
189
190
# File 'lib/foursquared/response/venue.rb', line 188

def time_zone
  response["timeZone"]
end

#tipsHash

The tips for this venue

Returns:

  • (Hash)


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

#urlObject

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

Returns:

  • (Boolean)


38
39
40
# File 'lib/foursquared/response/venue.rb', line 38

def verified?
  response["verified"]
end