This needs to be cleaned up so as not to break the previous behavior,
but this is a hack that seems to work.
class ActiveResource::Connection
def basic_auth_user=(username)
@basic_auth_user = username
end
def basic_auth_pass=(password)
@basic_auth_pass = password
end
def authorization_header
(@basic_auth_user || @basic_auth_pass ? { 'Authorization' =>
'Basic ' +
["#{@basic_auth_user }:#{@basic_auth_pass}"].pack('m').delete("\r
\n") } : {})
end
end
class ActiveResource::Base
# Pass username and password directly to the connection
# rather than on the URI so that we can add Basic Authorization
headers
# for usernames which would not be permitted on the URI such as
those in the
# of email addresses.
def self.auth_as(username,password)
self.connection.basic_auth_user = username
self.connection.basic_auth_pass = password
end
end
class RallyResource < ActiveResource::Base
self.site = "
https://rally1.rallydev.com:443/slm/webservice/1.05"
self.auth_as '
myad...@domain.com', 'secret'
end
John-Mason Shackelford
Software Development Coach
Pearson
2510 North Dodge St.
Iowa City, IA 52245
ph.
319-354-9200x6214
john-mason....@pearson.com
http://pearsonschool.com