Module: Withings::Api::ResultsHelpers

Included in:
ApiResponse, MeasureGetmeasResults, Measurement, MeasurementGroup
Defined in:
lib/withings-api/utils.rb

Instance Method Summary collapse

Instance Method Details

#coerce_hash(o) ⇒ Object

Raises:

  • (JSON::ParserError)


4
5
6
7
8
9
10
11
12
# File 'lib/withings-api/utils.rb', line 4

def coerce_hash(o)
  if o.instance_of? Hash
    o
  elsif o.instance_of? String
    JSON::parse(o)
  else
    nil
  end
end