Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.36 KB

File metadata and controls

39 lines (29 loc) · 1.36 KB

simple-client Build Status Dependency Status

Uber simple Net::HTTP wrapper for ruby for sole purpose of testing, not a production tool

Features

  • Configure client using API or config (via options hash)
  • Easy configuration of HTTP Proxy from environment
  • Supports no_proxy environment variable
  • Easy configuration of ssl (including client certs)

Example usage

 #Get - using api
 s = SimpleClient::Client.new
 s.request_headers = {'X-Test1'=>'foo', 'X-Test2' => 'bar'}
 response = s.get 'http://www.foo.co.uk/sport'


 #Get - using config
 s = SimpleClient::Client.new
 response = s.get('http://www.foo.co.uk/sport', 
                  :headers => {'X-Test1'=>'foo', 'X-Test2' => 'bar'})

#Post - using api
s = SimpleClient::Client.new
s.request_headers = {'X-Test1'=>'foo', 'X-Test2' => 'bar'}
s.body = 'abc'
response = s.post 'http://www.foo.co.uk/sport'

#Post - using config
s = SimpleClient::Client.new
response = s.post('http://www.foo.co.uk/sport', 
                  :headers => {'X-Test1'=>'foo', 'X-Test2' => 'bar'},
                  :body => 'abc')