ecoportal-api 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ecoportal/api/common/batch_operation.rb +13 -15
- data/lib/ecoportal/api/common/response.rb +7 -2
- data/lib/ecoportal/api/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: 70979654188cd5e24e5456f4f2a668e5327faac08574388d9336123cca93ee6a
|
4
|
+
data.tar.gz: e04b913a265037f1e57b7d52d606fd662eed8352459f2751b5c9a74f0dadccf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc34740e68615fb0da65fe0c691b60af1a9c66f0b695d283645bb25757cbfecaef38b0f02dd19b9de280249b7e5e8e7ff62895fefe59cf6b8af0446844c68bb
|
7
|
+
data.tar.gz: 66a418368f6de049326e0fb7c3db9405acb57ecbbc8c2e3cc47b57aaf9212f8f0ec71be3958c2a03f2ce5607c306c8ed9ed2ec67b9709bdaf7b4a3f5f1c20563
|
data/Gemfile.lock
CHANGED
@@ -20,24 +20,22 @@ module Ecoportal
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def process_response(response)
|
23
|
-
|
24
|
-
response.body.each.with_index do |subresponse, idx|
|
25
|
-
next unless callback = @operations[idx][:callback]
|
23
|
+
raise "Total failure in batch operation" unless response.success?
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
method = @operations[idx][:method]
|
25
|
+
response.body.each.with_index do |subresponse, idx|
|
26
|
+
next unless callback = @operations[idx][:callback]
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
status = subresponse["status"]
|
29
|
+
body = subresponse["response"]
|
30
|
+
method = @operations[idx][:method]
|
31
|
+
|
32
|
+
if status == 200 && method == "GET"
|
33
|
+
batch_response = BatchResponse.new(status, body, @wrapper.new(body))
|
34
|
+
callback.call batch_response, batch_response.result
|
35
|
+
else
|
36
|
+
batch_response = BatchResponse.new(status, body)
|
37
|
+
callback.call batch_response
|
38
38
|
end
|
39
|
-
else
|
40
|
-
raise "Total failure in batch operation"
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
@@ -5,8 +5,13 @@ module Ecoportal
|
|
5
5
|
attr_reader :status, :body
|
6
6
|
def initialize(response)
|
7
7
|
@status = response.status
|
8
|
-
@body =
|
9
|
-
|
8
|
+
@body = [].tap do |body_data|
|
9
|
+
response.body.each do |chunk|
|
10
|
+
body_data << chunk
|
11
|
+
end
|
12
|
+
end.join("")
|
13
|
+
@body = JSON.parse(@body.to_s) rescue nil
|
14
|
+
response
|
10
15
|
end
|
11
16
|
def success?
|
12
17
|
@status.success?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tapio Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|