1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

Updated README to match with Response refactoring

This commit is contained in:
Julien Kirch 2010-02-01 18:12:21 +01:00
parent 6266f7aec6
commit a5a98b51df

View file

@ -63,7 +63,7 @@ See RestClient::Resource docs for details.
rescue => e rescue => e
e.response e.response
end end
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>..." 404 Resource Not Found | text/html 282 bytes
== Result handling == Result handling
@ -72,7 +72,7 @@ Response.return! can be called to invoke the default response's behavior (return
# Don't raise exceptions but return the response # Don't raise exceptions but return the response
RestClient.get('http://example.com/resource'){|response| response} RestClient.get('http://example.com/resource'){|response| response}
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>..." 404 Resource Not Found | text/html 282 bytes
# Manage a specific error code # Manage a specific error code
RestClient.get('http://my-rest-service.com/resource'){ |response| RestClient.get('http://my-rest-service.com/resource'){ |response|
@ -103,17 +103,17 @@ For cases not covered by the general API, you can use the RestClient::Resource c
The restclient shell command gives an IRB session with RestClient already loaded: The restclient shell command gives an IRB session with RestClient already loaded:
$ restclient $ restclient
RestClient.get 'http://example.com' >> RestClient.get 'http://example.com'
Specify a URL argument for get/post/put/delete on that resource: Specify a URL argument for get/post/put/delete on that resource:
$ restclient http://example.com $ restclient http://example.com
put '/resource', 'data' >> put '/resource', 'data'
Add a user and password for authenticated resources: Add a user and password for authenticated resources:
$ restclient https://example.com user pass $ restclient https://example.com user pass
delete '/private/resource' >> delete '/private/resource'
Create ~/.restclient for named sessions: Create ~/.restclient for named sessions: