Class: Oura::Client
- Inherits:
-
Object
- Object
- Oura::Client
- Defined in:
- lib/oura/client.rb
Overview
::Oura::Client is client class.
Constant Summary
Constants included from Apis::Readiness
Constants included from Apis::Activity
Constants included from Apis::SleepPeriod
Apis::SleepPeriod::REQUEST_PATH
Constants included from Apis::UserInformation
Apis::UserInformation::REQUEST_PATH
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#oauth_client ⇒ Object
readonly
Returns the value of attribute oauth_client.
Instance Method Summary collapse
Methods included from Apis::Readiness
Methods included from Apis::Activity
Methods included from Apis::SleepPeriod
Methods included from Apis::UserInformation
Constructor Details
#initialize(access_token: nil) ⇒ Object<Oura::Client>
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/oura/client.rb', line 21 def initialize(access_token: nil) @oauth_client = OAuth2::Client.new( ENV['OURA_CLIENT_ID'], ENV['OURA_CLIENT_SECRET'], ::Oura::Constants::OAUTH_OPTIONS ) @access_token = if ENV['DEVELOPMENT'] puts @oauth_client.auth_code.(redirect_uri: ::Oura::Constants::CALLBACK_URI) puts 'Please, input your secret' code = gets.chomp token(code) else raise if access_token.nil? OAuth2::AccessToken.new(@oauth_client, access_token) end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
17 18 19 |
# File 'lib/oura/client.rb', line 17 def access_token @access_token end |
#oauth_client ⇒ Object (readonly)
Returns the value of attribute oauth_client.
17 18 19 |
# File 'lib/oura/client.rb', line 17 def oauth_client @oauth_client end |