Sha256: c839a3f256ab74c70047564695c33a133a40d132caf99be9ecb2de9ba0a46b2d
Contents?: true
Size: 1.73 KB
Versions: 3
Compression:
Stored size: 1.73 KB
Contents
# encoding: utf-8 module Validic module Sleep ## # Get Sleep Activities base on `access_token` # Default data fetched is from yesterday # # @params :organization_id - for organization specific # @params :user_id - for user specific # # @params :start_date - optional # @params :end_date - optional # @params :access_token - override for default access_token # @params :source - optional - data per source (e.g 'fitbit') # @params :expanded - optional - will show the raw data # # @return [Hashie::Mash] with list of Sleep def get_sleep(params={}) params = extract_params(params) get_endpoint(:sleep, params) end alias :get_sleeps :get_sleep ## # Create Sleep base on `access_token` and `authentication_token` # # @params :access_token - *required if not specified on your initializer / organization access_token # @params :authentication_token - *required / authentication_token of a specific user # # @params :total_sleep # @params :awake # @params :deep # @params :light # @params :rem # @params :times_woken # @params :timestamp # @params :source # # @return success def create_sleep(options={}) options = { access_token: options[:access_token], sleep: { total_sleep: options[:total_sleep], awake: options[:awake], deep: options[:deep], light: options[:light], rem: options[:rem], times_woken: options[:times_woken], timestamp: options[:timestamp], source: options[:source] } } response = post("/#{Validic.api_version}/sleep.json", options) response if response end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
validic-0.3.3 | lib/validic/sleep.rb |
validic-0.3.2 | lib/validic/sleep.rb |
validic-0.3.1 | lib/validic/sleep.rb |