Class: Icasework::Token::Bearer
- Inherits:
-
Object
- Object
- Icasework::Token::Bearer
- Defined in:
- lib/icasework/token/bearer.rb
Overview
Generate access token for Bearer authorisation header
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Bearer
constructor
A new instance of Bearer.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Bearer
Returns a new instance of Bearer.
26 27 28 29 30 |
# File 'lib/icasework/token/bearer.rb', line 26 def initialize(data) @access_token = data.fetch(:access_token) @token_type = data.fetch(:token_type) @expires_in = data.fetch(:expires_in) end |
Class Method Details
.generate ⇒ Object
10 11 12 13 14 |
# File 'lib/icasework/token/bearer.rb', line 10 def generate new Icasework::Resource.token(payload).data rescue RequestError, ResponseError => e raise AuthenticationError, e. end |
Instance Method Details
#to_s ⇒ Object
32 33 34 |
# File 'lib/icasework/token/bearer.rb', line 32 def to_s @access_token end |