Class: GoogleDistanceMatrix::Configuration
- Inherits:
-
Object
- Object
- GoogleDistanceMatrix::Configuration
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/google_distance_matrix/configuration.rb
Overview
Public: Configuration of matrix and it’s request.
Holds configuration used when building API URL.
See developers.google.com/maps/documentation/distancematrix/#RequestParameters for documentation on each configuration.
Constant Summary collapse
- ATTRIBUTES =
%w[sensor mode avoid units]
- API_DEFAULTS =
{ mode: "driving", units: "metric" }.with_indifferent_access
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#google_business_api_client_id ⇒ Object
Returns the value of attribute google_business_api_client_id.
-
#google_business_api_private_key ⇒ Object
Returns the value of attribute google_business_api_private_key.
Instance Method Summary collapse
- #[]=(attr_name, value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_param ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 39 40 |
# File 'lib/google_distance_matrix/configuration.rb', line 32 def initialize self.sensor = false self.protocol = "http" self.lat_lng_scale = 5 API_DEFAULTS.each_pair do |attr_name, value| self[attr_name] = value end end |
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
21 22 23 |
# File 'lib/google_distance_matrix/configuration.rb', line 21 def cache @cache end |
#google_business_api_client_id ⇒ Object
Returns the value of attribute google_business_api_client_id.
20 21 22 |
# File 'lib/google_distance_matrix/configuration.rb', line 20 def google_business_api_client_id @google_business_api_client_id end |
#google_business_api_private_key ⇒ Object
Returns the value of attribute google_business_api_private_key.
20 21 22 |
# File 'lib/google_distance_matrix/configuration.rb', line 20 def google_business_api_private_key @google_business_api_private_key end |
Instance Method Details
#[]=(attr_name, value) ⇒ Object
46 47 48 |
# File 'lib/google_distance_matrix/configuration.rb', line 46 def []=(attr_name, value) public_send "#{attr_name}=", value end |
#to_param ⇒ Object
42 43 44 |
# File 'lib/google_distance_matrix/configuration.rb', line 42 def to_param Hash[array_param] end |