ActiveResource connection.post custom headers

I am consuming a restful resource from a remote system that requires a
custom header to post.
I'm using something along these lines

input = {"bodyvalue1" => "one","bodyvalue2" => "two","bodyvalue3" =>
"three","bodyvalue4" => "four"}
body = input.to_param
headers["X-TheRequiredApplicationKey"] =
"ThisIsAReallyGreatApplicationKey"
headers["X-TheRequiredUserKey"] = "ThisIsAReallyGreatUserKey"
uri = "/users/1234/store/orders"

resp = connection.post(uri,body,headers)

I'm not sure, but I suspect that the way that headers are handled for
connection.post aren't working they way they should.

Hi Ben,
I guess you are going to create an order on the remote service, why don't you use ActiveResource in the following way?

class Order < ActiveResource::Base
   self.site = "http://api.example.com"

   headers["X-TheRequiredApplicationKey"] = "ThisIsAReallyGreatApplicationKey"
   headers["X-TheRequiredUserKey"] = "ThisIsAReallyGreatUserKey"
end

order = Order.create(...)

Luca

I'll try that out. It looks like I may have a design flaw because I
have that code in an unrelated model. I'll move the method into an
Order model instead of the User model where it is now
(User.place_order) - still learning both the code and the methodology.
I'll repost after I've moved things around.
Thanks for the input,
Ben