Class: LogaltyCertificateIssuanceApiCerty::BearerAuthCredentials
- Inherits:
-
Object
- Object
- LogaltyCertificateIssuanceApiCerty::BearerAuthCredentials
- Defined in:
- lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb
Overview
Data class for BearerAuthCredentials.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(access_token: nil) ⇒ Object
-
#initialize(access_token:) ⇒ BearerAuthCredentials
constructor
A new instance of BearerAuthCredentials.
Constructor Details
#initialize(access_token:) ⇒ BearerAuthCredentials
Returns a new instance of BearerAuthCredentials.
31 32 33 34 35 |
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 31 def initialize(access_token:) raise ArgumentError, 'access_token cannot be nil' if access_token.nil? @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
29 30 31 |
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 29 def access_token @access_token end |
Class Method Details
.from_env ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 37 def self.from_env access_token = ENV['BEARER_AUTH_ACCESS_TOKEN'] all_nil = [ access_token ].all?(&:nil?) return nil if all_nil new(access_token: access_token) end |
Instance Method Details
#clone_with(access_token: nil) ⇒ Object
47 48 49 50 51 |
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 47 def clone_with(access_token: nil) access_token ||= self.access_token BearerAuthCredentials.new(access_token: access_token) end |