Class: Tradier::Clock

Inherits:
Base
  • Object
show all
Defined in:
lib/tradier/clock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #attr_equal, attr_reader, #attrs, #attrs_equal, from_response, #initialize, #update

Constructor Details

This class inherits a constructor from Tradier::Base

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/tradier/clock.rb', line 6

def description
  @description
end

#next_changeObject (readonly)

Returns the value of attribute next_change.



6
7
8
# File 'lib/tradier/clock.rb', line 6

def next_change
  @next_change
end

#next_stateObject (readonly)

Returns the value of attribute next_state.



6
7
8
# File 'lib/tradier/clock.rb', line 6

def next_state
  @next_state
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/tradier/clock.rb', line 6

def state
  @state
end

Instance Method Details

#dateObject



8
9
10
11
12
# File 'lib/tradier/clock.rb', line 8

def date
  return unless @date || @attrs[:date]

  @date ||= Date.parse(@attrs[:date])
end

#timeObject



14
15
16
17
18
# File 'lib/tradier/clock.rb', line 14

def time
  return unless @time || @attrs[:timestamp]

  @time ||= Time.at(@attrs[:timestamp].to_i)
end