FaradayMiddleware::ParseObject
A simple Faraday middleware that parses JSON responses as Object. It is identical to FaradayMiddleware::ParseJson
from faraday_middleware
gem except that it parses JSON as OpenStruct
instead of Hash
Installation
# Gemfile
gem 'faraday_middleware-parse_object', '~> 0.1.0'
or
$ gem install faraday_middleware-parse_object
Usage
The same as FaradayMiddleware::ParseJson
:
require 'faraday_middleware/parse_object'
connection = Faraday.new do |builder|
builder.response :object
builder.adapter Faraday.default_adapter
end
connection.get('http://example.com/some.json')
Note
Supports only faraday
versions 0.9
and higher.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request