rest-client-components 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd1cc995e369066b6686c91d17cf68c1ea59f07c
4
- data.tar.gz: 7c62b70ec84a6c420b3731faeaf4d774676ae90a
3
+ metadata.gz: f7699627b62f66d04bd42c9de6ae5280bf29995a
4
+ data.tar.gz: aa01f906645dcac141c504964a55d9c872b3808d
5
5
  SHA512:
6
- metadata.gz: 23f8f1859e018cb09bd7feeed978e26e6224ee988113ee35ea325481f5ad011a5161862d289d8f5e97bedd14e35ef0762998ff98360075d9b62e3f1a5684bfd7
7
- data.tar.gz: 10c77068694bad651be3e3248c1f98b8dc40f7befbe2c53e7f2d491e2c1e8740d6eadfebb99c5f9e8c1d9123d2945dcfe62505eff65df89456b69ccc28f52530
6
+ metadata.gz: cbbd3251a190706d7d36a2537894d77bc377e96319bb44984bdcdc936bbdce81cbf5af4465f764b140539777d1b76a60cc5c6e5fffb8dd9ea3e6a0356f3506e2
7
+ data.tar.gz: 9e86f4fa99f894a38dcbd3d85c83970d2eb7e220687fa9dacdccf018bc30cfa383b931e5e36a482de3d60c66aab815596ebd2be043d9236c94fc0db85558ae49
@@ -34,6 +34,7 @@ See the examples folder for more details.
34
34
  = Installation
35
35
 
36
36
  gem install rest-client-components
37
+ gem install rack-cache # if you want to use Rack::Cache
37
38
 
38
39
  = Usage
39
40
  Example with Rack::Cache, and Rack::CommonLogger
data/Rakefile CHANGED
@@ -9,15 +9,16 @@ begin
9
9
  s.homepage = "http://github.com/crohr/rest-client-components"
10
10
  s.description = "RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc."
11
11
  s.authors = ["Cyril Rohr"]
12
- s.add_dependency "rest-client", ">= 1.6.0", "< 1.7.0"
12
+ s.add_dependency "rest-client", ">= 1.6.0"
13
13
  s.add_dependency "rack", ">= 1.0.1"
14
- s.add_development_dependency "webmock"
14
+ s.add_development_dependency "webmock", ">= 1.21"
15
+ s.add_development_dependency "rspec", ">= 3.2.0"
15
16
  end
16
17
  rescue LoadError
17
18
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
19
  end
19
20
 
20
- require 'rake/rdoctask'
21
+ require 'rdoc/task'
21
22
  Rake::RDocTask.new do |rdoc|
22
23
  rdoc.rdoc_dir = 'rdoc'
23
24
  rdoc.title = 'rest-client-components'
@@ -26,11 +27,10 @@ Rake::RDocTask.new do |rdoc|
26
27
  rdoc.rdoc_files.include('lib/**/*.rb')
27
28
  end
28
29
 
29
- require 'spec/rake/spectask'
30
- Spec::Rake::SpecTask.new(:spec) do |t|
31
- t.libs << 'lib' << 'spec'
32
- t.spec_files = FileList['spec/**/*_spec.rb']
30
+ begin
31
+ require 'rspec/core/rake_task'
32
+ RSpec::Core::RakeTask.new(:spec)
33
+ rescue LoadError
33
34
  end
34
35
 
35
-
36
36
  task :default => :spec
@@ -13,7 +13,10 @@ module RestClient
13
13
  net_http_response = RestClient::MockNetHTTPResponse.new(body, status, header)
14
14
  content = ""
15
15
  net_http_response.body.each{|line| content << line}
16
- response = RestClient::Response.create(content, net_http_response, {})
16
+ response = case RestClient::Response.method(:create).arity
17
+ when 4 then RestClient::Response.create(content, net_http_response, {}, self)
18
+ else RestClient::Response.create(content, net_http_response, {})
19
+ end
17
20
  if block = env['restclient.hash'][:block]
18
21
  block.call(response)
19
22
  # only raise error if response is not successful
@@ -113,7 +116,7 @@ module RestClient
113
116
  "rack.multithread" => true,
114
117
  "rack.multiprocess" => true,
115
118
  "rack.url_scheme" => uri.scheme,
116
- "rack.input" => payload || StringIO.new,
119
+ "rack.input" => payload || StringIO.new().set_encoding("ASCII-8BIT"),
117
120
  "rack.errors" => $stderr
118
121
  }
119
122
  @processed_headers.each do |key, value|
@@ -1,64 +1,59 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: rest-client-components 1.3.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
- s.name = %q{rest-client-components}
8
- s.version = "1.3.0"
8
+ s.name = "rest-client-components"
9
+ s.version = "1.4.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Cyril Rohr"]
12
- s.date = %q{2010-07-22}
13
- s.description = %q{RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc.}
14
- s.email = %q{cyril.rohr@gmail.com}
14
+ s.date = "2015-04-03"
15
+ s.description = "RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc."
16
+ s.email = "cyril.rohr@gmail.com"
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE",
17
- "README.rdoc"
19
+ "README.rdoc"
18
20
  ]
