Class: GoogleMaps::Services::Timezone
- Inherits:
-
Object
- Object
- GoogleMaps::Services::Timezone
- Defined in:
- lib/googlemaps/services/timezone.rb
Overview
Performs requests to the Google Maps Timezone API.
Instance Attribute Summary collapse
-
#client ⇒ Symbol
The HTTP client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Timezone
constructor
A new instance of Timezone.
-
#query(location:, timestamp: nil, language: nil) ⇒ Hash
Get time zone for a location on the earth, as well as that location’s time offset from UTC.
Constructor Details
#initialize(client) ⇒ Timezone
Returns a new instance of Timezone.
15 16 17 |
# File 'lib/googlemaps/services/timezone.rb', line 15 def initialize(client) self.client = client end |
Instance Attribute Details
#client ⇒ Symbol
Returns The HTTP client.
13 14 15 |
# File 'lib/googlemaps/services/timezone.rb', line 13 def client @client end |
Instance Method Details
#query(location:, timestamp: nil, language: nil) ⇒ Hash
Get time zone for a location on the earth, as well as that location’s time offset from UTC.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/googlemaps/services/timezone.rb', line 28 def query(location:, timestamp: nil, language: nil) params = { 'location' => Convert.to_latlng(location), 'timestamp' => Convert.unix_time( || Util.current_utctime) } if language params['language'] = language end self.client.request(url: "/maps/api/timezone/#{self.client.response_format}", params: params) end |