https://github.com/sue445/faraday_boolean
Faraday response parser for boolean body
https://github.com/sue445/faraday_boolean
faraday gem
Last synced: about 2 months ago
JSON representation
Faraday response parser for boolean body
- Host: GitHub
- URL: https://github.com/sue445/faraday_boolean
- Owner: sue445
- License: mit
- Created: 2015-10-20T10:01:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T13:18:51.000Z (5 months ago)
- Last Synced: 2025-03-27T16:56:05.657Z (2 months ago)
- Topics: faraday, gem
- Language: Ruby
- Homepage: https://sue445.github.io/faraday_boolean/
- Size: 76.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# FaradayBoolean
Faraday response parser for boolean body
[](https://badge.fury.io/rb/faraday_boolean)
[](https://github.com/sue445/faraday_boolean/actions/workflows/test.yml)
[](https://coveralls.io/github/sue445/faraday_boolean?branch=master)
[](https://codeclimate.com/github/sue445/faraday_boolean)## Installation
Add this line to your application's Gemfile:
```ruby
gem 'faraday_boolean'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install faraday_boolean
## Usage
```sh
$ curl http://example.com/boolean/true
true
``````ruby
require "faraday_boolean"connection =
Faraday.new(url: "http://example.com") do |conn|
conn.response :boolean
conn.adapter Faraday.default_adapter
endres = connection.get("/boolean/true")
res.body
#=> trueres.body.class
#=> TrueClass
```If don't use `conn.response :boolean`, return `"true"` of `String` class
```ruby
connection =
Faraday.new(url: "http://example.com") do |conn|
# conn.response :boolean
conn.adapter Faraday.default_adapter
endres = connection.get("/boolean/true")
res.body
#=> "true"res.body.class
#=> String
```## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake 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
Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/faraday_boolean.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).