Module: RightScale::Api::InternalConnection

Included in:
Internal, InternalExtend, RsInternal
Defined in:
lib/rest_connection/rightscale/rightscale_api_internal.rb

Instance Method Summary collapse

Instance Method Details

#connection(*opts) ⇒ Object

Config for API 0.1 Only works for legacy clusters



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rest_connection/rightscale/rightscale_api_internal.rb', line 35

def connection(*opts)
  @@little_brother_connection ||= RestConnection::Connection.new(*opts)
  settings = @@little_brother_connection.settings
  settings[:common_headers]["X_API_VERSION"] = "1.0"
  settings[:api_href] = settings[:api_url]
  settings[:extension] = ".js"

  unless @@little_brother_connection.respond_to?(:refresh_cookie)
    @@little_brother_connection.instance_exec(&(RightScale::Api::BASE_COOKIE_REFRESH))
  end

  @@little_brother_connection.refresh_cookie unless @@little_brother_connection.cookie
  settings[:common_headers]["X_API_VERSION"] = "0.1"
  @@little_brother_connection
end