Exception: GoogleDistanceMatrix::ClientError

Inherits:
Error
  • Object
show all
Defined in:
lib/google_distance_matrix/errors.rb

Overview

Public: Got an error where the client seems to be doing something wrong

These errors comes from http 4xx errors, or API errors like MAX_ELEMENTS_EXCEEDED etc. See developers.google.com/maps/documentation/distancematrix/#StatusCodes for info.

Direct Known Subclasses

MatrixUrlTooLong

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, status_read_from_api_response = nil) ⇒ ClientError

Returns a new instance of ClientError.



66
67
68
69
# File 'lib/google_distance_matrix/errors.rb', line 66

def initialize(response, status_read_from_api_response = nil)
  @response = response
  @status_read_from_api_response = status_read_from_api_response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



64
65
66
# File 'lib/google_distance_matrix/errors.rb', line 64

def response
  @response
end

#status_read_from_api_responseObject (readonly)

Returns the value of attribute status_read_from_api_response.



64
65
66
# File 'lib/google_distance_matrix/errors.rb', line 64

def status_read_from_api_response
  @status_read_from_api_response
end

Instance Method Details

#to_sObject



71
72
73
74
# File 'lib/google_distance_matrix/errors.rb', line 71

def to_s
  "GoogleDistanceMatrix::ClientError - \
    #{[response, status_read_from_api_response].compact.join('. ')}."
end