rest-client-components 1.0.0 → 1.1.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.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ 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.3.1"
12
+ s.add_dependency "rest-client", ">= 1.4.1"
13
13
  s.add_dependency "rack", ">= 1.0.1"
14
14
  s.add_development_dependency "webmock"
15
15
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'couchrest'
3
+ RestClient.log = STDERR
4
+
5
+ scenario = lambda {
6
+ db = CouchRest.database!("http://localhost:5984/tmp")
7
+
8
+ doc = db.save_doc :hello => "hi"
9
+ # => {"rev"=>"1-3835293079", "id"=>"0edfc8680eaf6d62f9e18eee8492fa8f", "ok"=>true}
10
+
11
+ p db.get doc["id"]
12
+
13
+ db.get doc["id"]
14
+
15
+ db.update_doc :hello => "hi 2"
16
+
17
+ p db.get doc["id"]
18
+ }
19
+
20
+ puts "*** Scenario without components"
21
+ scenario.call
22
+
23
+ require File.dirname(__FILE__)+"/../lib/restclient/components"
24
+ require 'rack/cache'
25
+
26
+ puts "*** Scenario with caching support"
27
+ RestClient.enable Rack::Cache
28
+ scenario.call
@@ -13,7 +13,7 @@ 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.new(content, net_http_response)
16
+ response = RestClient::Response.new(content, net_http_response, {})
17
17
  if block = env['restclient.hash'][:block]
18
18
  block.call(response)
19
19
  # only raise error if response is not successful
@@ -1,15 +1,15 @@
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 the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rest-client-components}
8
- s.version = "1.0.0"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cyril Rohr"]
12
- s.date = %q{2010-03-05}
12
+ s.date = %q{2010-03-10}
13
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
14
  s.email = %q{cyril.rohr@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
  "spec/spec_helper.rb",
40
40
  "examples/beautify_html.rb",
41
41
  "examples/caching.rb",
42
+ "examples/couchrest-example.rb",
42
43
  "examples/parsing.rb"
43
44
  ]
44
45
 
@@ -47,16 +48,16 @@ Gem::Specification.new do |s|
47
48
  s.specification_version = 3
48
49
 
49
50
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<rest-client>, [">= 1.3.1"])
51
+ s.add_runtime_dependency(%q<rest-client>, [">= 1.4.1"])
51
52
  s.add_runtime_dependency(%q<rack>, [">= 1.0.1"])
52
53
  s.add_development_dependency(%q<webmock>, [">= 0"])
53
54
  else
54
- s.add_dependency(%q<rest-client>, [">= 1.3.1"])
55
+ s.add_dependency(%q<rest-client>, [">= 1.4.1"])
55
56
  s.add_dependency(%q<rack>, [">= 1.0.1"])
56
57
  s.add_dependency(%q<webmock>, [">= 0"])
57
58
  end
58
59
  else
59
- s.add_dependency(%q<rest-client>, [">= 1.3.1"])
60
+ s.add_dependency(%q<rest-client>, [">= 1.4.1"])
60
61
  s.add_dependency(%q<rack>, [">= 1.0.1"])
61
62
  s.add_dependency(%q<webmock>, [">= 0"])
62
63
  end
@@ -111,7 +111,7 @@ describe "Components for RestClient" do
111
111
  RestClient.get "http://server.ltd/resource" do |response|
112
112
  response.code.should == 200
113
113
  response.headers[:x_rack_cache].should == 'miss'
114
- response.to_s.should == "body"
114
+ response.body.should == "body"
115
115
  end
116
116
  end
117
117
  it "should get cached" do
@@ -122,13 +122,13 @@ describe "Components for RestClient" do
122
122
  RestClient.get "http://server.ltd/resource" do |response|
123
123
  response.headers[:x_rack_cache].should == 'miss, store'
124
124
  response.headers[:age].should == "0"
125
- response.to_s.should == "body"
125
+ response.body.should == "body"
126
126
  end
127
127
  sleep 1
128
128
  RestClient.get "http://server.ltd/resource" do |response|
129
129
  response.headers[:x_rack_cache].should == 'stale, valid, store'
130
130
  response.headers[:age].should == "1"
131
- response.to_s.should == "body"
131
+ response.body.should == "body"
132
132
  end
133
133
  end
134
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-client-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Rohr
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-05 00:00:00 +01:00
12
+ date: 2010-03-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.3.1
23
+ version: 1.4.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack
@@ -96,4 +96,5 @@ test_files:
96
96
  - spec/spec_helper.rb
97
97
  - examples/beautify_html.rb
98
98
  - examples/caching.rb
99
+ - examples/couchrest-example.rb
99
100
  - examples/parsing.rb