roqua-rom-api 3.0.1 → 3.0.3
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 +4 -4
- data/config/locales/nl.yml +1 -1
- data/lib/roqua/rom_api/list_auto_protocols.rb +16 -0
- data/lib/roqua/rom_api/list_responses.rb +8 -7
- data/lib/roqua/rom_api/models/auto_protocol.rb +27 -0
- data/lib/roqua/rom_api/models/questionnaire.rb +2 -2
- data/lib/roqua/rom_api/models.rb +1 -0
- data/lib/roqua/rom_api/sessions.rb +2 -2
- data/lib/roqua/rom_api/version.rb +1 -1
- data/lib/roqua/rom_api.rb +1 -0
- data/spec/lib/roqua/rom_api/list_auto_protocols_spec.rb +21 -0
- data/spec/lib/roqua/rom_api/list_dossier_stats_spec.rb +1 -1
- data/spec/lib/roqua/rom_api/list_responses_spec.rb +9 -9
- data/spec/lib/roqua/rom_api/report_calculations_spec.rb +1 -1
- data/spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb +15 -13
- metadata +25 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e4cbc3256f5ae1f1cc8925aeddd23a062557f5f31b88d17908e5856d4ff22f5
|
4
|
+
data.tar.gz: e7202043808f8d9993729a94e5adc4369830ad43bb2cb4a720d012d5c647128c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1769591f3affdddcc516c07d965603f4effd9470b9c7e0db6ec05422df5e0dd3d3be0c9383e0ca1e6544c65a3fc9e79a9ffdfaaefbeaff74f72937ef77fbe75
|
7
|
+
data.tar.gz: 139002940dfab95e73caa7678102b7edf32f15df2230c0b306fa309d7adb766c00df6ae634717a18d3647bee7872a983449ec844c71dfac10591e855d7666cba
|
data/config/locales/nl.yml
CHANGED
@@ -11,7 +11,7 @@ nl:
|
|
11
11
|
base:
|
12
12
|
protocol_must_be_automatic: Het protocol is niet geautomatiseerd.
|
13
13
|
protocol_scheduler_options_invalid: Het protocol is verkeerd ingesteld.
|
14
|
-
|
14
|
+
respondent_taken: Dit dossier is reeds geabonneerd op dit protocol.
|
15
15
|
flag_does_not_exist: Een van de opgegeven vlaggen bestaat niet.
|
16
16
|
flag_value_invalid: Een van de opgegeven vlaggen bevat een waarde anders dan true, false of nil.
|
17
17
|
text_message_template_blank: Er is geen SMS-template beschikbaar voor het protocol.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Roqua
|
2
|
+
module RomApi
|
3
|
+
# @api private
|
4
|
+
class ListAutoProtocols < Endpoint
|
5
|
+
def execute
|
6
|
+
validate_response_for do
|
7
|
+
basic_auth_session.get "/auto_protocols"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def response_to_result(response)
|
12
|
+
response.map { |r| Models::AutoProtocol.new(r) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -18,13 +18,14 @@ module Roqua
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def filter_params
|
21
|
-
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
{
|
22
|
+
response_ids: response_ids,
|
23
|
+
respondent_type: respondent_type,
|
24
|
+
status: status,
|
25
|
+
questionnaire_keys: questionnaire_keys,
|
26
|
+
completed_after: completed_after,
|
27
|
+
completed_before: completed_before,
|
28
|
+
protocol_subscription_id: protocol_subscription_id
|
28
29
|
}.keep_if { |_k, v| v.present? }
|
29
30
|
end
|
30
31
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'virtus'
|
2
|
+
|
3
|
+
module Roqua
|
4
|
+
module RomApi
|
5
|
+
module Models
|
6
|
+
class AutoProtocol
|
7
|
+
include Virtus.model
|
8
|
+
|
9
|
+
# @!attribute [r] id
|
10
|
+
# @return [Integer]
|
11
|
+
attribute :id, Integer
|
12
|
+
# @!attribute key
|
13
|
+
# @return [String]
|
14
|
+
attribute :key, String
|
15
|
+
# @!attribute name
|
16
|
+
# @return [String]
|
17
|
+
attribute :name, String
|
18
|
+
# @!attribute description
|
19
|
+
# @return [String]
|
20
|
+
attribute :description, String
|
21
|
+
# @!attribute active
|
22
|
+
# @return [Boolean]
|
23
|
+
attribute :active, Boolean
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/roqua/rom_api/models.rb
CHANGED
@@ -6,6 +6,7 @@ require 'roqua/rom_api/models/measurement_sequence'
|
|
6
6
|
require 'roqua/rom_api/models/questionnaire'
|
7
7
|
require 'roqua/rom_api/models/measurement'
|
8
8
|
require 'roqua/rom_api/models/protocol'
|
9
|
+
require 'roqua/rom_api/models/auto_protocol'
|
9
10
|
require 'roqua/rom_api/models/dossier_stats'
|
10
11
|
require 'roqua/rom_api/models/stats'
|
11
12
|
require 'roqua/rom_api/models/non_response'
|
@@ -3,8 +3,8 @@ require 'roqua/rom_api/sessions/basic_auth_session'
|
|
3
3
|
|
4
4
|
module Roqua
|
5
5
|
module RomApi
|
6
|
-
def self.basic_auth_session(
|
7
|
-
Sessions::BasicAuthSession.new(
|
6
|
+
def self.basic_auth_session(...)
|
7
|
+
Sessions::BasicAuthSession.new(...)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/roqua/rom_api.rb
CHANGED
@@ -16,6 +16,7 @@ require 'roqua/rom_api/stop_protocol_subscription'
|
|
16
16
|
require 'roqua/rom_api/report_calculations'
|
17
17
|
require 'roqua/rom_api/get_questionnaire'
|
18
18
|
require 'roqua/rom_api/list_dossier_stats'
|
19
|
+
require 'roqua/rom_api/list_auto_protocols'
|
19
20
|
require 'roqua/rom_api/list_protocols'
|
20
21
|
require 'roqua/rom_api/get_protocol'
|
21
22
|
require 'roqua/rom_api/get_measurement'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ListAutoProtocols do
|
4
|
+
let(:api_path) { "/auto_protocols" }
|
5
|
+
let(:response) { httparty_response [{
|
6
|
+
'id' => 1,
|
7
|
+
'name' => 'prot'
|
8
|
+
}] }
|
9
|
+
let(:session) { Fabricate :basic_auth_session }
|
10
|
+
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
11
|
+
|
12
|
+
it 'returns an array of protocol objects' do
|
13
|
+
allow(session).to receive(:get).with(api_path).and_return response
|
14
|
+
auto_protocols = ListAutoProtocols.run.result
|
15
|
+
|
16
|
+
expect(auto_protocols).to be_a(Array)
|
17
|
+
expect(auto_protocols.first).to be_a AutoProtocol
|
18
|
+
expect(auto_protocols.first.id).to eq 1
|
19
|
+
expect(auto_protocols.first.name).to eq 'prot'
|
20
|
+
end
|
21
|
+
end
|
@@ -17,7 +17,7 @@ describe ListDossierStats do
|
|
17
17
|
describe 'with epd_ids provided' do
|
18
18
|
let(:response) { {'foo' => {}, 'bar' => {}} }
|
19
19
|
before do
|
20
|
-
allow(session).to receive(:get).with('/stats', epd_ids: ['foo', 'bar']).and_return httparty_response(response)
|
20
|
+
allow(session).to receive(:get).with('/stats', {epd_ids: ['foo', 'bar']}).and_return httparty_response(response)
|
21
21
|
end
|
22
22
|
|
23
23
|
subject { ListDossierStats.run! epd_ids: ['foo', 'bar'] }
|
@@ -8,14 +8,14 @@ describe ListResponses do
|
|
8
8
|
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
9
9
|
|
10
10
|
it 'performs a GET on the responses API' do
|
11
|
-
expect(session).to receive(:get).with(api_path,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
expect(session).to receive(:get).with(api_path, {
|
12
|
+
respondent_type: 'respondent_type',
|
13
|
+
status: :status,
|
14
|
+
questionnaire_keys: ['questionnaire_key'],
|
15
|
+
completed_after: Time.new(2014, 1, 1),
|
16
|
+
completed_before: Time.new(2014, 1, 31),
|
17
|
+
protocol_subscription_id: 'protocol_subscription_id'
|
18
|
+
}).and_return response
|
19
19
|
ListResponses.run(dossier_id: options[:dossier_id],
|
20
20
|
respondent_type: 'respondent_type',
|
21
21
|
status: :status,
|
@@ -26,7 +26,7 @@ describe ListResponses do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'can get responses by id' do
|
29
|
-
expect(session).to receive(:get).with(api_path, response_ids: ['1', '5', '7'])
|
29
|
+
expect(session).to receive(:get).with(api_path, {response_ids: ['1', '5', '7']})
|
30
30
|
.and_return response
|
31
31
|
ListResponses.run!(dossier_id: options[:dossier_id],
|
32
32
|
response_ids: ['1', '5', '7'])
|
@@ -37,7 +37,7 @@ describe ReportCalculations do
|
|
37
37
|
completed_after: filters[:completed_after].to_i,
|
38
38
|
completed_before: filters[:completed_before].to_i
|
39
39
|
}
|
40
|
-
expect(session).to receive(:get).with(api_path, calculator: 'test', filters: filter_hash)
|
40
|
+
expect(session).to receive(:get).with(api_path, {calculator: 'test', filters: filter_hash})
|
41
41
|
subject
|
42
42
|
end
|
43
43
|
end
|
@@ -11,24 +11,26 @@ describe StartProtocolSubscription do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'does a post to the rom protocol_subscription api' do
|
14
|
-
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions",
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions", {
|
15
|
+
protocol_key: options[:protocol_key],
|
16
|
+
protocol_id: options[:protocol_id],
|
17
|
+
respondent_id: options[:respondent_id],
|
18
|
+
flags: {"some_flag" => true},
|
19
|
+
textvars: {"some_var" => 'string'}
|
20
|
+
})
|
20
21
|
StartProtocolSubscription.run!(options)
|
21
22
|
end
|
22
23
|
|
23
24
|
it 'passes in the start_at option when provided' do
|
24
25
|
start_at = Time.current
|
25
|
-
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions",
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions", {
|
27
|
+
protocol_key: options[:protocol_key],
|
28
|
+
protocol_id: options[:protocol_id],
|
29
|
+
respondent_id: options[:respondent_id],
|
30
|
+
start_at: start_at.to_i,
|
31
|
+
flags: {"some_flag" => true},
|
32
|
+
textvars: {"some_var" => 'string'}
|
33
|
+
})
|
32
34
|
StartProtocolSubscription.run!(options.merge start_at: start_at)
|
33
35
|
end
|
34
36
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-rom-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Esposito
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2024-04-29 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: httparty
|
@@ -160,20 +160,6 @@ dependencies:
|
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '2.9'
|
163
|
-
- !ruby/object:Gem::Dependency
|
164
|
-
name: ruby_dep
|
165
|
-
requirement: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '1.5'
|
170
|
-
type: :development
|
171
|
-
prerelease: false
|
172
|
-
version_requirements: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: '1.5'
|
177
163
|
description: Provides authenticated access to ROM utilities
|
178
164
|
email: support@roqua.nl
|
179
165
|
executables: []
|
@@ -198,6 +184,7 @@ files:
|
|
198
184
|
- lib/roqua/rom_api/get_protocol.rb
|
199
185
|
- lib/roqua/rom_api/get_questionnaire.rb
|
200
186
|
- lib/roqua/rom_api/get_respondent.rb
|
187
|
+
- lib/roqua/rom_api/list_auto_protocols.rb
|
201
188
|
- lib/roqua/rom_api/list_dossier_stats.rb
|
202
189
|
- lib/roqua/rom_api/list_non_responses.rb
|
203
190
|
- lib/roqua/rom_api/list_protocol_subscriptions.rb
|
@@ -205,6 +192,7 @@ files:
|
|
205
192
|
- lib/roqua/rom_api/list_respondents.rb
|
206
193
|
- lib/roqua/rom_api/list_responses.rb
|
207
194
|
- lib/roqua/rom_api/models.rb
|
195
|
+
- lib/roqua/rom_api/models/auto_protocol.rb
|
208
196
|
- lib/roqua/rom_api/models/dossier_stats.rb
|
209
197
|
- lib/roqua/rom_api/models/fill_out_request.rb
|
210
198
|
- lib/roqua/rom_api/models/measurement.rb
|
@@ -233,6 +221,7 @@ files:
|
|
233
221
|
- spec/lib/roqua/rom_api/get_non_response_spec.rb
|
234
222
|
- spec/lib/roqua/rom_api/get_protocol_spec.rb
|
235
223
|
- spec/lib/roqua/rom_api/get_respondent_spec.rb
|
224
|
+
- spec/lib/roqua/rom_api/list_auto_protocols_spec.rb
|
236
225
|
- spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
|
237
226
|
- spec/lib/roqua/rom_api/list_non_responses_spec.rb
|
238
227
|
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
@@ -274,39 +263,40 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
263
|
- !ruby/object:Gem::Version
|
275
264
|
version: '0'
|
276
265
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
266
|
+
rubygems_version: 3.4.22
|
278
267
|
signing_key:
|
279
268
|
specification_version: 4
|
280
269
|
summary: API wrapper gem around RoQua's ROM API
|
281
270
|
test_files:
|
282
|
-
- spec/spec_helper.rb
|
283
|
-
- spec/support/test.yml
|
284
|
-
- spec/support/httparty_helpers.rb
|
285
271
|
- spec/fabricators/basic_auth_session_fabricator.rb
|
286
|
-
- spec/lib/roqua/rom_api/
|
287
|
-
- spec/lib/roqua/rom_api/update_response_spec.rb
|
272
|
+
- spec/lib/roqua/rom_api/cancel_fill_out_request_spec.rb
|
288
273
|
- spec/lib/roqua/rom_api/create_fill_out_request_spec.rb
|
274
|
+
- spec/lib/roqua/rom_api/create_response_spec.rb
|
289
275
|
- spec/lib/roqua/rom_api/endpoint_spec.rb
|
290
|
-
- spec/lib/roqua/rom_api/
|
276
|
+
- spec/lib/roqua/rom_api/get_measurement_spec.rb
|
277
|
+
- spec/lib/roqua/rom_api/get_non_response_spec.rb
|
291
278
|
- spec/lib/roqua/rom_api/get_protocol_spec.rb
|
292
|
-
- spec/lib/roqua/rom_api/
|
279
|
+
- spec/lib/roqua/rom_api/get_respondent_spec.rb
|
280
|
+
- spec/lib/roqua/rom_api/list_auto_protocols_spec.rb
|
281
|
+
- spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
|
293
282
|
- spec/lib/roqua/rom_api/list_non_responses_spec.rb
|
294
|
-
- spec/lib/roqua/rom_api/
|
283
|
+
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
284
|
+
- spec/lib/roqua/rom_api/list_protocols_spec.rb
|
285
|
+
- spec/lib/roqua/rom_api/list_respondents_spec.rb
|
295
286
|
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
296
|
-
- spec/lib/roqua/rom_api/report_calculations_spec.rb
|
297
|
-
- spec/lib/roqua/rom_api/cancel_fill_out_request_spec.rb
|
298
|
-
- spec/lib/roqua/rom_api/get_non_response_spec.rb
|
299
|
-
- spec/lib/roqua/rom_api/models/stats_spec.rb
|
300
287
|
- spec/lib/roqua/rom_api/models/dossier_stats_spec.rb
|
301
|
-
- spec/lib/roqua/rom_api/models/respondent_spec.rb
|
302
288
|
- spec/lib/roqua/rom_api/models/fill_out_request_spec.rb
|
303
|
-
- spec/lib/roqua/rom_api/models/response_spec.rb
|
304
289
|
- spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb
|
290
|
+
- spec/lib/roqua/rom_api/models/respondent_spec.rb
|
291
|
+
- spec/lib/roqua/rom_api/models/response_spec.rb
|
292
|
+
- spec/lib/roqua/rom_api/models/stats_spec.rb
|
293
|
+
- spec/lib/roqua/rom_api/report_calculations_spec.rb
|
305
294
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
306
295
|
- spec/lib/roqua/rom_api/start_fill_out_session_spec.rb
|
307
|
-
- spec/lib/roqua/rom_api/list_protocols_spec.rb
|
308
296
|
- spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
|
309
|
-
- spec/lib/roqua/rom_api/
|
310
|
-
- spec/lib/roqua/rom_api/
|
311
|
-
- spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
|
297
|
+
- spec/lib/roqua/rom_api/stop_protocol_subscription_spec.rb
|
298
|
+
- spec/lib/roqua/rom_api/update_response_spec.rb
|
312
299
|
- spec/lib/roqua_rom_api_spec.rb
|
300
|
+
- spec/spec_helper.rb
|
301
|
+
- spec/support/httparty_helpers.rb
|
302
|
+
- spec/support/test.yml
|