Class: Parkwhiz::Venue

Inherits:
Object
  • Object
show all
Defined in:
lib/parkwhiz/venue.rb

Constant Summary collapse

SEARCH_PATH =
"/venue/search/"

Class Method Summary collapse

Class Method Details

.search(search_parameters) ⇒ Object

Raises:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/parkwhiz/venue.rb', line 16

def self.search(search_parameters)
  response = Parkwhiz.connection.get do |request|
    request.url SEARCH_PATH
    request.params['key'] = Parkwhiz.api_key
    request.params.merge!(search_parameters)
  end

  raise SearchError.new(response.body['error']) if response.body.kind_of?(Hash) && response.body['error']

  response.body.collect{|venue_json| self.new(venue_json)}
end