idempotent-request 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/idempotent-request/redis_storage.rb +4 -0
- data/lib/idempotent-request/request_manager.rb +11 -2
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cebd804243368dfc14a6199bd3d51f40ebaa149cf697e1793a63f6559f2de23
|
4
|
+
data.tar.gz: 0a9082b74528e9fb15a5fe8981755d004cc325d9a8fa9373acd94352b62335a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5917e4b4f23d74fa2bfcc4b5a2faef9c140a3b77f8b69c63b8d0cac10dab638bbe3b04d842b0a6a8ec54350251717f72a41004078d30d3c53bf7f229def6188
|
7
|
+
data.tar.gz: 9bb5f2d94fc04a58fcd6118312622eaa7211c189461a4dd28491b0b433b8a90b22a7fcfa9c21a499239e76cf59cea6f8aab4a05198fd2cc808c8d7b441d4e21d
|
@@ -12,6 +12,10 @@ module IdempotentRequest
|
|
12
12
|
storage.lock(key)
|
13
13
|
end
|
14
14
|
|
15
|
+
def unlock
|
16
|
+
storage.unlock(key)
|
17
|
+
end
|
18
|
+
|
15
19
|
def read
|
16
20
|
status, headers, response = parse_data(storage.read(key)).values
|
17
21
|
|
@@ -23,8 +27,13 @@ module IdempotentRequest
|
|
23
27
|
def write(*data)
|
24
28
|
status, headers, response = data
|
25
29
|
response = response.body if response.respond_to?(:body)
|
26
|
-
|
27
|
-
|
30
|
+
|
31
|
+
if (200..226).cover?(status)
|
32
|
+
storage.write(key, payload(status, headers, response))
|
33
|
+
else
|
34
|
+
unlock
|
35
|
+
end
|
36
|
+
|
28
37
|
data
|
29
38
|
end
|
30
39
|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idempotent-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Zakharov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|