Exception: GoogleDistanceMatrix::MatrixUrlTooLong

Inherits:
ClientError show all
Defined in:
lib/google_distance_matrix/errors.rb

Overview

Public: API URL was too long

See developers.google.com/maps/documentation/distancematrix/#Limits, which states: “Distance Matrix API URLs are restricted to 2048 characters, before URL encoding.” “As some Distance Matrix API service URLs may involve many locations, be aware of this limit when constructing your URLs.”

Instance Attribute Summary collapse

Attributes inherited from ClientError

#response, #status_read_from_api_response

Instance Method Summary collapse

Constructor Details

#initialize(url, max_url_size, response = nil) ⇒ MatrixUrlTooLong

Returns a new instance of MatrixUrlTooLong.



76
77
78
79
80
81
# File 'lib/google_distance_matrix/errors.rb', line 76

def initialize(url, max_url_size, response = nil)
  super response

  @url = url
  @max_url_size = max_url_size
end

Instance Attribute Details

#max_url_sizeObject (readonly)

Returns the value of attribute max_url_size.



74
75
76
# File 'lib/google_distance_matrix/errors.rb', line 74

def max_url_size
  @max_url_size
end

#urlObject (readonly)

Returns the value of attribute url.



74
75
76
# File 'lib/google_distance_matrix/errors.rb', line 74

def url
  @url
end

Instance Method Details

#to_sObject



83
84
85
# File 'lib/google_distance_matrix/errors.rb', line 83

def to_s
  "Matrix API URL max size is: #{max_url_size}. Built URL was: #{url.length}. URL: '#{url}'."
end