Class: Sidemash::Sdk::UTCDateTime
- Inherits:
-
Object
- Object
- Sidemash::Sdk::UTCDateTime
- Defined in:
- lib/sidemash/sdk/utc_date_time.rb
Instance Attribute Summary collapse
-
#iso8601 ⇒ Object
readonly
Returns the value of attribute iso8601.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(iso8601, timestamp) ⇒ UTCDateTime
constructor
A new instance of UTCDateTime.
- #to_hash ⇒ Object
- #to_json(*a) ⇒ Object
- #to_remote ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(iso8601, timestamp) ⇒ UTCDateTime
Returns a new instance of UTCDateTime.
25 26 27 28 29 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 25 def initialize(iso8601, ) @_type = 'UTCDateTime' @iso8601 = iso8601 @timestamp = end |
Instance Attribute Details
#iso8601 ⇒ Object (readonly)
Returns the value of attribute iso8601.
22 23 24 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 22 def iso8601 @iso8601 end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
23 24 25 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 23 def @timestamp end |
Class Method Details
._type ⇒ Object
31 32 33 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 31 def self._type 'UTCDateTime' end |
.from_hash(h) ⇒ Object
61 62 63 64 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 61 def self.from_hash(h) UTCDateTime.new(h['iso8601'], Timestamp.from_hash(h['timestamp'])) end |
.from_json(js) ⇒ Object
35 36 37 38 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 35 def self.from_json(js) h = JSON.parse(js) UTCDateTime.from_hash(h) end |
.from_remote(h) ⇒ Object
56 57 58 59 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 56 def self.from_remote(h) UTCDateTime.new(h['iso8601'], Timestamp.from_remote(h['timestamp'])) end |
Instance Method Details
#to_hash ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 48 def to_hash result = {} result[:_type] = @_type result[:iso8601] = @iso8601 result[:timestamp] = @timestamp.to_hash result end |
#to_json(*a) ⇒ Object
66 67 68 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 66 def to_json(*a) to_hash.to_json(*a) end |
#to_remote ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 40 def to_remote result = {} result[:_type] = @_type result[:iso8601] = @iso8601 result[:timestamp] = @timestamp.to_remote result end |
#to_s ⇒ Object
70 71 72 73 |
# File 'lib/sidemash/sdk/utc_date_time.rb', line 70 def to_s ('UTCDateTime(iso8601=' + @iso8601 + ', timestamp=' + @timestamp.to_s + ')') end |