Class: Mosaic::Foursquare::Venue

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaic/foursquare/venue.rb

Defined Under Namespace

Classes: Location, Stats

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

query, request_count, request_count=

Methods included from Utils::Helpers

#underscore_string

Constructor Details

#initialize(attributes = {}) ⇒ Venue

Returns a new instance of Venue.



26
27
28
29
30
31
32
33
34
# File 'lib/mosaic/foursquare/venue.rb', line 26

def initialize(attributes = {})
  super
  self.location &&= Mosaic::Foursquare::Venue::Location.new(self.location)
  self.updates = Mosaic::Foursquare::Update.from_venue(attributes)
  self.mayor &&= (self.mayor['user'] ? Mosaic::Foursquare::User.new(self.mayor['user']) : nil)
  self.stats &&= Mosaic::Foursquare::Venue::Stats.new(self.stats)
  self.stats.photos_count = attributes["photos"]["count"]
  self.stats.updates_count = attributes["pageUpdates"]["count"]
end

Instance Attribute Details

#canonical_urlObject

Returns the value of attribute canonical_url.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def canonical_url
  @canonical_url
end

#created_atObject

Returns the value of attribute created_at.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def description
  @description
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def id
  @id
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def location
  @location
end

#mayorObject

Returns the value of attribute mayor.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def mayor
  @mayor
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def name
  @name
end

#short_urlObject

Returns the value of attribute short_url.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def short_url
  @short_url
end

#statsObject

Returns the value of attribute stats.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def stats
  @stats
end

#tagsObject

Returns the value of attribute tags.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def tags
  @tags
end

#updatesObject

Returns the value of attribute updates.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def updates
  @updates
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/mosaic/foursquare/venue.rb', line 6

def url
  @url
end

Class Method Details

.find(id, options = {}) ⇒ Object



9
10
11
12
# File 'lib/mosaic/foursquare/venue.rb', line 9

def find(id, options = {})
  response = query("/venues/#{id}", options)
  self.new response['response']['venue']
end

Instance Method Details

#herenow(options = {}) ⇒ Object



36
37
38
39
# File 'lib/mosaic/foursquare/venue.rb', line 36

def herenow(options = {})
  response = self.class.query("/venues/#{id}/herenow", options)
  response['response']['hereNow']['items'].collect { |item| Mosaic::Foursquare::Checkin.new(item) }
end

#photos(options = {}) ⇒ Object



41
42
43
44
# File 'lib/mosaic/foursquare/venue.rb', line 41

def photos(options = {})
  response = self.class.query("/venues/#{id}/photos", options)
  response['response']['photos']['items'].collect { |item| Mosaic::Foursquare::Photo.new(item) }
end