Class: Databox::LineChart
- Inherits:
-
Integration
- Object
- Client
- Integration
- Databox::LineChart
- Defined in:
- lib/databox/integration.rb
Instance Attribute Summary
Attributes inherited from Integration
#date, #list, #name, #set_item
Attributes inherited from Client
Instance Method Summary collapse
Methods inherited from Integration
Methods inherited from Client
#handle, #initialize, #key, #logs, #push, #url, #validate
Constructor Details
This class inherits a constructor from Databox::Integration
Instance Method Details
#add(value, date = nil) ⇒ Object
109 110 111 112 |
# File 'lib/databox/integration.rb', line 109 def add value, date=nil date ||= @date @list.push [value, date] end |
#to_data ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/databox/integration.rb', line 114 def to_data @list.map do |i| out = {key: name, value: i.first} out.merge!({date: i[1]}) unless i[1].nil? out end end |