class ConohaApi::Client

Public Class Methods

new(options = {}) click to toggle source
# File lib/conoha_api/client.rb, line 21
def initialize(options = {})
  Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || ConohaApi.instance_variable_get(:"@#{key}"))
  end
  credential
end

Public Instance Methods

credential() click to toggle source
# File lib/conoha_api/client.rb, line 32
def credential
  @credential = nil if token_expired?
  @credential ||= auth
end
endpoints() click to toggle source
# File lib/conoha_api/client.rb, line 28
def endpoints
  @@endpoints
end

Private Instance Methods

auth() click to toggle source
# File lib/conoha_api/client.rb, line 39
def auth
  raise unless ready_for_authentication?
  auth_infomations = tokens
  token_expires(auth_infomations.access.token.expires)
  authed_endpoints(auth_infomations)
  auth_infomations
end
authed_endpoints(auth_infomations) click to toggle source
# File lib/conoha_api/client.rb, line 47
def authed_endpoints(auth_infomations)
  auth_infomations.access.serviceCatalog.each do |endpoint|
    @@endpoints[endpoint.type] = endpoint.endpoints.find { |e| e.region = 'tyo1' }.publicURL
  end
end