Class: UnivapayClientSdk::BearerAuthCredentials
- Inherits:
-
Object
- Object
- UnivapayClientSdk::BearerAuthCredentials
- Defined in:
- lib/univapay_client_sdk/http/auth/oauth_2.rb
Overview
Data class for BearerAuthCredentials.
Instance Attribute Summary collapse
-
#jwt_token ⇒ Object
readonly
Returns the value of attribute jwt_token.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(secret_key: nil, jwt_token: nil) ⇒ Object
-
#initialize(secret_key:, jwt_token:) ⇒ BearerAuthCredentials
constructor
A new instance of BearerAuthCredentials.
Constructor Details
#initialize(secret_key:, jwt_token:) ⇒ BearerAuthCredentials
Returns a new instance of BearerAuthCredentials.
35 36 37 38 39 40 41 |
# File 'lib/univapay_client_sdk/http/auth/oauth_2.rb', line 35 def initialize(secret_key:, jwt_token:) raise ArgumentError, 'secret_key cannot be nil' if secret_key.nil? raise ArgumentError, 'jwt_token cannot be nil' if jwt_token.nil? @secret_key = secret_key @jwt_token = jwt_token end |
Instance Attribute Details
#jwt_token ⇒ Object (readonly)
Returns the value of attribute jwt_token.
33 34 35 |
# File 'lib/univapay_client_sdk/http/auth/oauth_2.rb', line 33 def jwt_token @jwt_token end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
33 34 35 |
# File 'lib/univapay_client_sdk/http/auth/oauth_2.rb', line 33 def secret_key @secret_key end |
Class Method Details
.from_env ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/univapay_client_sdk/http/auth/oauth_2.rb', line 43 def self.from_env secret_key = ENV['SECRET_KEY'] jwt_token = ENV['JWT_TOKEN'] return nil if secret_key.nil? || jwt_token.nil? new(secret_key: secret_key, jwt_token: jwt_token) end |
Instance Method Details
#clone_with(secret_key: nil, jwt_token: nil) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/univapay_client_sdk/http/auth/oauth_2.rb', line 51 def clone_with(secret_key: nil, jwt_token: nil) secret_key ||= self.secret_key jwt_token ||= self.jwt_token BearerAuthCredentials.new(secret_key: secret_key, jwt_token: jwt_token) end |