flexirest 1.4.9 → 1.5.0

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: fb5d697d79a1b6068d551ea5346b87d83189eaad
4
- data.tar.gz: 727a87951be313b214bcfd7d20a63eae1020e6b2
3
+ metadata.gz: 9f28de2c590cd7b7b1e6f697ee8a7754b2229dd1
4
+ data.tar.gz: 4a5e1f2611b17b356af7660225d9bb5851131a7d
5
5
  SHA512:
6
- metadata.gz: 2a2122e343b6ac01a63e2fb0b872f0e03a00d5fd7ee1337df1258bac60bcc2f6fa859e15e3df04ef6fe35ed5575165bbb5b2cd001f2adc32238f8f6449e75a7a
7
- data.tar.gz: a29e038eba07930db404505bcf59e0e7cb39f2e807eff1bfdc3fb8cbe64f1addb1fd7f1824f4815b1334c775864011c261d1fdbebce04907dbf22176531fe43e
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:
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.4.9"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -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,
@@ -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.9
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-06 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler