class PolarAccesslinkApiGem::SleepApi
Attributes
Public Class Methods
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
List nights List sleep data of user for the last 28 days. @param [Hash] opts the optional parameters @return [Nights]
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 26 def list_nights(opts = {}) data, _status_code, _headers = list_nights_with_http_info(opts) data end
List nights List sleep data of user for the last 28 days. @param [Hash] opts the optional parameters @return [Array<(Nights
, Integer, Hash)>] Nights
data, response status code and response headers
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 35 def list_nights_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SleepApi.list_nights ...' end # resource path local_var_path = '/v3/users/sleep' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Nights' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2'] new_options = opts.merge( :operation => :"SleepApi.list_nights", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SleepApi#list_nights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get available sleep times Get the dates with sleep start and end times, where user has sleep data available in the last 28 days. @param [Hash] opts the optional parameters @return [AvailableSleeps]
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 83 def v3_users_sleep_available_get(opts = {}) data, _status_code, _headers = v3_users_sleep_available_get_with_http_info(opts) data end
Get available sleep times Get the dates with sleep start and end times, where user has sleep data available in the last 28 days. @param [Hash] opts the optional parameters @return [Array<(AvailableSleeps
, Integer, Hash)>] AvailableSleeps
data, response status code and response headers
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 92 def v3_users_sleep_available_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SleepApi.v3_users_sleep_available_get ...' end # resource path local_var_path = '/v3/users/sleep/available' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AvailableSleeps' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2'] new_options = opts.merge( :operation => :"SleepApi.v3_users_sleep_available_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SleepApi#v3_users_sleep_available_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Sleep
Get Users sleep data for given date. @param date [String] Date of sleep as ISO-8601 date string, example: "2020-01-01" @param [Hash] opts the optional parameters @return [Sleep]
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 141 def v3_users_sleep_date_get(date, opts = {}) data, _status_code, _headers = v3_users_sleep_date_get_with_http_info(date, opts) data end
Get Sleep
Get Users sleep data for given date. @param date [String] Date of sleep as ISO-8601 date string, example: "2020-01-01" @param [Hash] opts the optional parameters @return [Array<(Sleep
, Integer, Hash)>] Sleep
data, response status code and response headers
# File lib/polar-accesslink-api-gem/api/sleep_api.rb, line 151 def v3_users_sleep_date_get_with_http_info(date, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SleepApi.v3_users_sleep_date_get ...' end # verify the required parameter 'date' is set if @api_client.config.client_side_validation && date.nil? fail ArgumentError, "Missing the required parameter 'date' when calling SleepApi.v3_users_sleep_date_get" end # resource path local_var_path = '/v3/users/sleep/{date}'.sub('{' + 'date' + '}', CGI.escape(date.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Sleep' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2'] new_options = opts.merge( :operation => :"SleepApi.v3_users_sleep_date_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SleepApi#v3_users_sleep_date_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end