Sha256: 98335637743d8047bbd1010a56fb494fb4e599da029d8c6fcc0672f64607e6f3
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
module WithingsSDK class Measure < Base # 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. # # @param attrs [Hash] # @return [WithingsSDK::Measure] def initialize(attrs = {}) super(attrs) @value = value / (10 ** unit.abs).to_f end # # Different measurement types # Weight = Class.new(self) do |cls| # Return weight measurement in kilograms (default unit) # # @return [Float] def in_kg @value end # Return weight measurement in pounds # # @return [Float] def in_lb (@value * 2.20462).round(3) end end Height = Class.new(self) Pulse = Class.new(self) FatFreeMass = Class.new(self) FatMassWeight = Class.new(self) FatRatio = Class.new(self) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
withings-sdk-0.2.1 | lib/withings-sdk/measures.rb |