Module: RightScale::Api::BaseConnection

Included in:
Base, BaseExtend
Defined in:
lib/rest_connection/rightscale/rightscale_api_base.rb

Instance Method Summary collapse

Instance Method Details

#connection(*opts) ⇒ Object

Config for API 1.0



146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/rest_connection/rightscale/rightscale_api_base.rb', line 146

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

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

  @@connection.refresh_cookie unless @@connection.cookie
  @@connection
end