You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sawyer is an experimental hypermedia agent for Ruby built on top of Faraday.
Installation
Add this line to your application's Gemfile:
gem'sawyer'
And then execute:
bundle
Or install it yourself as:
gem install sawyer
Usage
require"sawyer"# Create a Sawyer agentagent=Sawyer::Agent.new("https://api.github.com",links_parser: Sawyer::LinkParsers::Simple.new)# Fetch the root of the APIroot=agent.root.data# Access a resource directlycontributors=agent.call(:get,"repos/lostisland/sawyer/contributors").data# Load a hypermedia relationtop_contributor=contributors.firstfollowers=top_contributor.rels[:followers].get.data
After checking out the repo, run script/test to bootstrap the project and run the tests.
You can also run script/console for an interactive prompt that will allow you to experiment.
To package the gem, run script/package. To release a new version, update the version number in lib/sawyer.rb, and then run script/release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.