Class: Foursquare::Merchant::Venue

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

Constant Summary

Constants included from Requests

Requests::API, Requests::OAUTH

Instance Attribute Summary

Attributes inherited from Model

#consumer

Instance Method Summary collapse

Methods inherited from Model

#initialize

Methods included from Requests

#get, #post

Constructor Details

This class inherits a constructor from Foursquare::Merchant::Model

Instance Method Details

#edit(params) ⇒ Object



42
43
44
45
46
47
# File 'lib/foursquare/venue.rb', line 42

def edit(params)
  response = self.post("/venues/#{id}/edit", params)['venue']
  temp_venue = self.fetch
  temp_venue.keys.each { |k| self.send("#{k}=", temp_venue.send("#{k}")) }
  self
end

#fetchObject



28
29
30
31
# File 'lib/foursquare/venue.rb', line 28

def fetch
  response = self.get("/venues/#{id}", {})['venue']
  self.class.new(response, @consumer)
end

#stats(start_at = nil, end_at = nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/foursquare/venue.rb', line 33

def stats(start_at=nil, end_at=nil)
  params = {}
  params[:start_at] = start_at if start_at
  params[:end_at]   = end_at if end_at

  response = self.get("/venues/#{id}/stats", params)['stats']
  VenueStats.new(response)
end