README.rdoc in log-me-0.0.8 vs README.rdoc in log-me-0.0.9
- old
+ new
@@ -1,10 +1,10 @@
= LogMe
A simple way to configure log in your gem.
-LogMe is especially useful when you need to log Web Service calls or HTTP requests and responses (using Net::HTTP).
+LogMe is especially useful when you need to log Web Service calls or HTTP requests and responses, using Net::HTTP or RestClient.
{<img src="https://badge.fury.io/rb/log-me.png" alt="Gem Version" />}[http://badge.fury.io/rb/log-me]
{<img src="https://travis-ci.org/prodis/log-me.png?branch=master" alt="Build Status" />}[https://travis-ci.org/prodis/log-me]
{<img src="https://coveralls.io/repos/prodis/log-me/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/prodis/log-me]
{<img src="https://codeclimate.com/github/prodis/log-me.png" alt="Code Climate" />}[https://codeclimate.com/github/prodis/log-me]
@@ -55,9 +55,33 @@
CoolGem.log_request request, url
# Some logic to obtain a Net::HTTP response.
response = do_request(request, url)
CoolGem.log_response response
+
+ response
+ end
+ end
+ end
+
+ ws = CoolGem::WebService.new
+ ws.do_something
+
+Logging RestClient requests and responses:
+ module CoolGem
+ class WebService
+ def do_something
+ args = {
+ method: :post,
+ url: "http://prodis.blog.br",
+ payload: 'param1=value1¶m2=value2'
+ }
+
+ RestClient::Request.execute(args) do |response, request, result|
+ CoolGem.log_request request, args[:url]
+ CoolGem.log_response result
+ response
+ end
end
end
end
ws = CoolGem::WebService.new