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



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

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



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

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

#search(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
# 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
    venues
  end
end


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

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