Coder Social home page Coder Social logo

curb-fu's Introduction

== 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!

curb-fu's People

Contributors

erithmetic avatar

Watchers

Huynh Kang avatar Rob Eroh avatar James Cloos avatar Mark Cassetta avatar Skylar avatar Jay Rosenthal avatar Priya Joshi avatar Diane avatar  avatar Bob Sollish avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.