look at the documents at
http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
basically you want to do a http.post_form
something like:
res = Net::HTTP.post_form(URI.parse(''http://electric-
sky-98.heroku.com/products/new''),
"brand"=>"brandstuff", "name"
=>"nameStuff", ... the rest of the fields ...)
On Oct 30, 8:30 pm, kevid <alumsimport...-FFYn/CNdgSA@public.gmane.org>
wrote:> hi all,
>
> I have a rails application athttp://electric-sky-98.heroku.com/products
>
> require ''net/http''
> require ''uri''
> res = Net::HTTP.get_response(URI.parse(''http://electric-
> sky-98.heroku.com/products.xml''))
> puts res.body
>
> the above code gave me the xml file below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <products type="array">
> <product>
> <brand>Tubers</brand>
> <created-at
type="datetime">2010-10-30T01:35:48Z</created-at>
> <id type="integer">1</id>
> <name>Yam</name>
> <price>£ 30</price>
> <quantity>100 tubers</quantity>
> <sku>WDW332</sku>
> <updated-at
type="datetime">2010-10-30T01:35:48Z</updated-at>
> </product>
> </products>
>
> QUESTION:::
> How do i create a new product object at
http://electric-sky-98.heroku.com/products
> with ruby HTTP POST
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.