Class: OpenStack::Nova::Compute::Base

Inherits:
Common show all
Defined in:
lib/open_stack/nova/compute/base.rb

Class Method Summary collapse

Methods inherited from Common

collection_path, custom_method_collection_url, element_path

Methods inherited from Base

headers

Methods inherited from ActiveResource::Base

#load

Class Method Details

.siteObject

Get the Nova Compute endpoint assigned to OpenStack::Nova::Compute classes



27
28
29
30
31
32
33
# File 'lib/open_stack/nova/compute/base.rb', line 27

def self.site
  if self == OpenStack::Nova::Compute::Base
    Thread.current[:open_stack_nova_compute_site]
  else
    super
  end
end

.site=(site) ⇒ Object

Set the Nova Compute endpoint for OpenStack::Nova::Compute classes



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/open_stack/nova/compute/base.rb', line 36

def self.site=(site)
  super(site)
  Thread.current[:open_stack_nova_compute_site] = @site
  # Regenerate the prefix method
  default = @site.path
  default << '/' unless default[-1..-1] == '/'
  # generate the actual method based on the current site path
  self.prefix = default

  @site
end