public
Description: Ruby HTTP client based on libcurl
Homepage: http://toland.github.com/patron/
Clone URL: git://github.com/toland/patron.git
toland (author)
Sat Oct 10 08:04:57 -0700 2009
commit  e72f70bda6519cb7f7c0abc556a614c05d7c98f9
tree    e3543203105e6e25422c7e12c90966baab9e1b0c
parent  8bbca5b5c2e8c547abfb55a476ab7f79301962d9
patron / README.txt
100644 57 lines (33 sloc) 1.422 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
= Ruby HTTP Client
 
== SYNOPSIS
 
Patron is a Ruby HTTP client library based on libcurl. It does not try to expose
the full "power" (read complexity) of libcurl but instead tries to provide a
sane API while taking advantage of libcurl under the hood.
 
 
== USAGE
 
Usage is very simple. First, you instantiate a Session object. You can set a few
default options on the Session instance that will be used by all subsequent
requests:
 
    sess = Patron::Session.new
    sess.timeout = 10
    sess.base_url = "http://myserver.com:9900"
    sess.headers['User-Agent'] = 'myapp/1.0'
 
The Session is used to make HTTP requests.
 
    resp = sess.get("/foo/bar")
 
Requests return a Response object:
 
    if resp.status < 400
      puts resp.body
    end
 
The GET, HEAD, PUT, POST and DELETE operations are all supported.
 
    sess.put("/foo/baz", "some data")
    sess.delete("/foo/baz")
 
You can ship custom headers with a single request:
 
    sess.post("/foo/stuff", "some data", {"Content-Type" => "text/plain"})
 
That is pretty much all there is to it.
 
 
== REQUIREMENTS
 
You need a recent version of libcurl in order to install this gem. On MacOS X
the provided libcurl is sufficient. You will have to install the libcurl
development packages on Debian or Ubuntu. Other Linux systems are probably
similar. Windows users are on your own. Good luck with that.
 
 
== INSTALL
 
  sudo gem install patron
 
 
Copyright (c) 2008 The Hive