No commit activity in last 3 years
No release in over 3 years
Faraday middleware for parsing JSON as openstruct Object.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request