Hi,

I have heard a lot about Heroku and his work on Ruby on rails. I have
started working on ruby newly. I need to implement basic authorization
(https). I have used Heroku's implementation for http GET, PUT, POST and
DELETE methods. I need to pass username and password so that RestClient
does  basic authorization and returns the result.
Can you please help me how to pass username and password (for basic
authentication) as optional parameters to RestClient.
Suppose,

- > If the restclient module is defined as follows,
    def self.put(url, payload, headers={})
         Request.execute(:method => :put, :url => url, :payload => payload,
:headers => headers)
    end

- > username, password, headers , methods(GET, PUT, POST, DELETE) are
initialised as follows,
    def initialize(args)
     @method = args[:method] or raise ArgumentError, "must pass :method"
     @url = args[:url] or raise ArgumentError, "must pass :url"
     @headers = args[:headers] || {}
     @payload = process_payload(args[:payload])
     @user = args[:user]
     @password = args[:password]
     @timeout = args[:timeout]
    end

- > Basic authorization is performed internally as,
def setup_credentials(req)
    req.basic_auth(user, password) if user
end

- > Now, I need to pass username and password in the authentication header,
so that the values are passed to RestClient and basic authorization is
performed.
response=RestClient.put uri, resp.to_s, :content_type => 'text/xml' (how top
pass authentication header from here to RestClient ( req.basic_auth(user,
password) if user )? )

Can you please help me on this?

Regards
Kavita

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to