Sha256: 8731d5d3343708709546620dcf60f3a73c9aa22bbc634c48fafd1f100078a079

Contents?: true

Size: 596 Bytes

Versions: 25

Compression:

Stored size: 596 Bytes

Contents

module ResoTransport
  module Authentication
    # Session class for TokenAuth. This stores the access token, the token type
    # (usually `Bearer`), and the expiration date of the token.
    class Access
      attr_accessor :access_token, :expires, :token_type

      def initialize(options = {})
        @access_token = options[:access_token]
        @expires      = Time.now + options[:expires_in]
        @token_type   = options[:token_type]
      end

      def expired?
        Time.now > expires
      end

      def valid?
        !!access_token && !expired?
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
reso_transport-2.0.0 lib/reso_transport/authentication/access.rb
reso_transport-1.5.19 lib/reso_transport/authentication/access.rb
reso_transport-1.5.18 lib/reso_transport/authentication/access.rb
reso_transport-1.5.17 lib/reso_transport/authentication/access.rb
reso_transport-1.5.16 lib/reso_transport/authentication/access.rb
reso_transport-1.5.15 lib/reso_transport/authentication/access.rb
reso_transport-1.5.14 lib/reso_transport/authentication/access.rb
reso_transport-1.5.13 lib/reso_transport/authentication/access.rb
reso_transport-1.5.12 lib/reso_transport/authentication/access.rb
reso_transport-1.5.11 lib/reso_transport/authentication/access.rb
reso_transport-1.5.9 lib/reso_transport/authentication/access.rb
reso_transport-1.5.8 lib/reso_transport/authentication/access.rb
reso_transport-1.5.7 lib/reso_transport/authentication/access.rb
reso_transport-1.5.5 lib/reso_transport/authentication/access.rb
reso_transport-1.5.4 lib/reso_transport/authentication/access.rb
reso_transport-1.5.3 lib/reso_transport/authentication/access.rb
reso_transport-1.5.2 lib/reso_transport/authentication/access.rb
reso_transport-1.5.1 lib/reso_transport/authentication/access.rb
reso_transport-1.4.0 lib/reso_transport/authentication/access.rb
reso_transport-1.3.2 lib/reso_transport/authentication/access.rb