dhis2 3.0.5 → 3.0.7
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 +5 -5
- data/.rubocop.yml +1 -5
- data/Guardfile +55 -0
- data/README.md +27 -28
- data/dhis2.gemspec +2 -0
- data/lib/dhis2/api/version226/index.rb +1 -0
- data/lib/dhis2/api/version226/legend_set.rb +12 -0
- data/lib/dhis2/api/version227/index.rb +1 -0
- data/lib/dhis2/api/version227/legend_set.rb +12 -0
- data/lib/dhis2/api/version228/index.rb +1 -0
- data/lib/dhis2/api/version228/legend_set.rb +12 -0
- data/lib/dhis2/classes.rb +1 -0
- data/lib/dhis2/client.rb +4 -0
- data/lib/dhis2/version.rb +1 -1
- metadata +35 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d795828a706adfbd50c6a2d3ef8276c70632012d
|
4
|
+
data.tar.gz: 14533e1ec21cf38a97c039035b86aa92d4e9b896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 069f4753a6cc52e6c553aadcb9438c48b823cc7ad0008e278e3ae4bf400a717eab941ebea3c4c2d41b54d75acd99ebbf0cae832cefdfe3728d3d2c05a4182fc7
|
7
|
+
data.tar.gz: 67cbdfa019cb8c5d3729df353371e2ca70a702b70279150ada10f6285e8fa00db5a6c6f6a42c8b0d50e7d003d8124e4ed2a111f5eedd74a085bf7ada65ae40e1
|
data/.rubocop.yml
CHANGED
@@ -25,16 +25,12 @@ AlignHash:
|
|
25
25
|
# a: 0
|
26
26
|
# bb: 1
|
27
27
|
EnforcedColonStyle: table
|
28
|
-
IfUnlessModifier:
|
29
|
-
MaxLineLength: 100
|
30
28
|
LineLength:
|
31
29
|
Max: 100
|
32
30
|
StringLiterals:
|
33
31
|
EnforcedStyle: double_quotes
|
34
|
-
WhileUntilModifier:
|
35
|
-
MaxLineLength: 100
|
36
32
|
MethodCalledOnDoEndBlock:
|
37
|
-
Description:
|
33
|
+
Description: "Avoid chaining a method call on a do...end block."
|
38
34
|
Enabled: true
|
39
35
|
ClassLength:
|
40
36
|
Max: 400
|
data/Guardfile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
4
|
+
# rspec may be run, below are examples of the most common uses.
|
5
|
+
# * bundler: 'bundle exec rspec'
|
6
|
+
# * bundler binstubs: 'bin/rspec'
|
7
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
8
|
+
# installed the spring binstubs per the docs)
|
9
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
10
|
+
# * 'just' rspec: 'rspec'
|
11
|
+
|
12
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
13
|
+
require "guard/rspec/dsl"
|
14
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
15
|
+
|
16
|
+
# Feel free to open issues for suggestions and improvements
|
17
|
+
|
18
|
+
# RSpec files
|
19
|
+
rspec = dsl.rspec
|
20
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
21
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
22
|
+
watch(rspec.spec_files)
|
23
|
+
|
24
|
+
# Ruby files
|
25
|
+
ruby = dsl.ruby
|
26
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
27
|
+
|
28
|
+
# Rails files
|
29
|
+
rails = dsl.rails(view_extensions: %w[erb haml slim])
|
30
|
+
dsl.watch_spec_files_for(rails.app_files)
|
31
|
+
dsl.watch_spec_files_for(rails.views)
|
32
|
+
|
33
|
+
watch(rails.controllers) do |m|
|
34
|
+
[
|
35
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
36
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
37
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Rails config changes
|
42
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
43
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
44
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
45
|
+
|
46
|
+
# Capybara features specs
|
47
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
48
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
49
|
+
|
50
|
+
# Turnip features and steps
|
51
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
52
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
53
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
54
|
+
end
|
55
|
+
end
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
The functionalities are available as a module. First thing you need to do is to connect to the instance:
|
32
32
|
|
33
|
-
|
33
|
+
- Global configuration (to call a single Dhis2 instance):
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
Dhis2.configure do |config|
|
@@ -49,7 +49,7 @@ end
|
|
49
49
|
::Dhis2.clientt.data_elements.list # => Array[<DataElement>,..]
|
50
50
|
```
|
51
51
|
|
52
|
-
|
52
|
+
- Local configuration: (in case you need to access different Dhis2 instances inside a single project):
|
53
53
|
|
54
54
|
```ruby
|
55
55
|
configuration = Dhis2::Configuration.new.tap do |config|
|
@@ -81,13 +81,12 @@ dangerous_configuration = Dhis2::Configuration.new.tap do |config|
|
|
81
81
|
end
|
82
82
|
```
|
83
83
|
|
84
|
-
|
84
|
+
- Not sure of your version? Check it
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
Dhis2.get_version({ user: 'admin', password: 'district', url: 'https://play.dhis2.org/demo'})
|
88
88
|
```
|
89
89
|
|
90
|
-
|
91
90
|
### Search for meta elements
|
92
91
|
|
93
92
|
All subsequent calls can be done on the objects themselves and are going to use the provided url and credentials
|
@@ -135,7 +134,7 @@ org_units.pager.total # number of records
|
|
135
134
|
|
136
135
|
It can be tedious to iterate over a paginated collection. Thus you can use `fetch_paginated_data` which will get all pages for you and yield each element automatically.
|
137
136
|
|
138
|
-
|
137
|
+
````ruby
|
139
138
|
Dhis2.client.organisation_units.fetch_paginated_data(
|
140
139
|
filter: "level:eq:2",
|
141
140
|
fields: %w(id level displayName parent)
|
@@ -162,7 +161,7 @@ You can also retreive a single element using its id with `find`(in this case, al
|
|
162
161
|
|
163
162
|
```ruby
|
164
163
|
ou = Dhis2.client.organisation_units.find(id)
|
165
|
-
|
164
|
+
````
|
166
165
|
|
167
166
|
`find` also accepts multiple ids - query will not be paginated and will return all fields for the given objects:
|
168
167
|
|
@@ -220,27 +219,28 @@ value_sets = Dhis2.client.data_value_sets.list(
|
|
220
219
|
|
221
220
|
The API is currently limited to actions on the following elements:
|
222
221
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
222
|
+
- `Analytic`
|
223
|
+
- `Attribute`
|
224
|
+
- `CategoryCombo`
|
225
|
+
- `CategoryOptionCombo`
|
226
|
+
- `DataElement`
|
227
|
+
- `DataElementGroup`
|
228
|
+
- `DataSet`
|
229
|
+
- `DataValue`
|
230
|
+
- `DataValueSet`
|
231
|
+
- `Events`
|
232
|
+
- `Indicator`
|
233
|
+
- `IndicatorGroup`
|
234
|
+
- `LegendSet` (Only list & find)
|
235
|
+
- `OrganisationUnit`
|
236
|
+
- `OrganisationUnitGroup`
|
237
|
+
- `OrganisationUnitLevel`
|
238
|
+
- `Program`
|
239
|
+
- `Report`
|
240
|
+
- `ReportTable`
|
241
|
+
- `ResourceTables`
|
242
|
+
- `SystemInfo`
|
243
|
+
- `User`
|
244
244
|
|
245
245
|
## Update
|
246
246
|
|
@@ -360,7 +360,6 @@ one time setup
|
|
360
360
|
gem install gem-release
|
361
361
|
curl -u rubygemaccount https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
|
362
362
|
chmod 0600 ~/.gem/credentials
|
363
|
-
|
364
363
|
```
|
365
364
|
|
366
365
|
```
|
data/dhis2.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "minitest-reporters"
|
28
28
|
spec.add_development_dependency "faker", "~> 1.6", ">= 1.6.3"
|
29
29
|
spec.add_development_dependency "byebug"
|
30
|
+
spec.add_development_dependency "guard"
|
31
|
+
spec.add_development_dependency "guard-rspec"
|
30
32
|
|
31
33
|
spec.add_development_dependency "rspec"
|
32
34
|
spec.add_development_dependency "webmock", "3.1.0"
|
@@ -16,6 +16,7 @@ require_relative "event"
|
|
16
16
|
require_relative "indicator"
|
17
17
|
require_relative "indicator_group"
|
18
18
|
require_relative "indicator_type"
|
19
|
+
require_relative "legend_set"
|
19
20
|
require_relative "organisation_unit"
|
20
21
|
require_relative "organisation_unit_group"
|
21
22
|
require_relative "organisation_unit_group_set"
|
@@ -16,6 +16,7 @@ require_relative "event"
|
|
16
16
|
require_relative "indicator"
|
17
17
|
require_relative "indicator_group"
|
18
18
|
require_relative "indicator_type"
|
19
|
+
require_relative "legend_set"
|
19
20
|
require_relative "organisation_unit"
|
20
21
|
require_relative "organisation_unit_group"
|
21
22
|
require_relative "organisation_unit_group_set"
|
@@ -16,6 +16,7 @@ require_relative "event"
|
|
16
16
|
require_relative "indicator"
|
17
17
|
require_relative "indicator_group"
|
18
18
|
require_relative "indicator_type"
|
19
|
+
require_relative "legend_set"
|
19
20
|
require_relative "organisation_unit"
|
20
21
|
require_relative "organisation_unit_group"
|
21
22
|
require_relative "organisation_unit_group_set"
|
data/lib/dhis2/classes.rb
CHANGED
@@ -33,6 +33,7 @@ module Dhis2
|
|
33
33
|
class Indicator < Versioned; end
|
34
34
|
class IndicatorGroup < Versioned; end
|
35
35
|
class IndicatorType < Versioned; end
|
36
|
+
class LegendSet < Versioned; end
|
36
37
|
class OrganisationUnit < Versioned; end
|
37
38
|
class OrganisationUnitGroup < Versioned; end
|
38
39
|
class OrganisationUnitGroupSet < Versioned; end
|
data/lib/dhis2/client.rb
CHANGED
@@ -91,6 +91,10 @@ module Dhis2
|
|
91
91
|
def indicator_types
|
92
92
|
@indicator_types ||= CollectionWrapper.new("IndicatorType", self)
|
93
93
|
end
|
94
|
+
|
95
|
+
def legend_sets
|
96
|
+
@legend_sets ||= CollectionWrapper.new("LegendSet", self)
|
97
|
+
end
|
94
98
|
|
95
99
|
def organisation_units
|
96
100
|
@organisation_units ||= CollectionWrapper.new("OrganisationUnit", self)
|
data/lib/dhis2/version.rb
CHANGED
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: 3.0.
|
4
|
+
version: 3.0.7
|
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:
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -100,6 +100,34 @@ dependencies:
|
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: guard
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: guard-rspec
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
132
|
name: rspec
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +199,7 @@ files:
|
|
171
199
|
- ".travis.yml"
|
172
200
|
- CODE_OF_CONDUCT.md
|
173
201
|
- Gemfile
|
202
|
+
- Guardfile
|
174
203
|
- LICENSE.txt
|
175
204
|
- README.md
|
176
205
|
- Rakefile
|
@@ -280,6 +309,7 @@ files:
|
|
280
309
|
- lib/dhis2/api/version226/indicator.rb
|
281
310
|
- lib/dhis2/api/version226/indicator_group.rb
|
282
311
|
- lib/dhis2/api/version226/indicator_type.rb
|
312
|
+
- lib/dhis2/api/version226/legend_set.rb
|
283
313
|
- lib/dhis2/api/version226/organisation_unit.rb
|
284
314
|
- lib/dhis2/api/version226/organisation_unit_group.rb
|
285
315
|
- lib/dhis2/api/version226/organisation_unit_group_set.rb
|
@@ -307,6 +337,7 @@ files:
|
|
307
337
|
- lib/dhis2/api/version227/indicator.rb
|
308
338
|
- lib/dhis2/api/version227/indicator_group.rb
|
309
339
|
- lib/dhis2/api/version227/indicator_type.rb
|
340
|
+
- lib/dhis2/api/version227/legend_set.rb
|
310
341
|
- lib/dhis2/api/version227/organisation_unit.rb
|
311
342
|
- lib/dhis2/api/version227/organisation_unit_group.rb
|
312
343
|
- lib/dhis2/api/version227/organisation_unit_group_set.rb
|
@@ -334,6 +365,7 @@ files:
|
|
334
365
|
- lib/dhis2/api/version228/indicator.rb
|
335
366
|
- lib/dhis2/api/version228/indicator_group.rb
|
336
367
|
- lib/dhis2/api/version228/indicator_type.rb
|
368
|
+
- lib/dhis2/api/version228/legend_set.rb
|
337
369
|
- lib/dhis2/api/version228/organisation_unit.rb
|
338
370
|
- lib/dhis2/api/version228/organisation_unit_group.rb
|
339
371
|
- lib/dhis2/api/version228/organisation_unit_group_set.rb
|
@@ -373,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
405
|
version: '0'
|
374
406
|
requirements: []
|
375
407
|
rubyforge_project:
|
376
|
-
rubygems_version: 2.
|
408
|
+
rubygems_version: 2.5.1
|
377
409
|
signing_key:
|
378
410
|
specification_version: 4
|
379
411
|
summary: Simple Ruby wrapper on DHIS2 API.
|