Class: TestPack1::TimeZoneConfiguration

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/test_pack_1/models/time_zone_configuration.rb

Overview

your system-configured time zone configuration.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(title = nil, utc_offset = nil, utc_offset_dst = nil, dst_timestamp_start = nil, dst_timestamp_end = nil) ⇒ TimeZoneConfiguration

Returns a new instance of TimeZoneConfiguration.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 43

def initialize(title = nil,
               utc_offset = nil,
               utc_offset_dst = nil,
               dst_timestamp_start = nil,
               dst_timestamp_end = nil)
  @title = title
  @utc_offset = utc_offset
  @utc_offset_dst = utc_offset_dst
  @dst_timestamp_start = dst_timestamp_start
  @dst_timestamp_end = dst_timestamp_end
end

Instance Attribute Details

#dst_timestamp_endDateTime

The end of daylight savings time in the time zone. This timestamp is given in the UTC time zone.

Returns:

  • (DateTime)


30
31
32
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 30

def dst_timestamp_end
  @dst_timestamp_end
end

#dst_timestamp_startDateTime

The start of daylight savings time in the time zone. This timestamp is given in the UTC time zone.

Returns:

  • (DateTime)


25
26
27
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 25

def dst_timestamp_start
  @dst_timestamp_start
end

#titleString

The title of the time zone.

Returns:



12
13
14
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 12

def title
  @title
end

#utc_offsetFloat

The UTC offset for the time zone.

Returns:

  • (Float)


16
17
18
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 16

def utc_offset
  @utc_offset
end

#utc_offset_dstFloat

The UTC offset for the time zone during daylight savings time.

Returns:

  • (Float)


20
21
22
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 20

def utc_offset_dst
  @utc_offset_dst
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  title = hash['title']
  utc_offset = hash['utcOffset']
  utc_offset_dst = hash['utcOffsetDst']
  dst_timestamp_start = APIHelper.rfc3339(hash['dstTimestampStart']) if
    hash['dstTimestampStart']
  dst_timestamp_end = APIHelper.rfc3339(hash['dstTimestampEnd']) if
    hash['dstTimestampEnd']

  # Create object from extracted values.

  TimeZoneConfiguration.new(title,
                            utc_offset,
                            utc_offset_dst,
                            dst_timestamp_start,
                            dst_timestamp_end)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/test_pack_1/models/time_zone_configuration.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['title'] = 'title'
  @_hash['utc_offset'] = 'utcOffset'
  @_hash['utc_offset_dst'] = 'utcOffsetDst'
  @_hash['dst_timestamp_start'] = 'dstTimestampStart'
  @_hash['dst_timestamp_end'] = 'dstTimestampEnd'
  @_hash
end