Disclaimer - I haven't tried this, but it should work:

class Person < ActiveResource::Base
  self.site = "http://api.people.com:3000/";
  self.headers["User-agent"] = "MyUser/agent v1.0"
end

ActiveResource::Base#headers returns a hash, so it should be as easy as
that.

http://api.rubyonrails.org/classes/ActiveResource/Base.html#M000890

Cheers,


Andy

-- 
Andy Jeffries
http://andyjeffries.co.uk/      #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840


On 22 February 2010 15:38, TomRossi7 <[email protected]> wrote:

> I was wondering how I could set a custom user-agent for all of my API
> requests from ActiveResource?  Basically, I want to identify my
> application when ever I hit someone's API from ActiveResource.
>
> Thanks!
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to