module RightScale::Api::InternalConnection

Public Instance Methods

connection(*opts) click to toggle source

Config for API 0.1 Only works for legacy clusters

# 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