Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complete rails json API example with Rspec tests [closed]

I'm looking for a good example repository of a Rails 3 project that implements a JSON API and has included RSpec tests. A full tutorial would be great but I'd settle for just a well commented example.

like image 795
Christian Schlensker Avatar asked Jul 30 '11 19:07

Christian Schlensker


2 Answers

Yehuda Katz and Ryan Bigg's excellent upcoming book, Rails 3 in Action, has a chapter on building a test-driven JSON API on top of the example application that runs through the entire book.

While I strongly recommend buying a copy of the beta edition of the book, the code for the sample application, Ticketee, is open source and can be found on GitHub. In particular, everything API-related is namespaced under /app/controllers/api and you can find plenty of RSpec tests in /spec/api.

I was in your same position a couple of months ago when I was having to write a JSON API for an iPhone app so I'm well aware of the lack of good, test-driven, relevant tutorials online. Lucky for me I found out about the book and it turned out to be an absolute life saver.

like image 101
Leo Cassarani Avatar answered Oct 02 '22 13:10

Leo Cassarani


RubyGems.org is open source and has a great example of an API

like image 30
erickreutz Avatar answered Oct 02 '22 13:10

erickreutz