flexirest 1.4.9 → 1.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/flexirest/caching.rb +1 -1
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/caching_spec.rb +11 -0
- data/spec/lib/request_spec.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: 9f28de2c590cd7b7b1e6f697ee8a7754b2229dd1
|
4
|
+
data.tar.gz: 4a5e1f2611b17b356af7660225d9bb5851131a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f74bc929c9286f645fa652dfb8cace3ad70b463ca29272eb55a48b61ad1273239221c5ace8d10428c45423439fe64cf0675c19df3b66e6d2327900b92b9bb5
|
7
|
+
data.tar.gz: b1df82262931a447f99670d097dc662cac1b6c21733709640bea16d0133c4dbd143f3e792cfd4c88921ad3f95ba56d49ae874ea01a153a2424f41ea355d17984
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.5.0
|
4
|
+
|
5
|
+
Bugfix:
|
6
|
+
|
7
|
+
- GET requests with the same URL as PUT requests shouldn't use the etag cached version.
|
8
|
+
|
9
|
+
## 1.4.8/1.4.9
|
10
|
+
|
11
|
+
Bugfix:
|
12
|
+
|
13
|
+
- Responses without content (202, 204) will return an empty object.
|
14
|
+
|
3
15
|
## 1.4.7
|
4
16
|
|
5
17
|
Bugfix:
|
data/lib/flexirest/caching.rb
CHANGED
@@ -49,7 +49,7 @@ module Flexirest
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def read_cached_response(request)
|
52
|
-
if cache_store && perform_caching
|
52
|
+
if cache_store && perform_caching && request.method[:method] == :get
|
53
53
|
key = "#{request.class_name}:#{request.original_url}"
|
54
54
|
Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{key} - Trying to read from cache"
|
55
55
|
value = cache_store.read(key)
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/caching_spec.rb
CHANGED
@@ -119,6 +119,7 @@ describe Flexirest::Caching do
|
|
119
119
|
perform_caching true
|
120
120
|
base_url "http://www.example.com"
|
121
121
|
get :all, "/"
|
122
|
+
put :save_all, "/"
|
122
123
|
end
|
123
124
|
|
124
125
|
Person.cache_store = CachingExampleCacheStore5.new
|
@@ -141,6 +142,16 @@ describe Flexirest::Caching do
|
|
141
142
|
expect(ret.first_name).to eq("Johnny")
|
142
143
|
end
|
143
144
|
|
145
|
+
it "should not read from the cache store to check for an etag unless it's a GET request" do
|
146
|
+
cached_response = Flexirest::CachedResponse.new(
|
147
|
+
status:200,
|
148
|
+
result:@cached_object,
|
149
|
+
etag:@etag)
|
150
|
+
expect_any_instance_of(CachingExampleCacheStore5).to_not receive(:read)
|
151
|
+
expect_any_instance_of(Flexirest::Connection).to receive(:put).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, body: {result: "foo"}.to_json, response_headers:{})))
|
152
|
+
ret = Person.save_all
|
153
|
+
end
|
154
|
+
|
144
155
|
it 'queries the server when the cache has expired' do
|
145
156
|
cached_response = Flexirest::CachedResponse.new(
|
146
157
|
status: 200,
|
data/spec/lib/request_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe Flexirest::Request do
|
|
29
29
|
get :headers, "/headers"
|
30
30
|
put :headers_default, "/headers_default"
|
31
31
|
put :headers_json, "/headers_json", request_body_type: :json
|
32
|
-
get :find, "/:id"
|
32
|
+
get :find, "/:id", required: [:id]
|
33
33
|
get :change, "/change"
|
34
34
|
get :plain, "/plain/:id", plain: true
|
35
35
|
post :create, "/create"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexirest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|