Project

hippie

0.0
No commit activity in last 3 years
No release in over 3 years
Simple HTTP client for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Hippie

Simple HTTP client for ruby


Installation

$ gem install hippie

Usage

Here's an example of a GET request:

require 'hippie'

response = Hippie.get('http://example.com')
response.class #=> Hippie::Response

response.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 json

response.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:

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.

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:

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)