module RightScale::Api::GatewayConnection

Public Instance Methods

connection(*opts) click to toggle source

Config for API 1.5

# File lib/rest_connection/rightscale/rightscale_api_gateway.rb, line 63
def connection(*opts)
  @@gateway_connection ||= RestConnection::Connection.new(*opts)
  settings = @@gateway_connection.settings
  settings[:common_headers]["X_API_VERSION"] = "1.5"
  settings[:api_href], account = settings[:api_url].split(/\/acct\//) if settings[:api_url].include?("acct")
  settings[:extension] = ".json"

  unless @@gateway_connection.respond_to?(:refresh_cookie)
    @@gateway_connection.instance_exec(&(RightScale::Api::GATEWAY_COOKIE_REFRESH))
  end

  @@gateway_connection.refresh_cookie unless @@gateway_connection.cookie
  @@gateway_connection
end