reviewed 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/faraday/cache.rb +3 -2
- data/lib/reviewed/version.rb +1 -1
- data/spec/faraday/cache_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571f18f181a7c3d85e77d20ee542088bcb4368bf
|
4
|
+
data.tar.gz: 019fc1a4e87ba8d0d39ccec6386faaf33f89b0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f4c6b6b515a849e3b33abc084d1ea9bf1aaef6c93f570b72eba38e677ced21ce67f25ff9d0817991d43984b3c1d8d620245149241a73a61a65725895996535e
|
7
|
+
data.tar.gz: 068bea025cada9fcee782507522105b5e36352d9915989517448e217e4d8d6ce6d8fe7648bf42192de8e22c35b887e5546c5c5dc66d6e3d56e68c869e5defd2c
|
data/lib/faraday/cache.rb
CHANGED
@@ -13,7 +13,8 @@ module Faraday
|
|
13
13
|
|
14
14
|
def call(env)
|
15
15
|
@url = env[:url]
|
16
|
-
|
16
|
+
|
17
|
+
@website_id = env[:request_headers]['x-reviewed-website']
|
17
18
|
|
18
19
|
if serve_from_cache && store.exist?(cache_key)
|
19
20
|
Hashie::Mash.new(Marshal.load( store.read(cache_key) ))
|
@@ -38,7 +39,7 @@ module Faraday
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def cache_key
|
41
|
-
[@
|
42
|
+
[@website_id, @url.request_uri].join(':')
|
42
43
|
end
|
43
44
|
|
44
45
|
def write_options
|
data/lib/reviewed/version.rb
CHANGED
data/spec/faraday/cache_spec.rb
CHANGED
@@ -13,20 +13,20 @@ describe Faraday::Cache do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
conn.headers = { "X-Reviewed-
|
16
|
+
conn.headers = { "X-Reviewed-Website" => 'f0000123' }
|
17
17
|
|
18
18
|
it "caches anything that doesn't have skip-cache or reset-cache" do
|
19
19
|
mock_cache_val = mock
|
20
20
|
Marshal.stub(:dump).with(hash_including(:body => 'I like turtles')).and_return(mock_cache_val)
|
21
|
-
Reviewed::Cache.store.should_receive(:write).with("
|
21
|
+
Reviewed::Cache.store.should_receive(:write).with("f0000123:/articles", mock_cache_val, anything)
|
22
22
|
conn.get('/articles')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "can cache more than one thing" do
|
26
26
|
mock_cache_val = mock
|
27
27
|
Marshal.stub(:dump => mock_cache_val)
|
28
|
-
Reviewed::Cache.store.should_receive(:write).with("
|
29
|
-
Reviewed::Cache.store.should_receive(:write).with("
|
28
|
+
Reviewed::Cache.store.should_receive(:write).with("f0000123:/articles", mock_cache_val, anything)
|
29
|
+
Reviewed::Cache.store.should_receive(:write).with("f0000123:/products", mock_cache_val, anything)
|
30
30
|
|
31
31
|
conn.get('/articles')
|
32
32
|
conn.get('/products')
|
@@ -35,7 +35,7 @@ describe Faraday::Cache do
|
|
35
35
|
it "serves responses from the cache when fresh and does not call the app" do
|
36
36
|
marshalled_response = Marshal.dump(body: 'old musty response')
|
37
37
|
Reviewed::Cache.store.stub(:exist? => true)
|
38
|
-
Reviewed::Cache.store.should_receive(:read).with("
|
38
|
+
Reviewed::Cache.store.should_receive(:read).with("f0000123:/articles").and_return(marshalled_response)
|
39
39
|
resp = conn.get '/articles'
|
40
40
|
resp[:body].should eq("old musty response")
|
41
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reviewed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Plante
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|