Class: FeatureFlagClient::Session
- Inherits:
-
Object
- Object
- FeatureFlagClient::Session
- Defined in:
- lib/feature_flag_client/session.rb
Instance Attribute Summary collapse
-
#auth_service_url ⇒ Object
Returns the value of attribute auth_service_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #access_token ⇒ Object
-
#initialize(client_id:, client_secret:) {|_self| ... } ⇒ Session
constructor
A new instance of Session.
- #refresh_token ⇒ Object
Constructor Details
#initialize(client_id:, client_secret:) {|_self| ... } ⇒ Session
Returns a new instance of Session.
14 15 16 17 18 19 20 21 |
# File 'lib/feature_flag_client/session.rb', line 14 def initialize(client_id:, client_secret:) @client_id = client_id @client_secret = client_secret @logger = Logger.new(STDOUT) @logger.level = Logger::WARN yield(self) if block_given? end |
Instance Attribute Details
#auth_service_url ⇒ Object
Returns the value of attribute auth_service_url.
11 12 13 |
# File 'lib/feature_flag_client/session.rb', line 11 def auth_service_url @auth_service_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
11 12 13 |
# File 'lib/feature_flag_client/session.rb', line 11 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
11 12 13 |
# File 'lib/feature_flag_client/session.rb', line 11 def client_secret @client_secret end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/feature_flag_client/session.rb', line 12 def logger @logger end |
Instance Method Details
#access_token ⇒ Object
23 24 25 26 27 |
# File 'lib/feature_flag_client/session.rb', line 23 def access_token @token ||= request_access_token @token = request_access_token(refresh: true) if token_expired? @token end |
#refresh_token ⇒ Object
29 30 31 32 |
# File 'lib/feature_flag_client/session.rb', line 29 def refresh_token access_token if @parsed_auth_response.nil? @parsed_auth_response['refresh_token'] end |