dhis2 3.2.1 → 3.3.1
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 +654 -34
- data/.ruby-version +1 -1
- data/CODE_OF_CONDUCT.md +57 -30
- data/lib/dhis2.rb +1 -0
- data/lib/dhis2/api/shared/complete_data_set_registration.rb +50 -0
- data/lib/dhis2/api/shared/data_value_set.rb +9 -5
- data/lib/dhis2/api/version224/complete_data_set_registration.rb +11 -0
- data/lib/dhis2/api/version224/index.rb +1 -0
- data/lib/dhis2/api/version225/complete_data_set_registration.rb +11 -0
- data/lib/dhis2/api/version225/index.rb +1 -0
- data/lib/dhis2/api/version226/complete_data_set_registration.rb +11 -0
- data/lib/dhis2/api/version226/index.rb +1 -0
- data/lib/dhis2/api/version227/complete_data_set_registration.rb +11 -0
- data/lib/dhis2/api/version227/index.rb +1 -0
- data/lib/dhis2/api/version228/complete_data_set_registration.rb +11 -0
- data/lib/dhis2/api/version228/index.rb +1 -0
- data/lib/dhis2/classes.rb +1 -0
- data/lib/dhis2/client.rb +44 -13
- data/lib/dhis2/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c2b391f79e0cc6e6800f35c5f623a691b3ca3c93a910c81bca023ae9c72936a5
|
4
|
+
data.tar.gz: b32c25466bcccb444f47b72283253db06b791fd41c3882e77707f3fbe923f6b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba43f6023950c80d945340efa550827c1e85d4926796b8481319e995cea65bbe14e5c784453b9d93530e65b5aaf789e7e1ce956059990a9a6d2bf71c2dbc686
|
7
|
+
data.tar.gz: eff74022555c7bce7470fa4ea9b99b170e452360e46bb651bdafed024a6a5606a878b7e6eaadf0e98a71fd6385d03ef868aa2947d575014fdb3505beed4498ec
|
data/.rubocop.yml
CHANGED
@@ -1,38 +1,658 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- db/schema.rb
|
4
|
+
|
5
|
+
require:
|
6
|
+
- rubocop-rails
|
7
|
+
- rubocop-performance
|
8
|
+
|
9
|
+
Naming/AccessorMethodName:
|
10
|
+
Description: Check the naming of accessor methods for get_/set_.
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Style/Alias:
|
14
|
+
Description: "Use alias_method instead of alias."
|
15
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#alias-method"
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Style/ArrayJoin:
|
19
|
+
Description: "Use Array#join instead of Array#*."
|
20
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#array-join"
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/AsciiComments:
|
24
|
+
Description: "Use only ascii symbols in comments."
|
25
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#english-comments"
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Naming/AsciiIdentifiers:
|
29
|
+
Description: "Use only ascii symbols in identifiers."
|
30
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#english-identifiers"
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/Attr:
|
34
|
+
Description: "Checks for uses of Module#attr."
|
35
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#attr"
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Metrics/BlockNesting:
|
39
|
+
Description: "Avoid excessive block nesting"
|
40
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count"
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/CaseEquality:
|
44
|
+
Description: "Avoid explicit use of the case equality operator(===)."
|
45
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-case-equality"
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/CharacterLiteral:
|
49
|
+
Description: "Checks for uses of character literals."
|
50
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-character-literals"
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/ClassAndModuleChildren:
|
54
|
+
Description: "Checks style of children classes and modules."
|
55
|
+
Enabled: true
|
56
|
+
EnforcedStyle: nested
|
57
|
+
|
58
|
+
Metrics/ClassLength:
|
59
|
+
Description: "Avoid classes longer than 100 lines of code."
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Metrics/ModuleLength:
|
63
|
+
Description: "Avoid modules longer than 100 lines of code."
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/ClassVars:
|
67
|
+
Description: "Avoid the use of class variables."
|
68
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-class-vars"
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Style/CollectionMethods:
|
72
|
+
Enabled: true
|
73
|
+
PreferredMethods:
|
74
|
+
find: detect
|
75
|
+
inject: reduce
|
76
|
+
collect: map
|
77
|
+
find_all: select
|
78
|
+
|
79
|
+
Style/ColonMethodCall:
|
80
|
+
Description: "Do not use :: for method call."
|
81
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#double-colons"
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Style/CommentAnnotation:
|
85
|
+
Description: >-
|
86
|
+
Checks formatting of special comments
|
87
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
88
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#annotate-keywords"
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Metrics/AbcSize:
|
92
|
+
Description: >-
|
93
|
+
A calculated magnitude based on number of assignments,
|
94
|
+
branches, and conditions.
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Metrics/BlockLength:
|
98
|
+
CountComments: true # count full line comments?
|
99
|
+
Max: 25
|
100
|
+
ExcludedMethods: []
|
101
|
+
Exclude:
|
102
|
+
- "spec/**/*"
|
103
|
+
|
104
|
+
Metrics/CyclomaticComplexity:
|
105
|
+
Description: >-
|
106
|
+
A complexity metric that is strongly correlated to the number
|
107
|
+
of test cases needed to validate a method.
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Rails/Delegate:
|
111
|
+
Description: "Prefer delegate method for delegations."
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Style/PreferredHashMethods:
|
115
|
+
Description: "Checks use of `has_key?` and `has_value?` Hash methods."
|
116
|
+
StyleGuide: "#hash-key"
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
Style/Documentation:
|
120
|
+
Description: "Document classes and non-namespace modules."
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Style/DoubleNegation:
|
124
|
+
Description: "Checks for uses of double negation (!!)."
|
125
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-bang-bang"
|
126
|
+
Enabled: false
|
127
|
+
|
128
|
+
Style/EachWithObject:
|
129
|
+
Description: "Prefer `each_with_object` over `inject` or `reduce`."
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/EmptyLiteral:
|
133
|
+
Description: "Prefer literals to Array.new/Hash.new/String.new."
|
134
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#literal-array-hash"
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
138
|
+
# AutoCorrectEncodingComment must match the regex
|
139
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
140
|
+
Style/Encoding:
|
141
|
+
Enabled: false
|
142
|
+
|
143
|
+
Style/EvenOdd:
|
144
|
+
Description: "Favor the use of Fixnum#even? && Fixnum#odd?"
|
145
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#predicate-methods"
|
146
|
+
Enabled: false
|
147
|
+
|
148
|
+
Naming/FileName:
|
149
|
+
Description: "Use snake_case for source file names."
|
150
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#snake-case-files"
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
Style/FrozenStringLiteralComment:
|
154
|
+
Description: >-
|
155
|
+
Add the frozen_string_literal comment to the top of files
|
156
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
Lint/FlipFlop:
|
160
|
+
Description: "Checks for flip flops"
|
161
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-flip-flops"
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
Style/FormatString:
|
165
|
+
Description: "Enforce the use of Kernel#sprintf, Kernel#format or String#%."
|
166
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#sprintf"
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
Style/GlobalVars:
|
170
|
+
Description: "Do not introduce global variables."
|
171
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#instance-vars"
|
172
|
+
Reference: "http://www.zenspider.com/Languages/Ruby/QuickRef.html"
|
173
|
+
Enabled: false
|
174
|
+
|
175
|
+
Style/GuardClause:
|
176
|
+
Description: "Check for conditionals that can be replaced with guard clauses"
|
177
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals"
|
178
|
+
Enabled: false
|
179
|
+
|
180
|
+
Style/IfUnlessModifier:
|
181
|
+
Description: >-
|
182
|
+
Favor modifier if/unless usage when you have a
|
183
|
+
single-line body.
|
184
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier"
|
185
|
+
Enabled: false
|
186
|
+
|
187
|
+
Style/IfWithSemicolon:
|
188
|
+
Description: "Do not use if x; .... Use the ternary operator instead."
|
189
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs"
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
Style/InlineComment:
|
193
|
+
Description: "Avoid inline comments."
|
194
|
+
Enabled: false
|
195
|
+
|
196
|
+
Style/Lambda:
|
197
|
+
Description: "Use the new lambda literal syntax for single-line blocks."
|
198
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#lambda-multi-line"
|
199
|
+
Enabled: false
|
200
|
+
|
201
|
+
Style/LambdaCall:
|
202
|
+
Description: "Use lambda.call(...) instead of lambda.(...)."
|
203
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#proc-call"
|
204
|
+
Enabled: false
|
205
|
+
|
206
|
+
Style/LineEndConcatenation:
|
207
|
+
Description: >-
|
208
|
+
Use \ instead of + or << to concatenate two string literals at
|
209
|
+
line end.
|
210
|
+
Enabled: false
|
211
|
+
|
212
|
+
Layout/LineLength:
|
213
|
+
Description: "Limit lines to 80 characters."
|
214
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#80-character-limits"
|
215
|
+
Max: 80
|
216
|
+
|
217
|
+
Metrics/MethodLength:
|
218
|
+
Description: "Avoid methods longer than 10 lines of code."
|
219
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#short-methods"
|
220
|
+
Enabled: false
|
221
|
+
|
222
|
+
Style/ModuleFunction:
|
223
|
+
Description: "Checks for usage of `extend self` in modules."
|
224
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#module-function"
|
225
|
+
Enabled: false
|
226
|
+
|
227
|
+
Style/MultilineBlockChain:
|
228
|
+
Description: "Avoid multi-line chains of blocks."
|
229
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#single-line-blocks"
|
230
|
+
Enabled: false
|
231
|
+
|
232
|
+
Style/NegatedIf:
|
233
|
+
Description: >-
|
234
|
+
Favor unless over if for negative conditions
|
235
|
+
(or control flow or).
|
236
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#unless-for-negatives"
|
237
|
+
Enabled: false
|
238
|
+
|
239
|
+
Style/NegatedWhile:
|
240
|
+
Description: "Favor until over while for negative conditions."
|
241
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#until-for-negatives"
|
242
|
+
Enabled: false
|
243
|
+
|
244
|
+
Style/Next:
|
245
|
+
Description: "Use `next` to skip iteration instead of a condition at the end."
|
246
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals"
|
247
|
+
Enabled: false
|
248
|
+
|
249
|
+
Style/NilComparison:
|
250
|
+
Description: "Prefer x.nil? to x == nil."
|
251
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#predicate-methods"
|
252
|
+
Enabled: false
|
253
|
+
|
254
|
+
Style/Not:
|
255
|
+
Description: "Use ! instead of not."
|
256
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#bang-not-not"
|
257
|
+
Enabled: false
|
258
|
+
|
259
|
+
Style/NumericLiterals:
|
260
|
+
Description: >-
|
261
|
+
Add underscores to large numeric literals to improve their
|
262
|
+
readability.
|
263
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics"
|
264
|
+
Enabled: false
|
265
|
+
|
266
|
+
Style/OneLineConditional:
|
267
|
+
Description: >-
|
268
|
+
Favor the ternary operator(?:) over
|
269
|
+
if/then/else/end constructs.
|
270
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#ternary-operator"
|
271
|
+
Enabled: false
|
272
|
+
|
273
|
+
Naming/BinaryOperatorParameterName:
|
274
|
+
Description: "When defining binary operators, name the argument other."
|
275
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#other-arg"
|
276
|
+
Enabled: false
|
277
|
+
|
278
|
+
Metrics/ParameterLists:
|
279
|
+
Description: "Avoid parameter lists longer than three or four parameters."
|
280
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#too-many-params"
|
281
|
+
Enabled: false
|
282
|
+
|
283
|
+
Style/PercentLiteralDelimiters:
|
284
|
+
Description: "Use `%`-literal delimiters consistently"
|
285
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#percent-literal-braces"
|
286
|
+
Enabled: false
|
287
|
+
|
288
|
+
Style/PerlBackrefs:
|
289
|
+
Description: "Avoid Perl-style regex back references."
|
290
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers"
|
291
|
+
Enabled: false
|
292
|
+
|
293
|
+
Naming/PredicateName:
|
294
|
+
Description: "Check the names of predicate methods."
|
295
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark"
|
296
|
+
ForbiddenPrefixes:
|
297
|
+
- is_
|
298
|
+
Exclude:
|
299
|
+
- spec/**/*
|
300
|
+
|
301
|
+
Style/Proc:
|
302
|
+
Description: "Use proc instead of Proc.new."
|
303
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#proc"
|
304
|
+
Enabled: false
|
305
|
+
|
306
|
+
Style/RaiseArgs:
|
307
|
+
Description: "Checks the arguments passed to raise/fail."
|
308
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#exception-class-messages"
|
309
|
+
Enabled: false
|
310
|
+
|
311
|
+
Style/RegexpLiteral:
|
312
|
+
Description: "Use / or %r around regular expressions."
|
313
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#percent-r"
|
314
|
+
Enabled: false
|
315
|
+
|
316
|
+
Style/Sample:
|
317
|
+
Description: >-
|
318
|
+
Use `sample` instead of `shuffle.first`,
|
319
|
+
`shuffle.last`, and `shuffle[Fixnum]`.
|
320
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code"
|
321
|
+
Enabled: false
|
322
|
+
|
323
|
+
Style/SelfAssignment:
|
324
|
+
Description: >-
|
325
|
+
Checks for places where self-assignment shorthand should have
|
326
|
+
been used.
|
327
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#self-assignment"
|
328
|
+
Enabled: false
|
329
|
+
|
330
|
+
Style/SingleLineBlockParams:
|
331
|
+
Description: "Enforces the names of some block params."
|
332
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#reduce-blocks"
|
333
|
+
Enabled: false
|
334
|
+
|
335
|
+
Style/SingleLineMethods:
|
336
|
+
Description: "Avoid single-line methods."
|
337
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-single-line-methods"
|
338
|
+
Enabled: false
|
339
|
+
|
340
|
+
Style/SignalException:
|
341
|
+
Description: "Checks for proper usage of fail and raise."
|
342
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#fail-method"
|
343
|
+
Enabled: false
|
344
|
+
|
345
|
+
Style/SpecialGlobalVars:
|
346
|
+
Description: "Avoid Perl-style global variables."
|
347
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms"
|
348
|
+
Enabled: false
|
349
|
+
|
350
|
+
Style/StringLiterals:
|
351
|
+
Description: "Checks if uses of quotes match the configured preference."
|
352
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-string-literals"
|
353
|
+
EnforcedStyle: double_quotes
|
354
|
+
Enabled: true
|
355
|
+
|
356
|
+
Style/TrailingCommaInArguments:
|
357
|
+
Description: "Checks for trailing comma in argument lists."
|
358
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
|
359
|
+
EnforcedStyleForMultiline: comma
|
360
|
+
SupportedStylesForMultiline:
|
361
|
+
- comma
|
362
|
+
- consistent_comma
|
363
|
+
- no_comma
|
364
|
+
Enabled: true
|
365
|
+
|
366
|
+
Style/TrailingCommaInArrayLiteral:
|
367
|
+
Description: "Checks for trailing comma in array literals."
|
368
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
|
369
|
+
EnforcedStyleForMultiline: comma
|
370
|
+
SupportedStylesForMultiline:
|
371
|
+
- comma
|
372
|
+
- consistent_comma
|
373
|
+
- no_comma
|
374
|
+
Enabled: true
|
375
|
+
|
376
|
+
Style/TrailingCommaInHashLiteral:
|
377
|
+
Description: "Checks for trailing comma in hash literals."
|
378
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
|
379
|
+
EnforcedStyleForMultiline: comma
|
380
|
+
SupportedStylesForMultiline:
|
381
|
+
- comma
|
382
|
+
- consistent_comma
|
383
|
+
- no_comma
|
384
|
+
Enabled: true
|
385
|
+
|
386
|
+
Style/TrivialAccessors:
|
387
|
+
Description: "Prefer attr_* methods to trivial readers/writers."
|
388
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#attr_family"
|
389
|
+
Enabled: false
|
390
|
+
|
391
|
+
Style/VariableInterpolation:
|
392
|
+
Description: >-
|
393
|
+
Don't interpolate global, instance and class variables
|
394
|
+
directly in strings.
|
395
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#curlies-interpolate"
|
396
|
+
Enabled: false
|
397
|
+
|
398
|
+
Style/WhenThen:
|
399
|
+
Description: "Use when x then ... for one-line cases."
|
400
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#one-line-cases"
|
401
|
+
Enabled: false
|
402
|
+
|
403
|
+
Style/WhileUntilModifier:
|
404
|
+
Description: >-
|
405
|
+
Favor modifier while/until usage when you have a
|
406
|
+
single-line body.
|
407
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier"
|
408
|
+
Enabled: false
|
409
|
+
|
410
|
+
Style/WordArray:
|
411
|
+
Description: "Use %w or %W for arrays of words."
|
412
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#percent-w"
|
413
|
+
Enabled: false
|
414
|
+
|
415
|
+
# Layout
|
416
|
+
|
417
|
+
Layout/ParameterAlignment:
|
418
|
+
Description: "Here we check if the parameters on a multi-line method call or definition are aligned."
|
419
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-double-indent"
|
420
|
+
Enabled: false
|
421
|
+
|
422
|
+
Layout/HashAlignment:
|
15
423
|
EnforcedHashRocketStyle: table
|
16
|
-
# Alignment of entries using colon as separator. Valid values are:
|
17
|
-
#
|
18
|
-
# key - left alignment of keys
|
19
|
-
# a: 0
|
20
|
-
# bb: 1
|
21
|
-
# separator - alignment of colons, keys are right aligned
|
22
|
-
# a: 0
|
23
|
-
# bb: 1
|
24
|
-
# table - left alignment of keys and values
|
25
|
-
# a: 0
|
26
|
-
# bb: 1
|
27
424
|
EnforcedColonStyle: table
|
28
|
-
LineLength:
|
29
|
-
Max: 100
|
30
|
-
StringLiterals:
|
31
|
-
EnforcedStyle: double_quotes
|
32
|
-
MethodCalledOnDoEndBlock:
|
33
|
-
Description: "Avoid chaining a method call on a do...end block."
|
34
425
|
Enabled: true
|
35
|
-
|
36
|
-
|
37
|
-
|
426
|
+
Layout/ConditionPosition:
|
427
|
+
Description: >-
|
428
|
+
Checks for condition placed in a confusing position relative to
|
429
|
+
the keyword.
|
430
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#same-line-condition"
|
431
|
+
Enabled: false
|
432
|
+
|
433
|
+
Layout/DotPosition:
|
434
|
+
Description: "Checks the position of the dot in multi-line method calls."
|
435
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains"
|
436
|
+
EnforcedStyle: trailing
|
437
|
+
|
438
|
+
Layout/ExtraSpacing:
|
439
|
+
Description: "Do not use unnecessary spacing."
|
440
|
+
Enabled: true
|
441
|
+
|
442
|
+
Layout/MultilineOperationIndentation:
|
443
|
+
Description: >-
|
444
|
+
Checks indentation of binary operations that span more than
|
445
|
+
one line.
|
446
|
+
Enabled: true
|
447
|
+
EnforcedStyle: indented
|
448
|
+
|
449
|
+
Layout/MultilineMethodCallIndentation:
|
450
|
+
Description: >-
|
451
|
+
Checks indentation of method calls with the dot operator
|
452
|
+
that span more than one line.
|
453
|
+
Enabled: true
|
454
|
+
EnforcedStyle: indented
|
455
|
+
|
456
|
+
Layout/InitialIndentation:
|
457
|
+
Description: >-
|
458
|
+
Checks the indentation of the first non-blank non-comment line in a file.
|
459
|
+
Enabled: false
|
460
|
+
|
461
|
+
# Lint
|
462
|
+
|
463
|
+
Lint/AmbiguousOperator:
|
464
|
+
Description: >-
|
465
|
+
Checks for ambiguous operators in the first argument of a
|
466
|
+
method invocation without parentheses.
|
467
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#parens-as-args"
|
468
|
+
Enabled: false
|
469
|
+
|
470
|
+
Lint/AmbiguousRegexpLiteral:
|
471
|
+
Description: >-
|
472
|
+
Checks for ambiguous regexp literals in the first argument of
|
473
|
+
a method invocation without parenthesis.
|
474
|
+
Enabled: false
|
475
|
+
|
476
|
+
Lint/AssignmentInCondition:
|
477
|
+
Description: "Don't use assignment in conditions."
|
478
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition"
|
479
|
+
Enabled: false
|
480
|
+
|
481
|
+
Lint/CircularArgumentReference:
|
482
|
+
Description: "Don't refer to the keyword argument in the default value."
|
483
|
+
Enabled: false
|
484
|
+
|
485
|
+
Lint/DeprecatedClassMethods:
|
486
|
+
Description: "Check for deprecated class method calls."
|
487
|
+
Enabled: false
|
488
|
+
|
489
|
+
Lint/DuplicateHashKey:
|
490
|
+
Description: "Check for duplicate keys in hash literals."
|
491
|
+
Enabled: false
|
492
|
+
|
493
|
+
Lint/EachWithObjectArgument:
|
494
|
+
Description: "Check for immutable argument given to each_with_object."
|
495
|
+
Enabled: false
|
496
|
+
|
497
|
+
Lint/ElseLayout:
|
498
|
+
Description: "Check for odd code arrangement in an else block."
|
499
|
+
Enabled: false
|
500
|
+
|
501
|
+
Lint/FormatParameterMismatch:
|
502
|
+
Description: "The number of parameters to format/sprint must match the fields."
|
503
|
+
Enabled: false
|
504
|
+
|
505
|
+
Lint/SuppressedException:
|
506
|
+
Description: "Don't suppress exception."
|
507
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions"
|
508
|
+
Enabled: false
|
509
|
+
|
510
|
+
Lint/LiteralAsCondition:
|
511
|
+
Description: "Checks of literals used in conditions."
|
512
|
+
Enabled: false
|
513
|
+
|
514
|
+
Lint/LiteralInInterpolation:
|
515
|
+
Description: "Checks for literals used in interpolation."
|
516
|
+
Enabled: false
|
517
|
+
|
518
|
+
Lint/Loop:
|
519
|
+
Description: >-
|
520
|
+
Use Kernel#loop with break rather than begin/end/until or
|
521
|
+
begin/end/while for post-loop tests.
|
522
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#loop-with-break"
|
523
|
+
Enabled: false
|
524
|
+
|
525
|
+
Lint/NestedMethodDefinition:
|
526
|
+
Description: "Do not use nested method definitions."
|
527
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-methods"
|
528
|
+
Enabled: false
|
529
|
+
|
530
|
+
Lint/NonLocalExitFromIterator:
|
531
|
+
Description: "Do not use return in iterator to cause non-local exit."
|
532
|
+
Enabled: false
|
533
|
+
|
534
|
+
Lint/ParenthesesAsGroupedExpression:
|
535
|
+
Description: >-
|
536
|
+
Checks for method calls with a space before the opening
|
537
|
+
parenthesis.
|
538
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#parens-no-spaces"
|
539
|
+
Enabled: false
|
540
|
+
|
541
|
+
Lint/RequireParentheses:
|
542
|
+
Description: >-
|
543
|
+
Use parentheses in the method call to avoid confusion
|
544
|
+
about precedence.
|
545
|
+
Enabled: false
|
546
|
+
|
547
|
+
Lint/UnderscorePrefixedVariableName:
|
548
|
+
Description: "Do not use prefix `_` for a variable that is used."
|
549
|
+
Enabled: false
|
550
|
+
|
551
|
+
Lint/RedundantCopDisableDirective:
|
552
|
+
Description: >-
|
553
|
+
Checks for rubocop:disable comments that can be removed.
|
554
|
+
Note: this cop is not disabled when disabling all cops.
|
555
|
+
It must be explicitly disabled.
|
556
|
+
Enabled: false
|
557
|
+
|
558
|
+
Lint/Void:
|
559
|
+
Description: "Possible use of operator/literal/variable in void context."
|
560
|
+
Enabled: false
|
561
|
+
|
562
|
+
# Performance
|
563
|
+
|
564
|
+
Performance/CaseWhenSplat:
|
565
|
+
Description: >-
|
566
|
+
Place `when` conditions that use splat at the end
|
567
|
+
of the list of `when` branches.
|
568
|
+
Enabled: false
|
569
|
+
|
570
|
+
Performance/Count:
|
571
|
+
Description: >-
|
572
|
+
Use `count` instead of `select...size`, `reject...size`,
|
573
|
+
`select...count`, `reject...count`, `select...length`,
|
574
|
+
and `reject...length`.
|
575
|
+
Enabled: false
|
576
|
+
|
577
|
+
Performance/Detect:
|
578
|
+
Description: >-
|
579
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
580
|
+
`select.last`, and `find_all.last`.
|
581
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code"
|
582
|
+
Enabled: false
|
583
|
+
|
584
|
+
Performance/FlatMap:
|
585
|
+
Description: >-
|
586
|
+
Use `Enumerable#flat_map`
|
587
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
588
|
+
or `Enumberable#collect..Array#flatten(1)`
|
589
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code"
|
590
|
+
Enabled: false
|
591
|
+
|
592
|
+
Performance/ReverseEach:
|
593
|
+
Description: "Use `reverse_each` instead of `reverse.each`."
|
594
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code"
|
595
|
+
Enabled: false
|
596
|
+
|
597
|
+
Performance/Size:
|
598
|
+
Description: >-
|
599
|
+
Use `size` instead of `count` for counting
|
600
|
+
the number of elements in `Array` and `Hash`.
|
601
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code"
|
602
|
+
Enabled: false
|
603
|
+
|
604
|
+
Performance/StringReplacement:
|
605
|
+
Description: >-
|
606
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
607
|
+
number of characters. Use `delete` instead of `gsub` when
|
608
|
+
you are deleting characters.
|
609
|
+
Reference: "https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code"
|
610
|
+
Enabled: false
|
611
|
+
|
612
|
+
# Rails
|
613
|
+
|
614
|
+
Rails/ActionFilter:
|
615
|
+
Description: "Enforces consistent use of action filter methods."
|
616
|
+
Enabled: false
|
617
|
+
|
618
|
+
Rails/Date:
|
619
|
+
Description: >-
|
620
|
+
Checks the correct usage of date aware methods,
|
621
|
+
such as Date.today, Date.current etc.
|
622
|
+
Enabled: false
|
623
|
+
|
624
|
+
Rails/FindBy:
|
625
|
+
Description: "Prefer find_by over where.first."
|
626
|
+
Enabled: false
|
627
|
+
|
628
|
+
Rails/FindEach:
|
629
|
+
Description: "Prefer all.find_each over all.find."
|
630
|
+
Enabled: false
|
631
|
+
|
632
|
+
Rails/HasAndBelongsToMany:
|
633
|
+
Description: "Prefer has_many :through to has_and_belongs_to_many."
|
634
|
+
Enabled: false
|
635
|
+
|
636
|
+
Rails/Output:
|
637
|
+
Description: "Checks for calls to puts, print, etc."
|
638
|
+
Enabled: false
|
639
|
+
|
640
|
+
Rails/ReadWriteAttribute:
|
641
|
+
Description: >-
|
642
|
+
Checks for read_attribute(:attr) and
|
643
|
+
write_attribute(:attr, val).
|
644
|
+
Enabled: false
|
645
|
+
|
646
|
+
Rails/ScopeArgs:
|
647
|
+
Description: "Checks the arguments of ActiveRecord scopes."
|
648
|
+
Enabled: false
|
649
|
+
|
650
|
+
Rails/TimeZone:
|
651
|
+
Description: "Checks the correct usage of time zone aware methods."
|
652
|
+
StyleGuide: "https://github.com/bbatsov/rails-style-guide#time"
|
653
|
+
Reference: "http://danilenko.org/2012/7/6/rails_timezones"
|
654
|
+
Enabled: false
|
655
|
+
|
656
|
+
Rails/Validation:
|
657
|
+
Description: "Use validates :attribute, hash of validations."
|
38
658
|
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.2
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,24 +1,41 @@
|
|
1
|
-
# Contributor Code of Conduct
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
2
|
|
3
|
-
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
3
|
+
## Our Pledge
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
12
22
|
|
13
23
|
Examples of unacceptable behavior by participants include:
|
14
24
|
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
|
17
|
-
* Trolling
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
18
28
|
* Public or private harassment
|
19
|
-
* Publishing
|
20
|
-
|
21
|
-
* Other
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
22
39
|
|
23
40
|
Project maintainers have the right and responsibility to remove, edit, or
|
24
41
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
@@ -26,24 +43,34 @@ that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
43
|
permanently any contributor for other behaviors that they deem inappropriate,
|
27
44
|
threatening, offensive, or harmful.
|
28
45
|
|
29
|
-
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
46
|
+
## Scope
|
33
47
|
|
34
|
-
This
|
35
|
-
when an individual is representing the project or its community.
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
36
56
|
|
37
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting
|
58
|
+
reported by contacting the project team at info@bluesquarehub.com. All
|
39
59
|
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances.
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
43
72
|
|
44
|
-
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
47
74
|
|
48
|
-
|
49
|
-
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/lib/dhis2.rb
CHANGED
@@ -35,6 +35,7 @@ require_relative "dhis2/api/shared/category"
|
|
35
35
|
require_relative "dhis2/api/shared/category_option"
|
36
36
|
require_relative "dhis2/api/shared/category_combo"
|
37
37
|
require_relative "dhis2/api/shared/category_option_combo"
|
38
|
+
require_relative "dhis2/api/shared/complete_data_set_registration"
|
38
39
|
require_relative "dhis2/api/shared/constants"
|
39
40
|
require_relative "dhis2/api/shared/data_element_group"
|
40
41
|
require_relative "dhis2/api/shared/data_set"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dhis2
|
4
|
+
module Api
|
5
|
+
module Shared
|
6
|
+
module CompleteDataSetRegistration
|
7
|
+
def self.included(base)
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def create(client, period:, organisation_unit:, data_set:, multi_ou: false)
|
13
|
+
client.post(
|
14
|
+
path: resource_name,
|
15
|
+
payload: {"completeDataSetRegistrations": [{
|
16
|
+
organisationUnit: organisation_unit,
|
17
|
+
period: period,
|
18
|
+
dataSet: data_set,
|
19
|
+
multiOu: multi_ou
|
20
|
+
}]},
|
21
|
+
raw_input: true
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(client, period:, organisation_unit:, data_set:)
|
26
|
+
client.delete(
|
27
|
+
path: resource_name,
|
28
|
+
query_params: {
|
29
|
+
ou: organisation_unit,
|
30
|
+
pe: period,
|
31
|
+
ds: data_set
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def list(client, periods:, organisation_units:, data_sets:)
|
37
|
+
query_params = periods.map { |p| "period=#{p}" }
|
38
|
+
query_params += organisation_units.map { |ou| "orgUnit=#{ou}" }
|
39
|
+
query_params += data_sets.map { |ds| "dataSet=#{ds}" }
|
40
|
+
json_response = client.get(
|
41
|
+
path: "#{resource_name}?#{query_params.join('&')}"
|
42
|
+
)
|
43
|
+
return [] unless json_response["complete_data_set_registrations"]
|
44
|
+
json_response["complete_data_set_registrations"].map { |raw_resource| new(client, raw_resource) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -14,8 +14,12 @@ module Dhis2
|
|
14
14
|
if raw
|
15
15
|
response["dataValues"]
|
16
16
|
else
|
17
|
-
response["data_values"]
|
18
|
-
|
17
|
+
if response["data_values"]
|
18
|
+
response["data_values"].map do |elt|
|
19
|
+
OpenStruct.new(elt)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
[]
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -46,9 +50,9 @@ module Dhis2
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def additional_query_parameters
|
49
|
-
[
|
50
|
-
|
51
|
-
|
53
|
+
%i[
|
54
|
+
data_set data_element_group period start_date end_date
|
55
|
+
org_unit children org_unit_group
|
52
56
|
]
|
53
57
|
end
|
54
58
|
end
|
@@ -8,6 +8,7 @@ require_relative "category"
|
|
8
8
|
require_relative "category_option"
|
9
9
|
require_relative "category_combo"
|
10
10
|
require_relative "category_option_combo"
|
11
|
+
require_relative "complete_data_set_registration"
|
11
12
|
require_relative "data_element"
|
12
13
|
require_relative "data_element_group"
|
13
14
|
require_relative "data_set"
|
@@ -7,6 +7,7 @@ require_relative "category"
|
|
7
7
|
require_relative "category_option"
|
8
8
|
require_relative "category_combo"
|
9
9
|
require_relative "category_option_combo"
|
10
|
+
require_relative "complete_data_set_registration"
|
10
11
|
require_relative "data_element"
|
11
12
|
require_relative "data_element_group"
|
12
13
|
require_relative "data_set"
|
@@ -7,6 +7,7 @@ require_relative "category"
|
|
7
7
|
require_relative "category_option"
|
8
8
|
require_relative "category_combo"
|
9
9
|
require_relative "category_option_combo"
|
10
|
+
require_relative "complete_data_set_registration"
|
10
11
|
require_relative "data_element"
|
11
12
|
require_relative "data_element_group"
|
12
13
|
require_relative "data_set"
|
@@ -7,6 +7,7 @@ require_relative "category"
|
|
7
7
|
require_relative "category_option"
|
8
8
|
require_relative "category_combo"
|
9
9
|
require_relative "category_option_combo"
|
10
|
+
require_relative "complete_data_set_registration"
|
10
11
|
require_relative "data_element"
|
11
12
|
require_relative "data_element_group"
|
12
13
|
require_relative "data_set"
|
@@ -7,6 +7,7 @@ require_relative "category"
|
|
7
7
|
require_relative "category_option"
|
8
8
|
require_relative "category_combo"
|
9
9
|
require_relative "category_option_combo"
|
10
|
+
require_relative "complete_data_set_registration"
|
10
11
|
require_relative "data_element"
|
11
12
|
require_relative "data_element_group"
|
12
13
|
require_relative "data_set"
|
data/lib/dhis2/classes.rb
CHANGED
@@ -25,6 +25,7 @@ module Dhis2
|
|
25
25
|
class CategoryOption < Versioned; end
|
26
26
|
class CategoryCombo < Versioned; end
|
27
27
|
class CategoryOptionCombo < Versioned; end
|
28
|
+
class CompleteDataSetRegistration < Versioned; end
|
28
29
|
class DataElement < Versioned; end
|
29
30
|
class DataElementGroup < Versioned; end
|
30
31
|
class DataSet < Versioned; end
|
data/lib/dhis2/client.rb
CHANGED
@@ -56,6 +56,10 @@ module Dhis2
|
|
56
56
|
@category_option_combos ||= CollectionWrapper.new("CategoryOptionCombo", self)
|
57
57
|
end
|
58
58
|
|
59
|
+
def complete_data_set_registrations
|
60
|
+
@complete_data_set_registrations ||= CollectionWrapper.new("CompleteDataSetRegistration", self)
|
61
|
+
end
|
62
|
+
|
59
63
|
def data_elements
|
60
64
|
@data_elements ||= CollectionWrapper.new("DataElement", self)
|
61
65
|
end
|
@@ -91,7 +95,7 @@ module Dhis2
|
|
91
95
|
def indicator_types
|
92
96
|
@indicator_types ||= CollectionWrapper.new("IndicatorType", self)
|
93
97
|
end
|
94
|
-
|
98
|
+
|
95
99
|
def legend_sets
|
96
100
|
@legend_sets ||= CollectionWrapper.new("LegendSet", self)
|
97
101
|
end
|
@@ -159,28 +163,47 @@ module Dhis2
|
|
159
163
|
|
160
164
|
private
|
161
165
|
|
162
|
-
EMPTY_RESPONSES = [nil, ""]
|
163
|
-
API =
|
166
|
+
EMPTY_RESPONSES = [nil, ""].freeze
|
167
|
+
API = "api"
|
164
168
|
TAB = "\t"
|
165
169
|
|
170
|
+
@@cookie_jar = {}
|
171
|
+
|
172
|
+
def present_response(raw_response, raw, start_tracking, finish_tracking)
|
173
|
+
safe_response = if EMPTY_RESPONSES.include?(raw_response)
|
174
|
+
{}
|
175
|
+
else
|
176
|
+
JSON.parse(raw_response)
|
177
|
+
end
|
178
|
+
|
179
|
+
diff_tracking = finish_tracking - start_tracking
|
180
|
+
log(raw_response.request, safe_response, diff_tracking)
|
181
|
+
|
182
|
+
if raw
|
183
|
+
safe_response
|
184
|
+
else
|
185
|
+
Dhis2::Case.deep_change(safe_response, :underscore)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
166
189
|
def execute(method_name:, url:, query_params: {}, payload: nil, raw: false, raw_input: false)
|
167
190
|
computed_payload = compute_payload(payload, raw_input)
|
168
191
|
|
192
|
+
start_tracking = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
169
193
|
raw_response = RestClient::Request.execute(
|
170
194
|
method: method_name,
|
171
195
|
url: url,
|
172
196
|
headers: headers(method_name, query_params),
|
173
197
|
payload: computed_payload,
|
174
198
|
verify_ssl: @verify_ssl,
|
175
|
-
timeout: @timeout
|
199
|
+
timeout: @timeout,
|
200
|
+
cookies: @@cookie_jar[@base_url],
|
176
201
|
)
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
Dhis2::Case.deep_change(response, :underscore)
|
183
|
-
end
|
202
|
+
finish_tracking = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
203
|
+
|
204
|
+
@@cookie_jar[@base_url] = raw_response.cookies
|
205
|
+
|
206
|
+
present_response(raw_response, raw, start_tracking, finish_tracking)
|
184
207
|
rescue RestClient::RequestFailed => e
|
185
208
|
exception = ::Dhis2::RequestError.new(e.message)
|
186
209
|
exception.response = e.response if e.respond_to?(:response)
|
@@ -193,6 +216,7 @@ module Dhis2
|
|
193
216
|
def compute_payload(payload, raw_input)
|
194
217
|
return nil unless payload
|
195
218
|
return payload.to_json if raw_input
|
219
|
+
|
196
220
|
Dhis2::Case.deep_change(payload, :camelize).to_json
|
197
221
|
end
|
198
222
|
|
@@ -206,8 +230,15 @@ module Dhis2
|
|
206
230
|
end
|
207
231
|
end
|
208
232
|
|
209
|
-
def log(request, response)
|
210
|
-
|
233
|
+
def log(request, response, diff = nil)
|
234
|
+
return unless @debug
|
235
|
+
|
236
|
+
puts [
|
237
|
+
request.url,
|
238
|
+
request.args[:payload].to_json,
|
239
|
+
response,
|
240
|
+
"in #{diff}",
|
241
|
+
].join(TAB)
|
211
242
|
end
|
212
243
|
end
|
213
244
|
end
|
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.
|
4
|
+
version: 3.3.1
|
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: 2020-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/dhis2/api/shared/category_combo.rb
|
225
225
|
- lib/dhis2/api/shared/category_option.rb
|
226
226
|
- lib/dhis2/api/shared/category_option_combo.rb
|
227
|
+
- lib/dhis2/api/shared/complete_data_set_registration.rb
|
227
228
|
- lib/dhis2/api/shared/constants.rb
|
228
229
|
- lib/dhis2/api/shared/data_element_group.rb
|
229
230
|
- lib/dhis2/api/shared/data_set.rb
|
@@ -243,6 +244,7 @@ files:
|
|
243
244
|
- lib/dhis2/api/version224/category_combo.rb
|
244
245
|
- lib/dhis2/api/version224/category_option.rb
|
245
246
|
- lib/dhis2/api/version224/category_option_combo.rb
|
247
|
+
- lib/dhis2/api/version224/complete_data_set_registration.rb
|
246
248
|
- lib/dhis2/api/version224/constants.rb
|
247
249
|
- lib/dhis2/api/version224/data_element.rb
|
248
250
|
- lib/dhis2/api/version224/data_element_group.rb
|
@@ -271,6 +273,7 @@ files:
|
|
271
273
|
- lib/dhis2/api/version225/category_combo.rb
|
272
274
|
- lib/dhis2/api/version225/category_option.rb
|
273
275
|
- lib/dhis2/api/version225/category_option_combo.rb
|
276
|
+
- lib/dhis2/api/version225/complete_data_set_registration.rb
|
274
277
|
- lib/dhis2/api/version225/constants.rb
|
275
278
|
- lib/dhis2/api/version225/data_element.rb
|
276
279
|
- lib/dhis2/api/version225/data_element_group.rb
|
@@ -298,6 +301,7 @@ files:
|
|
298
301
|
- lib/dhis2/api/version226/category_combo.rb
|
299
302
|
- lib/dhis2/api/version226/category_option.rb
|
300
303
|
- lib/dhis2/api/version226/category_option_combo.rb
|
304
|
+
- lib/dhis2/api/version226/complete_data_set_registration.rb
|
301
305
|
- lib/dhis2/api/version226/constants.rb
|
302
306
|
- lib/dhis2/api/version226/data_element.rb
|
303
307
|
- lib/dhis2/api/version226/data_element_group.rb
|
@@ -326,6 +330,7 @@ files:
|
|
326
330
|
- lib/dhis2/api/version227/category_combo.rb
|
327
331
|
- lib/dhis2/api/version227/category_option.rb
|
328
332
|
- lib/dhis2/api/version227/category_option_combo.rb
|
333
|
+
- lib/dhis2/api/version227/complete_data_set_registration.rb
|
329
334
|
- lib/dhis2/api/version227/constants.rb
|
330
335
|
- lib/dhis2/api/version227/data_element.rb
|
331
336
|
- lib/dhis2/api/version227/data_element_group.rb
|
@@ -354,6 +359,7 @@ files:
|
|
354
359
|
- lib/dhis2/api/version228/category_combo.rb
|
355
360
|
- lib/dhis2/api/version228/category_option.rb
|
356
361
|
- lib/dhis2/api/version228/category_option_combo.rb
|
362
|
+
- lib/dhis2/api/version228/complete_data_set_registration.rb
|
357
363
|
- lib/dhis2/api/version228/constants.rb
|
358
364
|
- lib/dhis2/api/version228/data_element.rb
|
359
365
|
- lib/dhis2/api/version228/data_element_group.rb
|
@@ -407,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
413
|
version: '0'
|
408
414
|
requirements: []
|
409
415
|
rubyforge_project:
|
410
|
-
rubygems_version: 2.
|
416
|
+
rubygems_version: 2.7.6
|
411
417
|
signing_key:
|
412
418
|
specification_version: 4
|
413
419
|
summary: Simple Ruby wrapper on DHIS2 API.
|