Module: RightScale::Api::GatewayConnection

Included in:
Gateway, GatewayExtend
Defined in:
lib/rest_connection/rightscale/rightscale_api_gateway.rb

Instance Method Summary collapse

Instance Method Details

#connection(*opts) ⇒ Object

Config for API 1.5



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 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],  = 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