Class: StickyIoRestfulApiV2025731::BearerCredentials
- Inherits:
-
Object
- Object
- StickyIoRestfulApiV2025731::BearerCredentials
- Defined in:
- lib/sticky_io_restful_api_v2025731/http/auth/bearer.rb
Overview
Data class for BearerCredentials.
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:) ⇒ BearerCredentials
constructor
A new instance of BearerCredentials.
Constructor Details
#initialize(access_token:) ⇒ BearerCredentials
Returns a new instance of BearerCredentials.
31 32 33 34 35 |
# File 'lib/sticky_io_restful_api_v2025731/http/auth/bearer.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/sticky_io_restful_api_v2025731/http/auth/bearer.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/sticky_io_restful_api_v2025731/http/auth/bearer.rb', line 37 def self.from_env access_token = ENV['BEARER_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/sticky_io_restful_api_v2025731/http/auth/bearer.rb', line 47 def clone_with(access_token: nil) access_token ||= self.access_token BearerCredentials.new(access_token: access_token) end |