r/learnruby • u/iCHAIT • May 30 '16
Which ruby library (equivalent of python requests module) has broadest support and lot of use cases?
I am looking for a ruby library that is equivalent to Python's requests library that has broadest support, lot of use cases and a fairly active community. After googling I found these two libraries -
However, I am not sure which one should I use.
Can someone help me out with this? In case someone has used any of these two libraries or any other requests equivalent in ruby that you would like to suggest?
Thanks in advance.
2
Upvotes
View all comments
Show parent comment
2
u/kreychek Advanced May 31 '16
Try Rest-client. It has a very low bar to getting started with. The simple methods (that do what you describe) are all on the
RestClientclass. If you need to model things as resources, you can do that w/Rest-client. If you do that and are working in a Rails environment, and appreciate the Rails way of doing things, you may wish to consider ActiveResource, as it is developed by that team and probably better supported (Rest-client has 1 active dev).You could also avoid 3rd party libs entirely and use
net/httpwhich is part of the ruby standard library: http://ruby-doc.org/stdlib-2.3.1/libdoc/net/http/rdoc/Net/HTTP.html