Class: Withings::Api::Measurement
- Inherits:
-
Object
- Object
- Withings::Api::Measurement
- Includes:
- ResultsHelpers
- Defined in:
- lib/withings-api/results/measure_getmeas_results.rb
Overview
Class encapsulating a Measurement
Instance Attribute Summary collapse
-
#measurement_type ⇒ Object
Returns the value of attribute measurement_type.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value_raw ⇒ Object
Returns the value of attribute value_raw.
Instance Method Summary collapse
-
#initialize(json_or_hash) ⇒ Measurement
constructor
A new instance of Measurement.
- #value ⇒ Object
Methods included from ResultsHelpers
Constructor Details
#initialize(json_or_hash) ⇒ Measurement
Returns a new instance of Measurement.
12 13 14 15 16 17 18 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 12 def initialize(json_or_hash) hash = coerce_hash json_or_hash self.measurement_type = MeasurementType.lookup(hash["type"]) self.value_raw = hash["value"] self.unit = hash["unit"] end |
Instance Attribute Details
#measurement_type ⇒ Object
Returns the value of attribute measurement_type.
10 11 12 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 10 def measurement_type @measurement_type end |
#unit ⇒ Object
Returns the value of attribute unit.
10 11 12 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 10 def unit @unit end |
#value_raw ⇒ Object
Returns the value of attribute value_raw.
10 11 12 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 10 def value_raw @value_raw end |
Instance Method Details
#value ⇒ Object
20 21 22 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 20 def value value_raw * 10**unit end |