19
21
  s.files = [
20
22
  "LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "examples/beautify_html.rb",
25
- "examples/caching.rb",
26
- "examples/parsing.rb",
27
- "lib/restclient/components.rb",
28
- "rest-client-components.gemspec",
29
- "spec/components_spec.rb",
30
- "spec/spec_helper.rb"
31
- ]
32
- s.homepage = %q{http://github.com/crohr/rest-client-components}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
36
- s.summary = %q{RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc.}
37
- s.test_files = [
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "examples/beautify_html.rb",
27
+ "examples/caching.rb",
28
+ "examples/parsing.rb",
29
+ "lib/restclient/components.rb",
30
+ "rest-client-components.gemspec",
38
31
  "spec/components_spec.rb",
39
- "spec/spec_helper.rb",
40
- "examples/beautify_html.rb",
41
- "examples/caching.rb",
42
- "examples/parsing.rb"
32
+ "spec/spec_helper.rb"
43
33
  ]
34
+ s.homepage = "http://github.com/crohr/rest-client-components"
35
+ s.rubygems_version = "2.4.5"
36
+ s.summary = "RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc."
44
37
 
45
38
  if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
- s.specification_version = 3
39
+ s.specification_version = 4
48
40
 
49
41
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
42
  s.add_runtime_dependency(%q<rest-client>, [">= 1.6.0"])
51
43
  s.add_runtime_dependency(%q<rack>, [">= 1.0.1"])
52
- s.add_development_dependency(%q<webmock>, [">= 0"])
44
+ s.add_development_dependency(%q<webmock>, [">= 1.21"])
45
+ s.add_development_dependency(%q<rspec>, [">= 3.2.0"])
53
46
  else
54
47
  s.add_dependency(%q<rest-client>, [">= 1.6.0"])
55
48
  s.add_dependency(%q<rack>, [">= 1.0.1"])
56
- s.add_dependency(%q<webmock>, [">= 0"])
49
+ s.add_dependency(%q<webmock>, [">= 1.21"])
50
+ s.add_dependency(%q<rspec>, [">= 3.2.0"])
57
51
  end
58
52
  else
59
53
  s.add_dependency(%q<rest-client>, [">= 1.6.0"])
60
54
  s.add_dependency(%q<rack>, [">= 1.0.1"])
61
- s.add_dependency(%q<webmock>, [">= 0"])
55
+ s.add_dependency(%q<webmock>, [">= 1.21"])
56
+ s.add_dependency(%q<rspec>, [">= 3.2.0"])
62
57
  end
63
58
  end
64
59
 
@@ -13,7 +13,7 @@ describe "Components for RestClient" do
13
13
  end
14
14
  it "should enable components" do
15
15
  RestClient.enable Rack::Cache, :key => "value"
16
- RestClient.enabled?(Rack::Cache).should be_true
16
+ RestClient.enabled?(Rack::Cache).should be_truthy
17
17
  RestClient.components.first.should == [Rack::Cache, [{:key => "value"}]]
18
18
  RestClient.enable Rack::CommonLogger
19
19
  RestClient.components.length.should == 3
@@ -44,7 +44,7 @@ describe "Components for RestClient" do
44
44
  stub_request(:get, "http://server.ltd/resource").to_return(:status => 200, :body => "body", :headers => {'Content-Length' => 4, 'Content-Type' => 'text/plain'})
45
45
  lambda{ RestClient.get "http://server.ltd/resource" do |response|
46
46
  raise Exception.new(response.code)
47
- end}.should raise_error(Exception, 200)
47
+ end}.should raise_error(Exception, "200")
48
48
  end
49
49
  it "should correctly use the response.return! helper" do
50
50
  stub_request(:get, "http://server.ltd/resource").to_return(:status => 404, :body => "body", :headers => {'Content-Length' => 4, 'Content-Type' => 'text/plain'})
@@ -150,7 +150,7 @@ describe "Components for RestClient" do
150
150
  stub_request(:get, "http://server.ltd/resource").to_return(:status => 200, :body => "body", :headers => {'Content-Type' => 'text/plain', 'Content-Length' => 4})
151
151
  lambda{RestClient.get "http://server.ltd/resource" do |response|
152
152
  raise Exception.new(response.class)
153
- end}.should raise_error(Exception, Array)
153
+ end}.should raise_error(Exception, "Array")
154
154
  end
155
155
  it "should return response as an array of status, headers, body if response block is used" do
156
156
  stub_request(:get, "http://server.ltd/resource").to_return(:status => 200, :body => "body", :headers => {'Content-Type' => 'text/plain', 'Content-Length' => 4})
@@ -1,11 +1,9 @@
1
1
  require 'rubygems'
2
- require 'spec'
2
+ require 'rspec'
3
3
  require 'webmock/rspec'
4
4
 
5
- include WebMock
6
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
6
 
8
-
9
- Spec::Runner.configure do |config|
7
+ RSpec.configure do |config|
10
8
 
11
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-client-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Rohr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2010-07-22 00:00:00.000000000 Z
11
+ date: 2015-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -44,14 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.21'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.21'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.0
55
69
  description: RestClient on steroids ! Easily add one or more Rack middleware around
56
70
  RestClient to add functionalities such as transparent caching (Rack::Cache), transparent
57
71
  logging, etc.
@@ -77,8 +91,7 @@ homepage: http://github.com/crohr/rest-client-components
77
91
  licenses: []
78
92
  metadata: {}
79
93
  post_install_message:
80
- rdoc_options:
81
- - "--charset=UTF-8"
94
+ rdoc_options: []
82
95
  require_paths:
83
96
  - lib
84
97
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -95,14 +108,9 @@ requirements: []
95
108
  rubyforge_project:
96
109
  rubygems_version: 2.2.2
97
110
  signing_key:
98
- specification_version: 3
111
+ specification_version: 4
99
112
  summary: RestClient on steroids ! Easily add one or more Rack middleware around RestClient
100
113
  to add functionalities such as transparent caching (Rack::Cache), transparent logging,
101
114
  etc.
102
- test_files:
103
- - spec/components_spec.rb
104
- - spec/spec_helper.rb
105
- - examples/beautify_html.rb
106
- - examples/caching.rb
107
- - examples/parsing.rb
115
+ test_files: []
108
116
  has_rdoc: