Sha256: 3fa9f0a296185ba3fe4d8a49a0438990607293b0e2ec7d278e3d7ebbdb5a8f89

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module FitbitAPI
  class Client
    def oxygen_saturation_summary(opts={})
      date       = opts[:date] || Date.today
      start_date = opts[:start_date]
      end_date   = opts[:end_date]

      if start_date && !end_date
        end_date = Date.today
      end

      unless date || start_date
        raise FitbitAPI::InvalidArgumentError, 'A date or start_date and end_date are required.'
      end

      if start_date
        get("user/#{user_id}/spo2/date/#{format_date(start_date)}/#{format_date(end_date)}.json")
      else
        get("user/#{user_id}/spo2/date/#{format_date(date)}.json")
      end
    end

    def oxygen_saturation_intraday(opts={})
      date       = opts[:date] || Date.today
      start_date = opts[:start_date]
      end_date   = opts[:end_date]

      if start_date && !end_date
        end_date = Date.today
      end

      unless date || start_date
        raise FitbitAPI::InvalidArgumentError, 'A date or start_date and end_date are required.'
      end

      if start_date
        get("user/#{user_id}/spo2/date/#{format_date(start_date)}/#{format_date(end_date)}/all.json")
      else
        get("user/#{user_id}/spo2/date/#{format_date(date)}/all.json")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fitbit_api-0.14.0 lib/fitbit_api/oxygen_saturation.rb