Sha256: c05e7c6d2eb9ccba3ed4e2dbd2c004e67eae310ae911fe78fa56b781322f5c4a

Contents?: true

Size: 534 Bytes

Versions: 3

Compression:

Stored size: 534 Bytes

Contents

require 'json'

module GoogleTZAPI
  class Response
    def initialize(json)
      @data = JSON.parse(json)
    end

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

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

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

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

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

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

    def data
      @data
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
google_tz-0.3.2 lib/google_tz/response.rb
google_tz-0.3.1 lib/google_tz/response.rb
google_tz-0.3.0 lib/google_tz/response.rb