Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/savonrb/httpi
Common interface for Ruby's HTTP clients
https://github.com/savonrb/httpi
Last synced: 4 days ago
JSON representation
Common interface for Ruby's HTTP clients
- Host: GitHub
- URL: https://github.com/savonrb/httpi
- Owner: savonrb
- License: mit
- Created: 2010-09-11T14:49:07.000Z (over 14 years ago)
- Default Branch: main
- Last Pushed: 2024-07-14T09:54:57.000Z (7 months ago)
- Last Synced: 2024-12-30T20:05:11.537Z (26 days ago)
- Language: Ruby
- Homepage: http://httpirb.com
- Size: 745 KB
- Stars: 300
- Watchers: 15
- Forks: 150
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ruby-toolbox - HTTPI - Common interface for Ruby's HTTP libraries (Web Apps, Services & Interaction / HTTP clients)
README
# HTTPI
A common interface for Ruby's HTTP libraries. This project is now in maintenance mode. For new projects, we recommend [faraday](https://github.com/lostisland/faraday).
[Documentation](https://www.rubydoc.info/gems/httpi)
[![Development](https://github.com/savonrb/httpi/actions/workflows/development.yml/badge.svg)](https://github.com/savonrb/httpi/actions/workflows/development.yml)
## Installation
HTTPI is available through [Rubygems](https://rubygems.org/gems/httpi) and can be installed via:
$ gem install httpi
or add it to your Gemfile like this:
gem 'httpi', '~> 4.0.0'
## Usage example
``` ruby
require "httpi"# create a request object
request = HTTPI::Request.new
request.url = "http://example.com"# and pass it to a request method
HTTPI.get(request)# use a specific adapter per request
HTTPI.get(request, :curb)# or specify a global adapter to use
HTTPI.adapter = :httpclient# and execute arbitary requests
HTTPI.request(:custom, request)# add a client setup block that will be called before each request
HTTPI.adapter = :httpclient
HTTPI.adapter_client_setup = proc do |x|
x.ssl_config.set_default_paths
x.force_basic_auth = true
end
# ...
HTTPI.get(request) do |x|
x.force_basic_auth = false
end
```### SOCKS Proxy Support
To use the the SOCKS proxy support, please add the `socksify` gem to your gemfile, and add the following code:
``` ruby
require 'socksify'
require 'socksify/http'
```to your project.
## Documentation
Continue reading at https://www.rubydoc.info/gems/httpi