I need to consume resources from a REST api, and I'm trying to find a good gem for doing this, but I can't find anything good...
What do you use for this??
I use the REST Client gem for this - it's worked well so far.
I use Active Resource. (But Active Resource is too short an answer since StackOverflow requires that answers be at least 30 characters.)
Related
I'm trying to connect my RoR app to the api at this website https://www.humanapi.co
There is a gem available here, https://github.com/humanapi/humanapi, that is supposed to make the process easy. I have read through the documentation several times Unfortunately, because I am new to RoR and web development in general, I'm not exactly sure how to implement this. Any help you can give is greatly appreciated!
Specifically: It says to configure the initilizer using these values..
HumanApi.config do |c|
c.app_id = ENV['HUMANAPI_KEY']
c.query_key = ENV['HUMANAPI_SECRET']
end
I understand this in concept, i have used omniauth etc before. But do I need to create another initializer or just use an existing one?
and finally, this is what i don't understand the most...
humanizable :get_the_token
def get_the_token
# the code to reach the token
"# the code to reach the token
I'm at a complete loss with that, how would i get the token? here is the documentation for web access to the api (which i've read a lot) http://hub.humanapi.co/docs/connect-web-guide
Well, it's not your fault, the documentation of the gem is poorly written and doesn't show what exactly is going on or what is it even doing
This gem is also outdated, created 3 years ago and there are no issues or updates or anything. you better go looking for a different gem that do the functionality you want
I am trying to use Photobucket(API) as a image uploading option in my website.
Is there any available gem to do this? or should i use things like REST to achieve this?
Please suggest.
Thanks,
Balan
The only thing I really found was this https://bitbucket.org/photobucket/api-ruby/src/7b69e473fb9fd5b4d37e2ad7f266500e45ef524b/example.rb?at=default. They are using the oauth rubygem to talk to photobucket, still a lot of manual process involved. It is also still using REST.
I would say the easiest way it going ahead and using REST following http://pic.photobucket.com/dev_help/WebHelpPublic/PhotobucketPublicHelp.htm and http://pic.photobucket.com/dev_help/WebHelpPublic/Content/FAQ/FAQOverview.htm to get you started.
I haven't done a REST client in ruby but this gem looks pretty good https://github.com/rest-client/rest-client.
I would recommend, assuming you have the time, making a photobucket ruby gem and wrapping the REST calls in useful class abstractions. It is great for the community, forces you to follow good practices(to a certain extent) and will provide great experience to put on a resume/talk about in an interview.
I want to know whether it is possible to create SOAP APIs in RAILS. I googled and found that SAVON can be used for communicating with SOAP API, is their anyway to create soap apis in rails 3.
We've just released 0.3.2 of https://github.com/roundlake/wash_out with new tiny features. It's currently active and maintained (unlike ActionWebService). And is probably best way to do what you want.
However even being maintainer of such a gem I do not recommend you to use SOAP at all. WashOut was created for the cases where you have no choice. So please think twice. In most cases REST is much more preferable.
There's a gem called actionwebservice that served this purpose many years ago. There are a few people who have maintained it along the way, but you might have to dig around. Searching ruby gems.org brings up a few results but it seems like even these are not really maintained. You might want to check out some of the forks too and see if they are still being maintained.
Having said that, if you have the option to not use SOAP, don't. Use REST as support for it is built into Rails and likely isn't going away any time soon.
Check this gem - https://github.com/roundlake/wash_out
I'm not pleased with Net::HTTP at all, and I'm looking for a lightweight gem that will either replace that library or at the very least hide it from me.
Does anyone have any suggestions?
My vote goes to HTTParty. It's incredibly simple to use and can be as powerful as you choose. Here's a code sample:
HTTParty.get("http://maps.googleapis.com/maps/api/distancematrix/json?origins=New+York+NY&destinations=Los+Angeles+CA&mode=car&language=en&sensor=false")
Pretty simple stuff depending on what you're using it for.
Try the RestClient gem:
https://github.com/archiloque/rest-client
There are a few out there.
Ruby toolbox has a http client list: http://ruby-toolbox.com/categories/http_clients.html
Personally I usually use HTTParty... or sometimes Mechanize, it's good for submitting forms
I would recommend checking the docs of each, to see which one suits your purpose best.
Hope this helps.
You might want to check out the rest gem, it was created and tested so we could find the best performing http gems by wrapping those gems and creating a standard interface to them. Turns out HTTParty and RestClient are very slow gems so I wouldn't recommend those, although you can always swap out the underlying gem in rest to see for yourself without having to change your code (other than initialization). rest gem by default will be much, much faster.
It's also very easy to use:
#rest = Rest::Client.new()
#rest.get(url, options...)
More info: https://github.com/iron-io/rest
I've found a couple of different twitter gem (for ruby-on-rails) out there:
http://twitter4r.rubyforge.org/
http://twitter.rubyforge.org/
But I'm wondering if someone can rate them and provide a recommendation of either one or a new one.
Thanks
Use twitter. It's actively maintained.
I've used both twitter4r and twitter (outside of Rails though) and over time seem to have stuck with the latter since I find it easy to use and well documented.
Grackle http://github.com/hayesdavis/grackle is pretty good. It's very clean, actively developed and well documented. It supports both Basic and OAuth authentication.