Class: Sidemash::Sdk::Timestamp

Inherits:
Object
  • Object
show all
Defined in:
lib/sidemash/sdk/timestamp.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seconds) ⇒ Timestamp

Returns a new instance of Timestamp.



24
25
26
27
# File 'lib/sidemash/sdk/timestamp.rb', line 24

def initialize(seconds)
  @_type = 'Timestamp'
  @seconds = seconds
end

Instance Attribute Details

#secondsObject (readonly)

Returns the value of attribute seconds.



22
23
24
# File 'lib/sidemash/sdk/timestamp.rb', line 22

def seconds
  @seconds
end

Class Method Details

._typeObject



29
30
31
# File 'lib/sidemash/sdk/timestamp.rb', line 29

def self._type
  'Timestamp'
end

.from_hash(h) ⇒ Object



56
57
58
# File 'lib/sidemash/sdk/timestamp.rb', line 56

def self.from_hash(h)
  Timestamp.new(h['seconds'])
end

.from_json(js) ⇒ Object



33
34
35
36
# File 'lib/sidemash/sdk/timestamp.rb', line 33

def self.from_json(js)
  h = JSON.parse(js)
  Timestamp.from_hash(h)
end

.from_remote(h) ⇒ Object



52
53
54
# File 'lib/sidemash/sdk/timestamp.rb', line 52

def self.from_remote(h)
  Timestamp.new(h['seconds'])
end

Instance Method Details

#to_hashObject



45
46
47
48
49
50
# File 'lib/sidemash/sdk/timestamp.rb', line 45

def to_hash
  result = {}
  result[:_type] = @_type
  result[:seconds] = @seconds
  result
end

#to_json(*a) ⇒ Object



60
61
62
# File 'lib/sidemash/sdk/timestamp.rb', line 60

def to_json(*a)
  to_hash.to_json(*a)
end

#to_remoteObject



38
39
40
41
42
43
# File 'lib/sidemash/sdk/timestamp.rb', line 38

def to_remote
  result = {}
  result[:_type] = @_type
  result[:seconds] = @seconds
  result
end

#to_sObject



64
65
66
# File 'lib/sidemash/sdk/timestamp.rb', line 64

def to_s
  'Timestamp(seconds=' + @seconds + ')'
end