Class: Icalia::Artanis::ClientAuth
- Inherits:
-
Object
- Object
- Icalia::Artanis::ClientAuth
- Includes:
- ActiveModel::Model
- Defined in:
- lib/icalia/artanis/client_auth.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
10 11 12 |
# File 'lib/icalia/artanis/client_auth.rb', line 10 def access_token @access_token end |
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/icalia/artanis/client_auth.rb', line 10 def created_at @created_at end |
#token_type ⇒ Object
Returns the value of attribute token_type.
10 11 12 |
# File 'lib/icalia/artanis/client_auth.rb', line 10 def token_type @token_type end |
Class Method Details
.fetch ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/icalia/artanis/client_auth.rb', line 50 def self.fetch store.fetch 'my-artanis-client-token' do response = http.post do |req| req.url '/oauth/token' req.headers['Authorization'] = req.params['grant_type'] = 'client_credentials' end # Return a new instance of the Client Auth: new ActiveSupport::JSON.decode(response.body) end end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/icalia/artanis/client_auth.rb', line 17 def ==(other) other.is_a?(self.class) && other.access_token == access_token end |
#to_authorization_header ⇒ Object
25 26 27 |
# File 'lib/icalia/artanis/client_auth.rb', line 25 def "Bearer #{to_s}" end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/icalia/artanis/client_auth.rb', line 21 def to_s access_token end |