Sha256: bcd7e51ac4dd4943a1b4aff9f1f1c3edf0604441004bd4be746b4867efd8bff4
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true require 'oura/utils/api' module Oura module Apis # Readiness tells how ready you are for the day. # example data # { # "readiness": { # "summary_date": "2016-09-03", # "period_id": 0, # "score": 62, # "score_previous_night": 5, # "score_sleep_balance": 75, # "score_previous_day": 61, # "score_activity_balance": 77, # "score_resting_hr": 98, # "score_recovery_index": 45, # "score_temperature": 86 # } # } module Readiness include ::Oura::Utils::Api REQUEST_PATH = '/v1/readiness' # @param [Date] start_date # @param [Date] end_date # @example response body # { # "readiness": [{"summary_date": "2016-10-11", ...}, {"summary_date": "2016-10-12", ...}, ...] # } # @return [Oura::Model::Readiness] def readiness(start_date:, end_date: Time.current.to_date) sdate, edate = [start_date, end_date].map { |date| transform_date(date) } response_body = get(REQUEST_PATH, params: { start: sdate, end: edate }).body symbolized_json = JSON.parse(response_body).deep_symbolize_keys ::Oura::Model::Readiness.new(symbolized_json) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
oura-0.1.8 | lib/oura/apis/readiness.rb |
oura-0.1.7 | lib/oura/apis/readiness.rb |
oura-0.1.6 | lib/oura/apis/readiness.rb |
oura-0.1.5 | lib/oura/apis/readiness.rb |