Class: Geoiq::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/geoiq/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  @auth = auth
end

Instance Attribute Details

#authObject (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, options={}, format='json')
  params = {:query => query}.merge(options)
  response = request(:get, "/search.#{format}", {:query => params })
  if format == 'json'
    return results = JSON.parse(response.body)
  else
    return response.body
  end
end