Class: Einvoicing::Connect::FR::Pennylane::Credentials::OAuth
- Inherits:
-
Object
- Object
- Einvoicing::Connect::FR::Pennylane::Credentials::OAuth
- Defined in:
- lib/einvoicing/connect/fr/pennylane/credentials.rb
Overview
OAuth2 access + refresh token pair. Mutable so the Client can update tokens in place after a refresh, making the new values available to the caller for persistence.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(access_token:, refresh_token:, client_id:, client_secret:, expires_at: nil) ⇒ OAuth
constructor
A new instance of OAuth.
Constructor Details
#initialize(access_token:, refresh_token:, client_id:, client_secret:, expires_at: nil) ⇒ OAuth
Returns a new instance of OAuth.
58 59 60 61 62 63 64 65 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 58 def initialize(access_token:, refresh_token:, client_id:, client_secret:, expires_at: nil) @access_token = access_token @refresh_token = refresh_token @client_id = client_id @client_secret = client_secret @expires_at = expires_at end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
56 57 58 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 56 def access_token @access_token end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
55 56 57 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 55 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
55 56 57 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 55 def client_secret @client_secret end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
56 57 58 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 56 def expires_at @expires_at end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
56 57 58 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 56 def refresh_token @refresh_token end |
Instance Method Details
#expired? ⇒ Boolean
67 68 69 |
# File 'lib/einvoicing/connect/fr/pennylane/credentials.rb', line 67 def expired? expires_at.nil? || Time.now >= expires_at end |