Skip to content
/ curb-fu Public
forked from gdi/curb-fu

Simple, yet powerful wrapper for taf2's curb (libcurl) library

License

Notifications You must be signed in to change notification settings

zozi/curb-fu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

== curb-fu - easy-to-use wrapper around curb - the ruby wrapper around libcurl

* http://github.com/curb-fu

Curb can be found at http://github.com/taf2/curb

=== License

This gem is released under the terms of the Ruby license.  See the LICENSE file for details.

=== Troubleshooting

If you are POSTing data and curb seems to be locking up, try posting it with an explicit 'Expect: 100-continue' header.

You can set this per-request, e.g.
  CurbFu.post({:host => 'example.com', :headers => { "Expect" => "100-continue" }}, { "data" => "here" })
or you can configure it as a global header, e.g.
  CurbFu.global_headers = { "Expect" => "100-continue" }
  # ... then make your requests as normal
however you feel best.

=== Prerequisites

* Ruby (tested on 1.8.7, 1.9.1)
* The Curb gem (and its libcurl dependency)
  * http://github.com/taf2/curb

=== Installation

  $ gem install curb-fu --source http://gems.github.com

Or, if you ahve the source:

  $ cd <source-dir>
  $ rake gem
  $ gem install pkg/

=== Examples

Urls can be requested using hashes of options or strings.  The GET, POST, PUT, and DELETE methods are supported 
through their respective methods on CurbFu and CurbFu::Request. 

==== String Examples

response = CurbFu.get('http://slashdot.org')
puts response.body

response = CurbFu.post('http://example.com/some/resource', { :color => 'red', :shape => 'sphere' })
puts response.body unless response.success?

==== Hash Examples

response = CurbFu.get(:host => 'github.com', :path => '/gdi/curb-fu')
puts response.body

response = CurbFu.post({:host => 'example.com', :path => '/some/resource'}, { :color => 'red', :shape => 'sphere' })
puts response.body unless response.success?

if you need https:
response = CurbFu.post({:host => 'example.com', :path => '/some/resource', :protocol => "https"}, { :color => 'red', :shape => 'sphere' })

Have fun!

About

Simple, yet powerful wrapper for taf2's curb (libcurl) library

Resources

License

Stars

Watchers

Forks

Packages

No packages published