Sha256: 59a3d4223957a8c979184abe1033646e6971accc53e97ef14a361dbf9d6d2bbc

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

require 'time'
require 'conoha_api/connection'

module ConohaApi
  module Authentication
    attr_reader :token_expire_time

    def ready_for_authentication?
      !! (@login && @password)
    end

    def token_expired?
      return true unless token_expire_time
      token_expire_time < Time.now
    end

    def token_expires(expire_time)
      @token_expire_time = case expire_time
      when String
        Time.iso8601(expire_time)
      when Date
        expire_time
      else
        raise
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conoha_api-0.2.0 lib/conoha_api/authentication.rb
conoha_api-0.1.0 lib/conoha_api/authentication.rb