Class: ChangeHealthcare::Eligibility::Wrapper::AuthToken
- Inherits:
-
Struct
- Object
- Struct
- ChangeHealthcare::Eligibility::Wrapper::AuthToken
- Defined in:
- lib/change_healthcare/eligibility/wrapper.rb
Overview
Struct used to store auth tokens so we don’t need to fetch one every request.
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#auth ⇒ Object
The actual auth header to pass in to things.
-
#valid? ⇒ Boolean
Is this token still usable?.
Instance Attribute Details
#expires_at ⇒ Object
Returns the value of attribute expires_at
77 78 79 |
# File 'lib/change_healthcare/eligibility/wrapper.rb', line 77 def expires_at @expires_at end |
#token ⇒ Object
Returns the value of attribute token
77 78 79 |
# File 'lib/change_healthcare/eligibility/wrapper.rb', line 77 def token @token end |
Instance Method Details
#auth ⇒ Object
The actual auth header to pass in to things
86 87 88 |
# File 'lib/change_healthcare/eligibility/wrapper.rb', line 86 def auth "Bearer #{token}" end |
#valid? ⇒ Boolean
Is this token still usable?
80 81 82 |
# File 'lib/change_healthcare/eligibility/wrapper.rb', line 80 def valid? expires_at > (Time.new - 20) end |