Sha256: 27dc973fabc96a93f6c80485d8da55f948cf257af4d48ff4c910e2a222c1c74b

Contents?: true

Size: 1.57 KB

Versions: 28

Compression:

Stored size: 1.57 KB

Contents

# Sawyer

Sawyer is an experimental hypermedia agent for Ruby built on top of [Faraday][faraday].

[faraday]: https://github.com/lostisland/faraday

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'sawyer'
```

And then execute:

```sh
bundle
```

Or install it yourself as:

```sh
gem install sawyer
```

## Usage

```ruby
require "sawyer"

# Create a Sawyer agent
agent = Sawyer::Agent.new("https://api.github.com",
  links_parser: Sawyer::LinkParsers::Simple.new)

# Fetch the root of the API
root = agent.root.data

# Access a resource directly
contributors = agent.call(:get, "repos/lostisland/sawyer/contributors").data

# Load a hypermedia relation
top_contributor = contributors.first
followers = top_contributor.rels[:followers].get.data
```

For more information, check out the [documentation](http://www.rubydoc.info/gems/sawyer/).

## Development

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`](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](https://rubygems.org).

## Contributing

Check out the [contributing guide](CONTRIBUTING.md) for more information on contributing.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

28 entries across 17 versions & 2 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/sawyer-0.9.2/README.md
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/sawyer-0.9.2/README.md
sawyer-0.9.2 README.md
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/sawyer-0.9.1/README.md
sawyer-0.9.1 README.md
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/sawyer-0.8.2/README.md
sawyer-0.9.0 README.md
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/sawyer-0.8.2/README.md
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/sawyer-0.8.2/README.md
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/sawyer-0.8.2/README.md