Class: GmapsTz::Client

Inherits:
Object
  • Object
show all
Includes:
TimeZone
Defined in:
lib/gmaps_tz/client.rb,
lib/gmaps_tz/client/time_zone.rb

Defined Under Namespace

Modules: TimeZone

Constant Summary collapse

FORMAT =
"/json"
HOST =
"maps.googleapis.com"
BASE_PATH =
"/maps/api"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TimeZone

#time_zone_in

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
# File 'lib/gmaps_tz/client.rb', line 14

def initialize(options = {})
  @key = options[:key]
  @basic_params = { sensor: false }
  @basic_params[:key] = options[:key] if options[:key]
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



12
13
14
# File 'lib/gmaps_tz/client.rb', line 12

def key
  @key
end

Instance Method Details

#get(path, query_params) ⇒ Object



20
21
22
23
24
# File 'lib/gmaps_tz/client.rb', line 20

def get(path, query_params)
  uri = generate_uri(path, query_params)
  response = Net::HTTP.get_response(uri)
  ResponseParser.new(uri, response).execute
end