Class: GoogleTZAPI::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/google_tz/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/google_tz/response.rb', line 5

def initialize(json)
  @data = JSON.parse(json)
end

Instance Method Details

#dataObject



33
34
35
# File 'lib/google_tz/response.rb', line 33

def data
  @data
end

#dst_offsetObject



13
14
15
# File 'lib/google_tz/response.rb', line 13

def dst_offset
  @data.fetch('dstOffset', nil)
end

#raw_offsetObject



17
18
19
# File 'lib/google_tz/response.rb', line 17

def raw_offset
  @data.fetch('rawOffset', nil)
end

#statusObject



21
22
23
# File 'lib/google_tz/response.rb', line 21

def status
  @data.fetch('status')
end

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/google_tz/response.rb', line 9

def success?
  @data['status'].eql?('OK')
end

#timezone_idObject



25
26
27
# File 'lib/google_tz/response.rb', line 25

def timezone_id
  @data.fetch('timeZoneId', nil)
end

#timezone_nameObject



29
30
31
# File 'lib/google_tz/response.rb', line 29

def timezone_name
  @data.fetch('timeZoneName', nil)
end