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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71da147141bb3c77dc79fa46d7b5560f526d958
4
- data.tar.gz: f812789b289ee63449e78eb4c12ee68d0a0d2aba
3
+ metadata.gz: eba48163a5c17f71ae1d80d6908d90354962f619
4
+ data.tar.gz: 923faca9229e6d4840ed3a069814ba3cda8e552c
5
5
  SHA512:
6
- metadata.gz: 9e6c8ca1e11f7e892bb305faf34925b1000fcf732b3a28be106697cce211a716eb409c9cc94c0fc96cab78adf71a109cb769ae8cbdb14263f6f19da190a5c5ae
7
- data.tar.gz: a5a9d2212a01ba5a5334e17233ce3188759e05dcc46c92ba154aec9bea0793b0ad397bf589ca0d9f53f81c34cd57f0fa87de388d5de7ed5107f9f2a5b91d6a7b
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
@@ -1,6 +1,6 @@
1
1
  [![Build Status](https://travis-ci.org/c42/wrest.svg?branch=master)](https://travis-ci.org/c42/wrest)
2
2
 
3
- # Wrest 2.1.3
3
+ # Wrest 2.1.4
4
4
 
5
5
  (c) Copyright 2009-2016 [Sidu Ponnappa](http://twitter.com/ponnappa). All Rights Reserved.
6
6
 
@@ -40,7 +40,7 @@ module Wrest
40
40
  end
41
41
 
42
42
  def get
43
- cached_response = @cache_store[@get.uri.to_s]
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.uri.uri_string] = response.clone if response && response.cacheable?
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.hash
69
+ @cache_store.delete @get.full_uri_string
70
70
 
71
71
  response = @get.invoke_without_cache_check
72
72
 
@@ -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
@@ -8,5 +8,5 @@
8
8
  # See the License for the specific language governing permissions and limitations under the License.
9
9
 
10
10
  module Wrest
11
- VERSION = "2.1.3"
11
+ VERSION = "2.1.4"
12
12
  end
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.3
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-25 00:00:00.000000000 Z
12
+ date: 2016-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec