I've never worked with or written an API before. To help me learn, I want to write a Facebook API library RubyGem.
I'm thinking I should start with learning how to write a simple API with RoR.
Do you know of any good resources or tutorials that will help me learn how to write an API with Ruby?
I think you'll first have to chose what is exactly that you want to learn, since there's quite a few parts to this.
A gem such as facebooker is used to consume the API of a web service rather than "create" or expose an API (for a web service). In order to understand a library like this and what it does, you could try to learn more about APIs in general, but also about ways to access them using Ruby.
Even though Rails and the Rails community are embracing RESTful (or actually RESTlike) APIs, there are a bunch of other forms around as well, such as SOAP. Facebook e.g. has ditched REST in favor of their graph API. Check the answers for this question, which deals with the different types, to learn more: Examples of the best SOAP/REST/RPC web APIs? And why do you like them? And what's wrong with them?
For ways to access (REST) APIs I'd suggest taking a closer look at the source code of gems such as e.g. HTTParty and rest-client as well as Ruby's standard library Net::HTTP.
What comes to API's and web services, I've heard good things about "Restful web services" but there's a whole bunch of books and about a gazillion blog posts out there on this topic. Google is your friend.
And then you'll probably want to have a look at the development of ruby gems in general. This answer might give you some pointers in this regard: Ruby : How to write a gem?
This is an endless topic and I suggest to just get started somewhere. Learn how APIs work, how to access them and then read lots and lots of source code, e.g. of Facebooker or one of the other Facebook API gems. See how they work and start writing code. Good luck!
http://8raystech.com/2009/10/06/a-real-life-restful-rails-application
[edit]
The above link is broken.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With