{"id":15705014,"url":"https://github.com/markbates/faraday_bang","last_synced_at":"2025-05-12T18:09:54.706Z","repository":{"id":16177217,"uuid":"18923623","full_name":"markbates/faraday_bang","owner":"markbates","description":"Adds error raising ! methods to Faraday","archived":false,"fork":false,"pushed_at":"2015-02-06T21:27:06.000Z","size":171,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T18:09:16.119Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.markbates.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markbates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-18T19:46:36.000Z","updated_at":"2015-11-14T20:53:00.000Z","dependencies_parsed_at":"2022-09-15T18:40:30.874Z","dependency_job_id":null,"html_url":"https://github.com/markbates/faraday_bang","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Ffaraday_bang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Ffaraday_bang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Ffaraday_bang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Ffaraday_bang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbates","download_url":"https://codeload.github.com/markbates/faraday_bang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253795144,"owners_count":21965486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T20:14:34.697Z","updated_at":"2025-05-12T18:09:54.670Z","avatar_url":"https://github.com/markbates.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Faraday!\n[![Build Status](https://travis-ci.org/markbates/faraday_bang.png)](https://travis-ci.org/markbates/faraday_bang) [![Code Climate](https://codeclimate.com/github/markbates/faraday_bang.png)](https://codeclimate.com/github/markbates/faraday_bang)\n\n[Faraday](https://github.com/lostisland/faraday) is a great HTTP library, but it would be even better if had ! versions of all it's methods to raise errors when the request does not receive a successful response. Enter Farady! (pronounced Faraday Bang).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'faraday_bang'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install faraday_bang\n```\n\n## Usage\n\nUsing Faraday! is just as easy as using Faraday, except all you have to do is add a `!` to the Faraday methods.\n\n```ruby\nresponse = Faraday.get!('http://sushi.com/nigiri/sake.json')\n```\n\nIf a response is not successful, then a `Faraday::Bang::ResponseError` error will be raised.\n\nEach of the HTTP error status codes have been given their own sub-class to make catching them even easier. Here are a few examples:\n\n```ruby\nFaraday::Bang::Response401Error\nFaraday::Bang::Response404Error\nFaraday::Bang::Response500Error\nFaraday::Bang::Response503Error\n```\n\n## But Wait! There's More!\n\nAs a special added bonus an `as_json` method has been added to `Faraday::Response` to make it easier to JSON bodies back as a Ruby Hash.\n\n```ruby\nresponse = Faraday.get!('http://example.com/example.json')\njson = response.as_json\nputs json # =\u003e {\"name\"=\u003e\"Mark\"}\n```\n\n## Contributing\n\n1. Fork it ( http://github.com/\u003cmy-github-username\u003e/faraday_bang/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Ffaraday_bang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbates%2Ffaraday_bang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Ffaraday_bang/lists"}