Class: GoogleMapsService::Client
- Inherits:
-
Object
- Object
- GoogleMapsService::Client
- Includes:
- Directions, DistanceMatrix, Elevation, Geocoding, Roads, TimeZone
- Defined in:
- lib/google_maps_service/client.rb
Constant Summary collapse
- USER_AGENT =
"GoogleGeoApiClientRuby/#{GoogleMapsService::VERSION}"- DEFAULT_BASE_URL =
"https://maps.googleapis.com"- RETRIABLE_STATUSES =
[500, 503, 504]
Constants included from Roads
Instance Attribute Summary collapse
-
#client_id ⇒ String
readonly
Client id for using Maps API for Work services.
-
#client_secret ⇒ String
readonly
Client secret for using Maps API for Work services.
-
#key ⇒ String
readonly
Secret key for accessing Google Maps Web Service.
Instance Method Summary collapse
-
#client ⇒ Hurley::Client
Get the current HTTP client.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from TimeZone
Methods included from Roads
#snap_to_roads, #snapped_speed_limits, #speed_limits
Methods included from Geocoding
Methods included from Elevation
#elevation, #elevation_along_path
Methods included from DistanceMatrix
Methods included from Directions
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
31 32 33 34 35 |
# File 'lib/google_maps_service/client.rb', line 31 def initialize(={}) @key = [:key] || GoogleMapsService.key @client_id = [:client_id] || GoogleMapsService.client_id @client_secret = [:client_secret] || GoogleMapsService.client_secret end |
Instance Attribute Details
#client_id ⇒ String (readonly)
Client id for using Maps API for Work services.
25 26 27 |
# File 'lib/google_maps_service/client.rb', line 25 def client_id @client_id end |
#client_secret ⇒ String (readonly)
Client secret for using Maps API for Work services.
29 30 31 |
# File 'lib/google_maps_service/client.rb', line 29 def client_secret @client_secret end |
#key ⇒ String (readonly)
Secret key for accessing Google Maps Web Service. Can be obtained at developers.google.com/maps/documentation/geocoding/get-api-key#key
21 22 23 |
# File 'lib/google_maps_service/client.rb', line 21 def key @key end |
Instance Method Details
#client ⇒ Hurley::Client
Get the current HTTP client
39 40 41 |
# File 'lib/google_maps_service/client.rb', line 39 def client @client ||= new_client end |