Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Restfull HTTP library
Ruby
branch: remake

This branch is 21 commits ahead, 1 commit behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
README.md
Rakefile
resto.gemspec

README.md

Resto

TODO: Write a gem description

Installation

Add this line to your application's Gemfile:

gem 'resto'

And then execute:

$ bundle

Or install it yourself as:

$ gem install resto

Usage

Parse JSON

You must require the json lib from stdlib.

require 'json'
require 'resto'

Faster CRuby or Rubinius JSON parsing

You can use another JSON gem if you want a faster JSON parser. This is how you use the yajl gem with Resto.

require 'yajl'
require 'resto'

Resto.configure do |config|
  config.json_decode = ->(json) { Yajl::Parser.parse(json) }
  config.json_encode = ->(hash) { Yajl::Encoder.encode(hash) }
end

Faster JRuby JSON parsing

If you use JRuby and want to parse JSON faster you can use the jrjackson gem.

require 'jrjackson_r' # A JRuby library wrapping the JAVA jackson jars.
require 'resto'

Resto.configure do |config|
  config.json_decode = ->(json) { JrJackson::Json.parse(json) }
  config.json_encode = ->(hash) { JrJackson::Json.generate(hash) }
end

References

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.