Class: GoogleLocal::Search

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/google_local/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(center_location, api_key = nil) ⇒ Search

Returns a new instance of Search.



10
11
12
13
# File 'lib/google_local/search.rb', line 10

def initialize(center_location, api_key=nil)
  @api_key = api_key
  @latlng = GoogleLocal::Geocode.find_latlng(center_location)
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



8
9
10
# File 'lib/google_local/search.rb', line 8

def api_key
  @api_key
end

#center_locationObject

Returns the value of attribute center_location.



8
9
10
# File 'lib/google_local/search.rb', line 8

def center_location
  @center_location
end

#latlngObject

Returns the value of attribute latlng.



8
9
10
# File 'lib/google_local/search.rb', line 8

def latlng
  @latlng
end

Instance Method Details

#find(query, options = {}) ⇒ Object



15
16
17
18
# File 'lib/google_local/search.rb', line 15

def find(query,options={})
  options.merge!(:q => query, :sll => @latlng)
  fetch_locations(self.class.get("/local", :query => options))
end