Class: ChangeHealthcare::ProfessionalClaims::Wrapper::AuthToken

Inherits:
Struct
  • Object
show all
Defined in:
lib/change_healthcare/professional_claims/wrapper.rb

Overview

Struct used to store auth tokens so we don't need to fetch one every request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expires_atObject

Returns the value of attribute expires_at

Returns:

  • (Object)

    the current value of expires_at



94
95
96
# File 'lib/change_healthcare/professional_claims/wrapper.rb', line 94

def expires_at
  @expires_at
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



94
95
96
# File 'lib/change_healthcare/professional_claims/wrapper.rb', line 94

def token
  @token
end

Instance Method Details

#authObject

The actual auth header to pass in to things



103
104
105
# File 'lib/change_healthcare/professional_claims/wrapper.rb', line 103

def auth
  "Bearer #{token}"
end

#valid?Boolean

Is this token still usable?

Returns:

  • (Boolean)


97
98
99
# File 'lib/change_healthcare/professional_claims/wrapper.rb', line 97

def valid?
  expires_at > (Time.new - 20)
end