Class: OpenStack::Base

Inherits:
ActiveResource::Base show all
Defined in:
lib/open_stack/base.rb

Class Method Summary collapse

Methods inherited from ActiveResource::Base

#load

Class Method Details

.headersObject

Set the X-Auth-Token header if the OpenStack authentication token is present



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/open_stack/base.rb', line 40

def self.headers
  if defined?(@headers)
    _headers = @headers
  elsif self != OpenStack::Base && superclass.headers
    _headers = superclass.headers
  else
    _headers = @headers || {}
  end

  if self.token.present?
    _headers['X-Auth-Token'] = self.token
  end

  _headers
end