Sha256: d40e048ab929f4d18880c8867c31b47f3c7416b197b5f180b5279cd40d4a20c8

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

module Parkwhiz

  SEARCH_PATH = "/search/"

  # Search
  #
  # Returns:
  # Array of ParkWhiz::Location
  #
  # Endpoint: http://www.parkwhiz.com/developers/search/
  #
  def self.search(search_parameters)
    response = connection.get do |request|
      request.url SEARCH_PATH
      request.params['key'] = api_key
      request.params.merge!(search_parameters)
    end

    raise SearchError.new(response.body['error']) if response.body['error']

    response.body['parking_listings'].collect{|parking_listing_json| Location.new(parking_listing_json)}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parkwhiz-0.1.0 lib/parkwhiz/search.rb