From 38952b38b7eb65559c1d10627c71e84e07683a88 Mon Sep 17 00:00:00 2001 From: Julien Kirch Date: Fri, 19 Mar 2010 20:30:26 +0100 Subject: [PATCH] adding a to_str and to_i to response for better compatibility --- lib/restclient/abstract_response.rb | 4 ++++ lib/restclient/response.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/restclient/abstract_response.rb b/lib/restclient/abstract_response.rb index 7944667..f07f924 100644 --- a/lib/restclient/abstract_response.rb +++ b/lib/restclient/abstract_response.rb @@ -63,6 +63,10 @@ module RestClient end end + def to_i + code + end + def inspect "#{code} #{STATUSES[code]} | #{(headers[:content_type] || '').gsub(/;.*$/, '')} #{size} bytes\n" end diff --git a/lib/restclient/response.rb b/lib/restclient/response.rb index f12539a..5ea4e8a 100644 --- a/lib/restclient/response.rb +++ b/lib/restclient/response.rb @@ -38,6 +38,10 @@ module RestClient body.to_s end + def to_str + body.to_str + end + def size body.size end