ecoportal-api 0.3.3 → 0.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c843c0e60dae847a8d25dfa7ece7415800ab6db094542225ffc36be691b3475e
4
- data.tar.gz: 7bdc9008eeacc38d6df779b0d553ab392ffb117816f1b849bd0b9831aa3ff43a
3
+ metadata.gz: 70979654188cd5e24e5456f4f2a668e5327faac08574388d9336123cca93ee6a
4
+ data.tar.gz: e04b913a265037f1e57b7d52d606fd662eed8352459f2751b5c9a74f0dadccf6
5
5
  SHA512:
6
- metadata.gz: c5d8a9cc96bd7dac8644e216109c94a28e46baf4d2c1decef356bdd11b5e78cfd96c50108bbfe8647e7318c8bbef76eeed3f1595e804395b8c11303b32c09f51
7
- data.tar.gz: 269031a257355f64b6ee725b12e4a7d118f8a9f29308701fb4ddecfa2b05f03a2d9c4a2bb6e85cab31f64f30a8c941de587c6b2de2b82bc69c207dab3ff5e310
6
+ metadata.gz: 3dc34740e68615fb0da65fe0c691b60af1a9c66f0b695d283645bb25757cbfecaef38b0f02dd19b9de280249b7e5e8e7ff62895fefe59cf6b8af0446844c68bb
7
+ data.tar.gz: 66a418368f6de049326e0fb7c3db9405acb57ecbbc8c2e3cc47b57aaf9212f8f0ec71be3958c2a03f2ce5607c306c8ed9ed2ec67b9709bdaf7b4a3f5f1c20563
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecoportal-api (0.1.11)
4
+ ecoportal-api (0.3.3)
5
5
  hash-polyfill (~> 0)
6
6
  http (~> 3)
7
7
 
@@ -20,24 +20,22 @@ module Ecoportal
20
20
  end
21
21
 
22
22
  def process_response(response)
23
- if response.success?
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
- status = subresponse["status"]
28
- body = subresponse["response"]
29
- method = @operations[idx][:method]
25
+ response.body.each.with_index do |subresponse, idx|
26
+ next unless callback = @operations[idx][:callback]
30
27
 
31
- if status == 200 && method == "GET"
32
- batch_response = BatchResponse.new(status, body, @wrapper.new(body))
33
- callback.call batch_response, batch_response.result
34
- else
35
- batch_response = BatchResponse.new(status, body)
36
- callback.call batch_response
37
- end
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 = JSON.parse(response.to_s) rescue nil
9
- response.flush
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?
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
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.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-09 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler