-
-
Save jeremyd/760069 to your computer and use it in GitHub Desktop.
## One way to change the rest_connection settings using Ruby code. | |
RightScale::Api::BaseExtend.class_eval <<-EOF | |
@@connection.settings = { | |
:user => "someuser@rightscale.com", | |
:pass => "test1234_", | |
:api_url => "https://my.rightscale.com/api/acct/12345", | |
:common_headers => { | |
"X_API_VERSION" => "1.0" | |
} | |
} | |
EOF | |
Yet another follow up for this. Some calls continue to fail using original fix. You need to override connection settings in the Base class as well. The full "fix" seems to be:
RightScale::Api::BaseExtend.class_eval <<-EOF
@@connection ||= RestConnection::Connection.new
@@connection.settings = {
:user => "someuser@rightscale.com",
:pass => "test1234_",
:api_url => "https://my.rightscale.com/api/acct/12345",
:common_headers => {
"X_API_VERSION" => "1.0"
}
}
EOF
RightScale::Api::Base.class_eval <<-EOF
@@connection ||= RestConnection::Connection.new
@@connection.settings = {
:user => "someuser@rightscale.com",
:pass => "test1234_",
:api_url => "https://my.rightscale.com/api/acct/12345",
:common_headers => {
"X_API_VERSION" => "1.0"
}
}
EOF
This didn't work as is, I had to add:
RightScale::Api::BaseExtend.class_eval <<-EOF
+@@connection ||= RestConnection::Connection.new
@@connection.settings = {