wrest 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/README.md +1 -1
- data/lib/wrest/cache_proxy.rb +3 -3
- data/lib/wrest/native/get.rb +12 -1
- data/lib/wrest/version.rb +1 -1
- 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: eba48163a5c17f71ae1d80d6908d90354962f619
|
4
|
+
data.tar.gz: 923faca9229e6d4840ed3a069814ba3cda8e552c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7214ebb98effc3ea21cf3c35042de4217805059cea871756712111960d853cdfd00f83544b726e48e4ff3c610fa6ee712bf81285f42642e3ce56484670c1962d
|
7
|
+
data.tar.gz: 07d5d2a7da790e6b3a05fadd43e54964df4be025dd44f27cbef1c833f3c5bae6e0935ff40e9e96483f20445638931dce5f0e359b7e237ff96f68752ba38d7442
|
data/CHANGELOG
CHANGED
@@ -2,6 +2,12 @@ Features under the section marked 'Current' are completed but pending release as
|
|
2
2
|
|
3
3
|
Features under a numbered section are complete and available in the Wrest gem.
|
4
4
|
|
5
|
+
== 2.1.4
|
6
|
+
* Making cache keys include query params
|
7
|
+
|
8
|
+
== 2.1.3
|
9
|
+
* Adding cache expiry for caches using request headers
|
10
|
+
|
5
11
|
== 2.1.2
|
6
12
|
* Setting cache keys as URI strings
|
7
13
|
|
data/README.md
CHANGED
data/lib/wrest/cache_proxy.rb
CHANGED
@@ -40,7 +40,7 @@ module Wrest
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def get
|
43
|
-
cached_response = @cache_store[@get.
|
43
|
+
cached_response = @cache_store[@get.full_uri_string]
|
44
44
|
return get_fresh_response if cached_response.nil?
|
45
45
|
|
46
46
|
if cached_response.expired?
|
@@ -61,12 +61,12 @@ module Wrest
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def cache(response)
|
64
|
-
@cache_store[@get.
|
64
|
+
@cache_store[@get.full_uri_string] = response.clone if response && response.cacheable?
|
65
65
|
end
|
66
66
|
|
67
67
|
#:nodoc:
|
68
68
|
def get_fresh_response
|
69
|
-
@cache_store.delete @get.
|
69
|
+
@cache_store.delete @get.full_uri_string
|
70
70
|
|
71
71
|
response = @get.invoke_without_cache_check
|
72
72
|
|
data/lib/wrest/native/get.rb
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
module Wrest::Native
|
10
10
|
class Get < Request
|
11
|
+
QUERY_PARAMS_SEPERATOR = '?'
|
12
|
+
EMPTY_QUERY_PARAMS = ''
|
11
13
|
|
12
14
|
attr_reader :cache_proxy
|
13
15
|
|
@@ -17,7 +19,7 @@ module Wrest::Native
|
|
17
19
|
|
18
20
|
cache_store = (options[:cache_store] || Wrest::Caching.default_store) unless options[:disable_cache]
|
19
21
|
@cache_proxy = Wrest::CacheProxy::new(self, cache_store)
|
20
|
-
|
22
|
+
|
21
23
|
super(
|
22
24
|
wrest_uri,
|
23
25
|
Net::HTTP::Get,
|
@@ -63,5 +65,14 @@ module Wrest::Native
|
|
63
65
|
new_request
|
64
66
|
end
|
65
67
|
|
68
|
+
def full_uri_string
|
69
|
+
@uri.to_s + query_params_string
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
def query_params_string
|
74
|
+
(@parameters.any?) ? QUERY_PARAMS_SEPERATOR + @parameters.to_query : EMPTY_QUERY_PARAMS
|
75
|
+
end
|
76
|
+
|
66
77
|
end
|
67
78
|
end
|
data/lib/wrest/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidu Ponnappa
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02-
|
12
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|