Class: TrimbleMaps::Location
- Inherits:
-
Object
- Object
- TrimbleMaps::Location
- Includes:
- HTTParty
- Defined in:
- lib/trimble_maps/location.rb
Instance Method Summary collapse
Instance Method Details
#geocode(street:, city:, state:, postcode:, country:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/trimble_maps/location.rb', line 9 def geocode(street:, city:, state:, postcode:, country:) raise ArgumentError, 'Street is required' unless street.is_a?(String) query = { street: street, city: city, postcode: postcode, state: state, country: country } # GET /locations?street=whatever&city=&postcode= response = self.class.get('/locations', query: query, headers: headers) if response.success? && response.parsed_response.is_a?(Array) response.parsed_response.first else # handle error response # response.parsed_response['Error'] end end |