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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1de9ce8b065035e396571cf0396b2d0beb56588
4
- data.tar.gz: f4bd8fc584c4495686effcd6927aaf6204d482bc
3
+ metadata.gz: 571f18f181a7c3d85e77d20ee542088bcb4368bf
4
+ data.tar.gz: 019fc1a4e87ba8d0d39ccec6386faaf33f89b0b0
5
5
  SHA512:
6
- metadata.gz: 816e6b5642535c84bced2d04d5ae7726d78fed9e78540d46946c5f20a2ef144a90674965e1526ea0a5475d4dc2918378f6b36c1c4544bc5e006832799a836210
7
- data.tar.gz: 1067fcf9eabdffeb858203df98969ed8a17d01b634b3de2a9207e9a3b17dfaddc128e1365b8fa33c57dcc3478649dd0e6f95fd7c12f35579708c16a615895dc4
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
- @auth_header = env[:request_headers]['X-Reviewed-Authorization']
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
- [@auth_header, @url.request_uri].join(':')
42
+ [@website_id, @url.request_uri].join(':')
42
43
  end
43
44
 
44
45
  def write_options
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  API_VERSION = 'v1'
4
4
  end
@@ -13,20 +13,20 @@ describe Faraday::Cache do
13
13
  end
14
14
  end
15
15
 
16
- conn.headers = { "X-Reviewed-Authorization" => TEST_KEY }
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("#{TEST_KEY}:/articles", mock_cache_val, anything)
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("#{TEST_KEY}:/articles", mock_cache_val, anything)
29
- Reviewed::Cache.store.should_receive(:write).with("#{TEST_KEY}:/products", mock_cache_val, anything)
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("#{TEST_KEY}:/articles").and_return(marshalled_response)
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.1
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-07-31 00:00:00.000000000 Z
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport