Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manelli/hippie
Simple HTTP client for Ruby
https://github.com/manelli/hippie
Last synced: 7 days ago
JSON representation
Simple HTTP client for Ruby
- Host: GitHub
- URL: https://github.com/manelli/hippie
- Owner: manelli
- License: other
- Created: 2014-10-29T20:42:16.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-15T19:18:25.000Z (over 7 years ago)
- Last Synced: 2024-10-12T21:12:42.682Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 299 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hippie
### _Simple HTTP client for ruby_
---## Installation
$ gem install hippie
## Usage
Here's an example of a GET request:```ruby
require 'hippie'response = Hippie.get('http://example.com')
response.class #=> Hippie::Responseresponse.status #=> Number with the status code
response.headers #=> Hash with the response headers
response.body #=> String with the response body
response.json #=> String with the response body parsed to jsonresponse.information? #=> 1xx response
response.success? #=> 2xx response
response.redirection? #=> 3xx response
response.client_error? #=> 4xx response
response.server_error? #=> 5xx response
response.error? #=> 4xx or 5xx
```You can also pass parameters with a query string:
```ruby
Hippie.get('http://example.com', params: { foo: 'bar' })
```If you want to send data with a POST request, you can add a `data` option with the value.
```ruby
Hippie.post('http://example.com', data: 'hello world')
```For Basic Authentication, you can provide the option `auth`, which
should contain an array with the username and password:```ruby
Hippie.get('http://example.com', auth: ['username', 'password'])
```## Available methods
- GET
- POST
- PUT
- DELETE
- HEAD
- OPTIONS
- PATCH
- TRACE### Disclaimer
This is a fork of the awesome 'requests' gem from cyx (https://github.com/cyx/requests)