restfully 0.8.5 → 0.8.6

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.
@@ -49,6 +49,9 @@ BANNER
49
49
  logger.level = original_logger_level
50
50
  @options["logger"] = logger
51
51
  end
52
+ opts.on("--no-cache", "Disable client-side caching") do |v|
53
+ @options["cache"] = false
54
+ end
52
55
  opts.on("-v", "--verbose", "Run verbosely") do |v|
53
56
  @options["logger"].level = Logger::INFO
54
57
  end
@@ -161,7 +161,7 @@ module Restfully
161
161
  i = 0
162
162
  parent['id'] = i.to_s
163
163
  dump_object(object[0], parent)
164
- object[1..-1].each{|item|
164
+ (object[1..-1] || []).each{|item|
165
165
  i+=1
166
166
  node = XML::Node.new(parent.name)
167
167
  node['id'] = i.to_s
@@ -71,7 +71,7 @@ module Restfully
71
71
 
72
72
  disable RestClient::Rack::Compatibility
73
73
  authenticate(@config)
74
- setup_cache((@config.delete(:cache) || {}).symbolize_keys)
74
+ setup_cache(@config.delete(:cache))
75
75
 
76
76
  yield root, self if block_given?
77
77
  end
@@ -186,7 +186,10 @@ module Restfully
186
186
 
187
187
  protected
188
188
  def setup_cache(options = {})
189
- opts = {:verbose => (logger.level <= Logger::INFO)}.merge(options)
189
+ return if options == false
190
+ opts = {:verbose => (logger.level <= Logger::INFO)}.merge(
191
+ (options || {}).symbolize_keys
192
+ )
190
193
  enable ::Rack::Cache, opts
191
194
  end
192
195
 
@@ -1,3 +1,3 @@
1
1
  module Restfully
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
@@ -52,6 +52,13 @@ describe Restfully::Session do
52
52
  :entitystore => 'file:/var/cache/rack/body'
53
53
  }]]]
54
54
  end
55
+
56
+ it "should disable the clietn-side cache if given :no_cache" do
57
+ session = Restfully::Session.new(@config.merge({
58
+ :cache => false
59
+ }))
60
+ RestClient.components.should == []
61
+ end
55
62
  end
56
63
 
57
64
  it "should fetch the root path [no URI path]" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restfully
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 5
10
- version: 0.8.5
9
+ - 6
10
+ version: 0.8.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Rohr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-17 00:00:00 +02:00
18
+ date: 2011-06-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency