Class: Geoiq::Search
- Inherits:
-
Object
- Object
- Geoiq::Search
- Defined in:
- lib/geoiq/search.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Returns the value of attribute auth.
Instance Method Summary collapse
-
#initialize(auth, options = {}) ⇒ Search
constructor
A new instance of Search.
-
#search(query, options = {}, format = 'json') ⇒ Object
format json/atom/kml.
Constructor Details
#initialize(auth, options = {}) ⇒ Search
Returns a new instance of Search.
4 5 6 |
# File 'lib/geoiq/search.rb', line 4 def initialize(auth, ={}) @auth = auth end |
Instance Attribute Details
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
3 4 5 |
# File 'lib/geoiq/search.rb', line 3 def auth @auth end |
Instance Method Details
#search(query, options = {}, format = 'json') ⇒ Object
format json/atom/kml
9 10 11 12 13 14 15 16 17 |
# File 'lib/geoiq/search.rb', line 9 def search(query, ={}, format='json') params = {:query => query}.merge() response = request(:get, "/search.#{format}", {:query => params }) if format == 'json' return results = JSON.parse(response.body) else return response.body end end |