Class: GoogleLocal::Search
- Inherits:
-
Object
- Object
- GoogleLocal::Search
- Includes:
- HTTParty
- Defined in:
- lib/google_local/search.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#center_location ⇒ Object
Returns the value of attribute center_location.
-
#latlng ⇒ Object
Returns the value of attribute latlng.
Instance Method Summary collapse
- #find(query, options = {}) ⇒ Object
-
#initialize(center_location, api_key = nil) ⇒ Search
constructor
A new instance of Search.
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_key ⇒ Object
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_location ⇒ Object
Returns the value of attribute center_location.
8 9 10 |
# File 'lib/google_local/search.rb', line 8 def center_location @center_location end |
#latlng ⇒ Object
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,={}) .merge!(:q => query, :sll => @latlng) fetch_locations(self.class.get("/local", :query => )) end |