19

I'd like to learn how to design good API wrappers in ruby. I'm looking for:

  • blog articles
  • tutorials
  • best code and library to learn from the code directly (well commented and designed)
  • books

... and also,

what are some of your favorite API wrappers and what makes them special?

Any source is welcome Thanks in advance

UPDATE jun 29 2011

Building a Platform API on Rails

UPDATE: 13/06/2011

have a look at great post on how to develop an an API wrapper/interface client: - http://www.arailsdemo.com/posts/56

notapatch
  • 6,569
  • 6
  • 41
  • 45
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109

3 Answers3

9

since testing is one part of a good API wrapper I recommend this for a start on the topic.

Writing an API Wrapper in Ruby with TDD

HaNdTriX
  • 28,732
  • 11
  • 78
  • 85
8

Chapter 2 of Ruby Best Practices might be helpful. You can read it for free here.

notapatch
  • 6,569
  • 6
  • 41
  • 45
egoboost
  • 96
  • 2
  • 2
    ... you meant Chapter 2: "Designing Beautiful APIs" :-) – Luca G. Soave May 12 '11 at 18:15
  • 1
    ... and here it is a good article http://wynnnetherland.com/blog/what-makes-a-good-api-wrapper – Luca G. Soave May 12 '11 at 18:15
  • ... an old article, but still get the point to build client wrappers http://adam.heroku.com/past/2008/8/8/ruby_libs_for_making_web/ – Luca G. Soave May 15 '11 at 09:09
  • monster_mash: this is great. Provides a fun interface to quickly build API libraries using Typhoeus: https://github.com/dbalatero/monster_mash – Luca G. Soave May 15 '11 at 09:21
  • ... net and clean even raw, a simple wrapper for "whoisxmlapi" based on Net::HTTP.get_response(URI.parse(url)) — Read more: https://github.com/ahlatimer/Whois-API-Ruby-Wrapper/blob/master/whois_api_wrapper.rb – Luca G. Soave May 15 '11 at 10:07
  • precious client performance comparison: https://github.com/igrigorik/em-http-request/blob/master/benchmarks/clients.rb – Luca G. Soave May 24 '11 at 10:14
  • ... another HTTP Request Performance comparison to develop even faster API wrappers: http://toevolve.org/2011/04/03/http-request-performance.html ( on github - https://github.com/threez/test-http-clients ) – Luca G. Soave May 24 '11 at 11:50
  • CORS API with OAuth2 authentication using Rails and AngularJS looks great http://nils-blum-oeste.net/cors-api-with-oauth2-authentication-using-rails-and-angularjs/#.US93MX0u7Lc – Luca G. Soave Feb 28 '13 at 15:31
  • 2
    The link in the answer is dead. Is it maybe available somewhere else? Are there any good, up-to-date ressources? – Flip Aug 09 '15 at 07:32
  • Wrapping Your API In A Custom Ruby Gem https://blog.engineyard.com/2014/wrapping-your-api-in-a-ruby-gem – Luca G. Soave Feb 03 '16 at 17:35
1

Take a look at Instagram Ruby Client.
It should give you a fair idea on how to write modular third party API wrappers in Ruby.

Nirav Gandhi
  • 1,945
  • 1
  • 23
  • 32