module Miasma::Contrib::OpenStackApiCore::ApiCommon
Common API methods
Public Class Methods
included(klass)
click to toggle source
Set attributes into model
@param klass [Class]
# File lib/miasma/contrib/open_stack.rb, line 212 def self.included(klass) klass.class_eval do attribute :open_stack_identity_url, String, :required => true attribute :open_stack_username, String attribute :open_stack_user_id, String attribute :open_stack_password, String attribute :open_stack_token, String attribute :open_stack_region, String attribute :open_stack_tenant_name, String attribute :open_stack_domain, String attribute :open_stack_project, String end end
Public Instance Methods
connection()
click to toggle source
@return [HTTP] with auth token provided
Calls superclass method
# File lib/miasma/contrib/open_stack.rb, line 227 def connection super.headers('X-Auth-Token' => token) end
endpoint()
click to toggle source
@return [String] endpoint URL
# File lib/miasma/contrib/open_stack.rb, line 232 def endpoint open_stack_api.endpoint_for( Utils.snake(self.class.to_s.split('::')[-2]).to_sym, open_stack_region ) end
open_stack_api()
click to toggle source
@return [Miasma::Contrib::OpenStackApiCore]
# File lib/miasma/contrib/open_stack.rb, line 245 def open_stack_api key = "miasma_open_stack_api_#{attributes.checksum}".to_sym memoize(key, :direct) do Miasma::Contrib::OpenStackApiCore.new(attributes) end end
token()
click to toggle source
@return [String] valid API token
# File lib/miasma/contrib/open_stack.rb, line 240 def token open_stack_api.api_token end