Class: Withings::Api::MeasureGetmeasResults

Inherits:
Object
  • Object
show all
Includes:
ResultsHelpers
Defined in:
lib/withings-api/results/measure_getmeas_results.rb

Overview

Class encapsulating the response to a call to measure/getmeas

See www.withings.com/en/api/wbsapiv2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ResultsHelpers

#coerce_hash

Constructor Details

#initialize(json_or_hash) ⇒ MeasureGetmeasResults

Returns a new instance of MeasureGetmeasResults.



60
61
62
63
64
65
66
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 60

def initialize(json_or_hash)
  hash = coerce_hash json_or_hash

  self.update_time_raw = hash["updatetime"] || raise(ArgumentError)
  self.more = (hash["more"] == true)
  self.measure_groups = hash["measuregrps"].map { |h| MeasurementGroup.new(h) }
end

Instance Attribute Details

#measure_groupsObject

Returns the value of attribute measure_groups.



57
58
59
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 57

def measure_groups
  @measure_groups
end

#moreObject Also known as: more?

Returns the value of attribute more.



57
58
59
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 57

def more
  @more
end

#update_time_rawObject

Returns the value of attribute update_time_raw.



57
58
59
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 57

def update_time_raw
  @update_time_raw
end

Instance Method Details

#update_timeObject



68
69
70
# File 'lib/withings-api/results/measure_getmeas_results.rb', line 68

def update_time
  Time.at(update_time_raw)
end