dhis2 2.1.0 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed649a064de87ceea944479aa82f20e239e912ee
4
- data.tar.gz: 862e2be603b90d7da556faae38ba8df02ee51759
3
+ metadata.gz: a392c3f988989d0b3f6e14785464d5abba279cc3
4
+ data.tar.gz: 35acd3072f5a4ebdd7d47a136eb12e14dd5beade
5
5
  SHA512:
6
- metadata.gz: 5ccb72a75795cd3c0e9d1b863ea25c93181410d09cf03dacafebe19b25c84a99defc1da3aaee01236b61f530f9381b4c177a2cb2c9ae608d7d046cf9cb0c9f39
7
- data.tar.gz: 82a608fd72682b034e53b4df5107474ea4b89b14bc93968829398b55499f2abfa05afd7bedded231be603bff9697c33195087ee63fe49eb2694fd48c79224bc5
6
+ metadata.gz: 79ac47b20d744f9cfa6e24b0dc23fc8bd923213d3aa358f22f48c2b544e807cf17cbfe7cc98378edd6072f7c6183f251cbc42c9ad5059c568b7829b02f73a453
7
+ data.tar.gz: 04a31d19f9097937e350fe6f29ec674cbcdcd8381d82deda6cc279f69670b19632a089d1509e32de3364b33d50b6194cec920a0acbfc7f59013f29e90109acc0
@@ -40,13 +40,8 @@ module Dhis2
40
40
 
41
41
  payload = {
42
42
  organisationUnits: orgunits.map do |orgunit|
43
- organisation_unit = {
44
- name: orgunit[:name],
45
- short_name: orgunit[:short_name],
46
- opening_date: orgunit[:opening_date]
47
- }
48
- organisation_unit[:parent] = {id: orgunit[:parent_id]} if orgunit[:parent_id]
49
- organisation_unit
43
+ orgunit[:parent] = { id: orgunit[:parent_id] } if orgunit[:parent_id]
44
+ orgunit
50
45
  end
51
46
  }
52
47
 
@@ -12,22 +12,23 @@ module Dhis2
12
12
  summary["status"] == "SUCCESS"
13
13
  end
14
14
  end
15
- @raw_status["status"] == "SUCCESS"
16
- end
17
-
18
- def import_count
19
- @raw_status["import_count"]
15
+ ["SUCCESS", "OK"].include?(@raw_status["status"])
20
16
  end
21
17
 
22
18
  def total_imported
23
19
  total = 0
24
- import_count.each do |_, count|
25
- total += count
20
+ if @raw_status["import_count"]
21
+ @raw_status["import_count"].each do |_, count|
22
+ total += count
23
+ end
24
+ elsif @raw_status["type_reports"]
25
+ total += @raw_status["type_reports"].first["stats"]["total"]
26
26
  end
27
27
  total
28
28
  end
29
29
 
30
30
  def last_imported_ids
31
+ return [] unless @raw_status["import_type_summaries"]
31
32
  @raw_status["import_type_summaries"].map { |summary| summary["last_imported"] }
32
33
  end
33
34
  end
@@ -1,3 +1,3 @@
1
1
  module Dhis2
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhis2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Van Aken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-06 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client