httparty vs mechanize

23 views
Skip to first unread message

Alex Katebi

unread,
Oct 18, 2010, 11:21:21 AM10/18/10
to rubyonra...@googlegroups.com
Are these two competing gems?

Thanks!

Frederick Cheung

unread,
Oct 18, 2010, 1:03:35 PM10/18/10
to Ruby on Rails: Talk


On Oct 18, 4:21 pm, Alex Katebi <alex.kat...@gmail.com> wrote:
> Are these two competing gems?
>
They're different in my opinion. Httparty make making http requests
nice, whereas mechanize is more about interacting with web pages (so
it has a bunch of features to do with cookies, filling out forms and
so on).

Fred

Ruban PA

unread,
Dec 9, 2011, 2:07:55 PM12/9/11
to rubyonra...@googlegroups.com
Hi all,

I need to do POST/PUT operation using httparty.

I have a default class as follows

require 'httparty'

class Webclient
include HTTParty

def intialize(options = {})
# parameters to build the url
end
end

with the help of httparty,
i can easily use get operation as follows

Webclient.get("url")

Can anyone give me an example of how to do POST/PUT operations through
httparty over a Rest webservice, where i need to post/Put the entire XML

for example,
XML content is like below
<ns:sample xmlns:ns="somelocation">
<attributes></attributes>
</ns:sample>

I need to post/put the whole xml content using HTTParty as

Webclient.post(url,"XMLContent")
Webclient.put(url,"XMLContent")

can any one give me an example of how to post/put the whole xml using
httparty under a class which includes httparty

Thanks in advance

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages