Module: ConohaApi::Authentication

Included in:
Client, Connection
Defined in:
lib/conoha_api/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#token_expire_timeObject (readonly)

Returns the value of attribute token_expire_time.



6
7
8
# File 'lib/conoha_api/authentication.rb', line 6

def token_expire_time
  @token_expire_time
end

Instance Method Details

#ready_for_authentication?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/conoha_api/authentication.rb', line 8

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

#token_expired?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/conoha_api/authentication.rb', line 12

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

#token_expires(expire_time) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/conoha_api/authentication.rb', line 17

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