class ResoTransport::Authentication::Access
Session class for TokenAuth. This stores the access token, the token type (usually `Bearer`), and the expiration date of the token.
Attributes
access_token[RW]
expires[RW]
token_type[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/reso_transport/authentication/access.rb, line 8 def initialize(options = {}) @access_token = options[:access_token] @expires = Time.now + options[:expires_in] @token_type = options[:token_type] end
Public Instance Methods
expired?()
click to toggle source
# File lib/reso_transport/authentication/access.rb, line 14 def expired? Time.now > expires end
valid?()
click to toggle source
# File lib/reso_transport/authentication/access.rb, line 18 def valid? !!access_token && !expired? end