Class: GoogleDistanceMatrix::Client
- Inherits:
-
Object
- Object
- GoogleDistanceMatrix::Client
- Defined in:
- lib/google_distance_matrix/client.rb
Overview
HTTP client making request to Google’s API
Constant Summary collapse
- CLIENT_ERRORS =
%w[ INVALID_REQUEST MAX_ELEMENTS_EXCEEDED OVER_QUERY_LIMIT REQUEST_DENIED UNKNOWN_ERROR ].freeze
Instance Method Summary collapse
-
#get(url, instrumentation: {}, **_options) ⇒ Object
Make a GET request to given URL.
Instance Method Details
#get(url, instrumentation: {}, **_options) ⇒ Object
Make a GET request to given URL
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/google_distance_matrix/client.rb', line 25 def get(url, instrumentation: {}, **) uri = URI.parse url response = ActiveSupport::Notifications.instrument( 'client_request_matrix_data.google_distance_matrix', instrumentation ) do Net::HTTP.get_response uri end handle response, url rescue Timeout::Error => error raise ServerError, error end |