Method: Activite::Measure#initialize

Defined in:
lib/activite/measures.rb

#initialize(attrs = {}) ⇒ Activite::Measure

Create a new instance.

The Withings API returns all values as integers with a unit which represents the power of 10 the value should be multiplied by to get the real value. For example, value=20 and unit=-1 should be 2.0.

Parameters:

  • attrs (Hash) (defaults to: {})


12
13
14
15
# File 'lib/activite/measures.rb', line 12

def initialize(attrs = {})
  super(attrs)
  @value = value / (10 ** unit.abs).to_f
end