class GoogleDistanceMatrix::Configuration
Public: Configuration
of matrix and it's request.
Holds configuration used when building API URL.
See developers.google.com/maps/documentation/distance-matrix/intro for documentation on each configuration.
Constants
- API_DEFAULTS
- ATTRIBUTES
Attributes we'll include building URL for our matrix
Attributes
Callable object which transform given url to key used in cache @see ClientCache
When logging we filter sensitive parameters
Google credentials
Google credentials
Google credentials
lat_lng_scale
is used for each Place
when we include it's lat and lng values in the URL. Defaults to 5 decimals, but you can set it lower to save characters in the URL.
Speaking of saving characters. If you use_encoded_polylines
all Places
which has lat/lng will use encoded set of coordinates using the Encoded Polyline Algorithm. This is particularly useful if you have a large number of origin points, because the URL is significantly shorter when using an encoded polyline. See: developers.google.com/maps/documentation/distance-matrix/intro#RequestParameters
The protocol to use, either http or https
lat_lng_scale
is used for each Place
when we include it's lat and lng values in the URL. Defaults to 5 decimals, but you can set it lower to save characters in the URL.
Speaking of saving characters. If you use_encoded_polylines
all Places
which has lat/lng will use encoded set of coordinates using the Encoded Polyline Algorithm. This is particularly useful if you have a large number of origin points, because the URL is significantly shorter when using an encoded polyline. See: developers.google.com/maps/documentation/distance-matrix/intro#RequestParameters
Public Class Methods
# File lib/google_distance_matrix/configuration.rb, line 83 def initialize API_DEFAULTS.each_pair do |attr_name, value| self[attr_name] = begin value.dup rescue StandardError value end end end
Public Instance Methods
# File lib/google_distance_matrix/configuration.rb, line 97 def []=(attr_name, value) public_send "#{attr_name}=", value end
# File lib/google_distance_matrix/configuration.rb, line 93 def to_param Hash[array_param] end
Private Instance Methods
# File lib/google_distance_matrix/configuration.rb, line 103 def array_param out = ATTRIBUTES.map { |attr| [attr, public_send(attr)] }.reject do |attr_and_value| attr_and_value[1].nil? || param_same_as_api_default?(attr_and_value) end out << ['client', google_business_api_client_id] if google_business_api_client_id.present? out << ['key', google_api_key] if google_api_key.present? out end
# File lib/google_distance_matrix/configuration.rb, line 114 def param_same_as_api_default?(param) API_DEFAULTS[param[0]] == param[1] end