Class: Withings::Api::MeasurementGroup
- Inherits:
-
Object
- Object
- Withings::Api::MeasurementGroup
- Includes:
- ResultsHelpers
- Defined in:
- lib/withings-api/results/measure_getmeas_results.rb
Overview
Class encapsulating a MeasurementGroup
Instance Attribute Summary collapse
-
#attribution ⇒ Object
readonly
Returns the value of attribute attribution.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#date_raw ⇒ Object
readonly
Returns the value of attribute date_raw.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#measurements ⇒ Object
readonly
Returns the value of attribute measurements.
Instance Method Summary collapse
- #date ⇒ Object
-
#initialize(json_string_or_hash) ⇒ MeasurementGroup
constructor
A new instance of MeasurementGroup.
Methods included from ResultsHelpers
Constructor Details
#initialize(json_string_or_hash) ⇒ MeasurementGroup
Returns a new instance of MeasurementGroup.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 34 def initialize(json_string_or_hash) hash = coerce_hash json_string_or_hash #"grpid"=>2909, "attrib"=>0, "date"=>1222930968, "category"=>1, "measures @id = hash["grpid"] @date_raw = hash["date"] @attribution = AttributionType.lookup(hash["attrib"]) @category = CategoryType.lookup(hash["category"]) @measurements = hash["measures"].map { |h| Measurement.new(h) } end |
Instance Attribute Details
#attribution ⇒ Object (readonly)
Returns the value of attribute attribution.
32 33 34 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 32 def attribution @attribution end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
32 33 34 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 32 def category @category end |
#date_raw ⇒ Object (readonly)
Returns the value of attribute date_raw.
32 33 34 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 32 def date_raw @date_raw end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
32 33 34 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 32 def id @id end |
#measurements ⇒ Object (readonly)
Returns the value of attribute measurements.
32 33 34 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 32 def measurements @measurements end |
Instance Method Details
#date ⇒ Object
45 46 47 |
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 45 def date Time.at(date_raw) end |