auser-rest-client 1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -31,7 +31,7 @@ require 'rake/gempackagetask'
31
31
  require 'rake/rdoctask'
32
32
  require 'fileutils'
33
33
 
34
- version = "1.0"
34
+ version = "1.0.1"
35
35
  name = "rest-client"
36
36
 
37
37
  spec = Gem::Specification.new do |s|
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/mixin/response'
2
+
3
+ module RestClient
4
+ # The response from RestClient on a raw request looks like a string, but is
5
+ # actually one of these. 99% of the time you're making a rest call all you
6
+ # care about is the body, but on the occassion you want to fetch the
7
+ # headers you can:
8
+ #
9
+ # RestClient.get('http://example.com').headers[:content_type]
10
+ #
11
+ # In addition, if you do not use the response as a string, you can access
12
+ # a Tempfile object at res.file, which contains the path to the raw
13
+ # downloaded request body.
14
+ class RawResponse
15
+ include RestClient::Mixin::Response
16
+
17
+ attr_reader :file
18
+
19
+ def initialize(tempfile, net_http_res)
20
+ @net_http_res = net_http_res
21
+ @file = tempfile
22
+ end
23
+
24
+ def to_s
25
+ @file.open
26
+ @file.read
27
+ end
28
+
29
+ end
30
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rest-client"
3
- s.version = "1.0"
3
+ s.version = "1.0.1"
4
4
  s.summary = "Simple REST client for Ruby, inspired by microframework syntax for specifying actions."
5
5
  s.description = "A simple REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete."
6
6
  s.author = "Adam Wiggins"
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  lib/rest_client.rb lib/restclient.rb lib/restclient/mixin/response.rb
14
14
  lib/restclient/request.rb lib/restclient/response.rb
15
15
  lib/restclient/exceptions.rb lib/restclient/resource.rb
16
+ lib/restclient/mixin/response.rb lib/restclient/raw_response.rb
16
17
  spec/base.rb spec/request_spec.rb spec/response_spec.rb
17
18
  spec/exceptions_spec.rb spec/resource_spec.rb spec/restclient_spec.rb
18
19
  bin/restclient)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-rest-client
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wiggins
@@ -32,6 +32,7 @@ files:
32
32
  - lib/restclient/response.rb
33
33
  - lib/restclient/exceptions.rb
34
34
  - lib/restclient/resource.rb
35
+ - lib/restclient/raw_response.rb
35
36
  - spec/base.rb
36
37
  - spec/request_spec.rb
37
38
  - spec/response_spec.rb