Class: AthenaHealth::AuthToken
- Inherits:
-
Object
- Object
- AthenaHealth::AuthToken
- Defined in:
- lib/athena_health/auth_token.rb
Instance Method Summary collapse
- #auth_header ⇒ Object
-
#initialize(client_id:, secret:, base_url:, api_version:, auth_token_hash: nil) ⇒ AuthToken
constructor
A new instance of AuthToken.
- #reset! ⇒ Object
- #serialized_token ⇒ Object
Constructor Details
#initialize(client_id:, secret:, base_url:, api_version:, auth_token_hash: nil) ⇒ AuthToken
Returns a new instance of AuthToken.
5 6 7 8 9 10 11 12 |
# File 'lib/athena_health/auth_token.rb', line 5 def initialize(client_id:, secret:, base_url:, api_version:, auth_token_hash: nil) @base_url = base_url @api_version = api_version @client_id = client_id @secret = secret reset! parse_auth_token_hash!(auth_token_hash) unless auth_token_hash.nil? end |
Instance Method Details
#auth_header ⇒ Object
14 15 16 |
# File 'lib/athena_health/auth_token.rb', line 14 def auth_header { 'Authorization' => "Bearer #{token}" } end |
#reset! ⇒ Object
18 19 20 21 |
# File 'lib/athena_health/auth_token.rb', line 18 def reset! @access_token = nil @expires_at = nil end |
#serialized_token ⇒ Object
23 24 25 26 27 28 |
# File 'lib/athena_health/auth_token.rb', line 23 def serialized_token { 'access_token' => token, 'expires_at' => @expires_at.to_i } end |