Class: Foursquare::VenueProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(foursquare) ⇒ VenueProxy

Returns a new instance of VenueProxy.



3
4
5
# File 'lib/foursquare/venue_proxy.rb', line 3

def initialize(foursquare)
  @foursquare = foursquare
end

Instance Method Details

#favorites(options = {}) ⇒ Object



25
26
27
# File 'lib/foursquare/venue_proxy.rb', line 25

def favorites(options={})
  search_group("favorites", options)
end

#find(id) ⇒ Object



7
8
9
# File 'lib/foursquare/venue_proxy.rb', line 7

def find(id)
  Foursquare::Venue.new(@foursquare, @foursquare.get("venues/#{id}")["venue"])
end

#nearby(options = {}) ⇒ Object



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

def nearby(options={})
  search_group("nearby", options)
end

#search(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
# File 'lib/foursquare/venue_proxy.rb', line 11

def search(options={})
  raise ArgumentError, "You must include :ll" unless options[:ll]
  response = @foursquare.get('venues/search', options)["groups"].inject({}) do |venues, group|
    venues[group["type"]] ||= []
    venues[group["type"]] << group["items"].map do |json|
      Foursquare::Venue.new(@foursquare, json)
    end
  end
end


21
22
23
# File 'lib/foursquare/venue_proxy.rb', line 21

def trending(options={})
  search_group("trending", options)
end