Class: Fabricio::Model::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/fabricio/models/point.rb

Overview

This model represents a data point with two fields - timestamp and value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Fabricio::Model::Point

Returns a data point with two fields - timestamp and value

Parameters:

  • attributes (Hash)


11
12
13
14
# File 'lib/fabricio/models/point.rb', line 11

def initialize(attributes)
  @date = DateTime.strptime(attributes.first.to_s,'%s')
  @value = attributes.last
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



5
6
7
# File 'lib/fabricio/models/point.rb', line 5

def date
  @date
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/fabricio/models/point.rb', line 5

def value
  @value
end