Project

tortilla

0.0
No commit activity in last 3 years
No release in over 3 years
Wrapping web APIs made easy. Ruby port of the Tortilla Python project.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.13
~> 1.8
 Project Readme

Tortilla.rb

Build Status

This is a port of Tortilla originally written for use in Python. But I thought it would also be useful in Ruby.

It works basically the same as the original Python project, but I will give you a simple example.

Example

github = Tortilla.wrap("https://api.github.com")
github.users("octocat").get()["location"]
# => "San Francisco"

Right now authentication headers are not supported. But I'm working on that.

By default Tortilla will parse a JSON response into a Ruby hash. But you can implement your own parsing methods by adding them to Tortilla per API.

Example:

api = Tortilla.wrap("https://xmlapi.example.com")
api.on_response do |response|
  SomeCoolXMLParser.parse(response.body)
end
api.users("bramvdbogaerde").get

The response object is from the gem HTTParty, so for detailed documentation about the response, you should take a look at their gem.

Roadmap

  • Support adding customs headers (like authentication headers) [IN PROGRESS]
  • Support other HTTP methods than GET (like POST, UPDATE, DELETE) [IN PROGRESS]
  • Implement an OAuth workflow

License

MIT