Class: GoogleDistanceMatrix::UrlBuilder
- Inherits:
-
Object
- Object
- GoogleDistanceMatrix::UrlBuilder
- Defined in:
- lib/google_distance_matrix/url_builder.rb,
lib/google_distance_matrix/url_builder/polyline_encoder_buffer.rb
Overview
Takes care of building the url for given matrix
Defined Under Namespace
Classes: PolylineEncoderBuffer
Constant Summary collapse
- BASE_URL =
'maps.googleapis.com/maps/api/distancematrix/json'
- DELIMITER =
CGI.escape('|')
- MAX_URL_SIZE =
2048
Instance Attribute Summary collapse
-
#matrix ⇒ Object
readonly
Returns the value of attribute matrix.
Instance Method Summary collapse
-
#filtered_url ⇒ Object
Returns the URL filtered as the configuration of the matrix dictates.
-
#initialize(matrix) ⇒ UrlBuilder
constructor
A new instance of UrlBuilder.
-
#sensitive_url ⇒ Object
Returns the URL we’ll call Google API with.
Constructor Details
#initialize(matrix) ⇒ UrlBuilder
Returns a new instance of UrlBuilder.
15 16 17 18 19 |
# File 'lib/google_distance_matrix/url_builder.rb', line 15 def initialize(matrix) @matrix = matrix raise InvalidMatrix, matrix if matrix.invalid? end |
Instance Attribute Details
#matrix ⇒ Object (readonly)
Returns the value of attribute matrix.
12 13 14 |
# File 'lib/google_distance_matrix/url_builder.rb', line 12 def matrix @matrix end |
Instance Method Details
#filtered_url ⇒ Object
Returns the URL filtered as the configuration of the matrix dictates
35 36 37 |
# File 'lib/google_distance_matrix/url_builder.rb', line 35 def filtered_url filter_url sensitive_url end |
#sensitive_url ⇒ Object
Returns the URL we’ll call Google API with
This URL contains key and signature and is therefor sensitive.
28 29 30 |
# File 'lib/google_distance_matrix/url_builder.rb', line 28 def sensitive_url @sensitive_url ||= build_url end |