Class: FeatureFlagClient::Session
- Inherits:
-
Object
- Object
- FeatureFlagClient::Session
- Defined in:
- lib/feature_flag_client/session.rb
Overview
Takes care of getting access_token necessary to call features service
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.
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.
10 11 12 13 14 |
# File 'lib/feature_flag_client/session.rb', line 10 def initialize(client_id:, client_secret:) @client_id = client_id @client_secret = client_secret yield(self) if block_given? end |
Instance Attribute Details
#auth_service_url ⇒ Object
Returns the value of attribute auth_service_url.
8 9 10 |
# File 'lib/feature_flag_client/session.rb', line 8 def auth_service_url @auth_service_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
8 9 10 |
# File 'lib/feature_flag_client/session.rb', line 8 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
8 9 10 |
# File 'lib/feature_flag_client/session.rb', line 8 def client_secret @client_secret end |
Instance Method Details
#access_token ⇒ Object
16 17 18 19 20 |
# File 'lib/feature_flag_client/session.rb', line 16 def access_token @token ||= request_access_token @token = request_access_token(refresh: true) if token_expired? @token end |
#refresh_token ⇒ Object
22 23 24 25 |
# File 'lib/feature_flag_client/session.rb', line 22 def refresh_token access_token if @parsed_auth_response.nil? @parsed_auth_response['refresh_token'] end |