Collection+JSON parsing middleware for faraday.
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
Gemfile
README.md
Rakefile
faraday_collection_json.gemspec

README.md

Faraday Collection JSON

This Faraday middleware parses collection+json responses using the collection-json gem.

service = Faraday.new do |builder|
  builder.response :collection_json, :content_type => /collection\+json$/
  builder.adapter  :net_http
end

collection = service.get('http://www.service.org/').body
collection.href                       # => 'http://www.service.org/'
collection.links.first.tap do |link|
  link.rel                            # => 'feed'
  link.href                           # => 'http://www.service.org/feed.rss'
end