Sha256: 2ac44819d0554cee40a0a0afa001933e0c653c2dd1ef2686cb70389a4bf9ae16

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 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.kind_of?(Hash) && response.body['error']

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parkwhiz-0.3.0 lib/parkwhiz/search.rb
parkwhiz-0.2.0 lib/parkwhiz/search.rb