roqua-rom-api 0.2.2 → 0.3.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 +4 -4
- data/config/locales/nl.yml +10 -0
- data/config/locales/validation_errors.nl.yml +5 -0
- data/lib/roqua/rom_api/list_dossier_stats.rb +18 -0
- data/lib/roqua/rom_api/models/dossier_stats.rb +15 -0
- data/lib/roqua/rom_api/models/stats.rb +13 -0
- data/lib/roqua/rom_api/models.rb +2 -0
- data/lib/roqua/rom_api/version.rb +1 -1
- data/lib/roqua/rom_api.rb +1 -0
- data/spec/lib/roqua/rom_api/list_dossier_stats_spec.rb +49 -0
- data/spec/lib/roqua/rom_api/models/dossier_stats_spec.rb +19 -0
- data/spec/lib/roqua/rom_api/models/stats_spec.rb +33 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b6c4bbe62c3f8fe5d798f7076baec87b0eeded9
|
4
|
+
data.tar.gz: 98929db7f55e728b9a2ce7d697d8cd1d97aa7a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3b8f83aaf677e5e6826e11adc1ff89f6352e332a95a84a5b6c7f2a052bb9009a098e90583c58add5981f2bdc8dd0652ec383af46b9c1d82f1116c37434c32f
|
7
|
+
data.tar.gz: 4ecb7b6a00e6086605ec48c6cc0a3c6b89eb80b482d2154685306db7cc00d38b7cd952d7708183598fb17b6af480964e68c1b4808e004c35e286a499354c1f44
|
data/config/locales/nl.yml
CHANGED
@@ -16,6 +16,16 @@ nl:
|
|
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.
|
18
18
|
invitation_template_blank: Er is geen Email-template beschikbaar voor het protocol.
|
19
|
+
roqua/rom_api/create_response:
|
20
|
+
attributes:
|
21
|
+
base:
|
22
|
+
answer_completed_at_after_or_equal_to: "is te vroeg"
|
23
|
+
answer_completed_at_before: "is te laat"
|
24
|
+
roqua/rom_api/update_response:
|
25
|
+
attributes:
|
26
|
+
base:
|
27
|
+
answer_completed_at_after_or_equal_to: "is te vroeg"
|
28
|
+
answer_completed_at_before: "is te laat"
|
19
29
|
attributes:
|
20
30
|
roqua/rom_api/start_fill_out_session:
|
21
31
|
questionnaire_keys: Vragenlijsten
|
@@ -25,6 +25,11 @@ nl:
|
|
25
25
|
wrong_length: heeft onjuiste lengte (moet %{count} tekens lang zijn)
|
26
26
|
invalid_key: mag enkel kleine letters, cijfers en underscores bevatten en moet beginnen met een letter.
|
27
27
|
valid_ip_addresses: moeten geldige IP-adressen zijn
|
28
|
+
not_a_date: "is niet een datum"
|
29
|
+
after: "is te vroeg"
|
30
|
+
after_or_equal_to: "is te vroeg"
|
31
|
+
before: "is te laat"
|
32
|
+
before_or_equal_to: "is te laat"
|
28
33
|
template:
|
29
34
|
body: ! 'Controleer de volgende velden:'
|
30
35
|
header:
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Roqua
|
2
|
+
module RomApi
|
3
|
+
# @api private
|
4
|
+
class ListDossierStats < Endpoint
|
5
|
+
string :epd_ids
|
6
|
+
|
7
|
+
def execute
|
8
|
+
validate_response_for do
|
9
|
+
RomApi.basic_auth_session.get "/dossiers/#{epd_ids}/stats"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def response_to_result(response)
|
14
|
+
Models::Stats.new(dossiers: response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/roqua/rom_api/models.rb
CHANGED
@@ -3,3 +3,5 @@ require 'roqua/rom_api/models/fill_out_request'
|
|
3
3
|
require 'roqua/rom_api/models/protocol_subscription'
|
4
4
|
require 'roqua/rom_api/models/measurement_sequence'
|
5
5
|
require 'roqua/rom_api/models/questionnaire'
|
6
|
+
require 'roqua/rom_api/models/dossier_stats'
|
7
|
+
require 'roqua/rom_api/models/stats'
|
data/lib/roqua/rom_api.rb
CHANGED
@@ -14,6 +14,7 @@ require 'roqua/rom_api/start_protocol_subscription'
|
|
14
14
|
require 'roqua/rom_api/stop_protocol_subscription'
|
15
15
|
require 'roqua/rom_api/report_calculations'
|
16
16
|
require 'roqua/rom_api/get_questionnaire'
|
17
|
+
require 'roqua/rom_api/list_dossier_stats'
|
17
18
|
|
18
19
|
module Roqua
|
19
20
|
module RomApi
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ListDossierStats do
|
4
|
+
context 'Single Dossier' do
|
5
|
+
let(:options) { {epd_ids: '1'} }
|
6
|
+
let(:api_path) { "/dossiers/#{options[:epd_ids]}/stats" }
|
7
|
+
let(:response) do
|
8
|
+
httparty_response("1" => {"responses" => {"total" => 10}, "invitations" => {"total" => 3}})
|
9
|
+
end
|
10
|
+
let(:session) { Fabricate :basic_auth_session }
|
11
|
+
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
12
|
+
|
13
|
+
it 'performs a GET on the stats API' do
|
14
|
+
allow(session).to receive(:get).with(api_path).and_return response
|
15
|
+
stats = ListDossierStats.run(options).result
|
16
|
+
|
17
|
+
# binding.pry
|
18
|
+
|
19
|
+
expect(stats.dossiers).to be_a(Hash)
|
20
|
+
expect(stats.dossiers).to have_key("1")
|
21
|
+
expect(stats.dossiers["1"]).to be_a(DossierStats)
|
22
|
+
expect(stats.dossiers.size).to be 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'Multiple Dossiers' do
|
27
|
+
let(:options) { {epd_ids: '1,2,3'} }
|
28
|
+
let(:api_path) { "/dossiers/#{options[:epd_ids]}/stats" }
|
29
|
+
let(:response) do
|
30
|
+
httparty_response(
|
31
|
+
"1" => {"responses" => {"total" => 10}, "invitations" => {"total" => 3}},
|
32
|
+
"2" => {"responses" => {"total" => 10}, "invitations" => {"total" => 3}},
|
33
|
+
"3" => {"responses" => {"total" => 10}, "invitations" => {"total" => 3}}
|
34
|
+
)
|
35
|
+
end
|
36
|
+
let(:session) { Fabricate :basic_auth_session }
|
37
|
+
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
38
|
+
|
39
|
+
it 'performs a GET on the stats API' do
|
40
|
+
allow(session).to receive(:get).with(api_path).and_return response
|
41
|
+
stats = ListDossierStats.run(options).result
|
42
|
+
|
43
|
+
expect(stats.dossiers).to be_a(Hash)
|
44
|
+
expect(stats.dossiers).to have_key("3")
|
45
|
+
expect(stats.dossiers["3"]).to be_a(DossierStats)
|
46
|
+
expect(stats.dossiers.size).to be 3
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DossierStats do
|
4
|
+
let(:dossier) do
|
5
|
+
{
|
6
|
+
"responses" => {"total" => 10},
|
7
|
+
"invitations" => {"total" => 2},
|
8
|
+
"protocol_subscriptions" => {"total" => 4}
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'assigns fields to attr_accessors' do
|
13
|
+
dossier_stats = DossierStats.new dossier
|
14
|
+
|
15
|
+
expect(dossier_stats.responses["total"]).to eq 10
|
16
|
+
expect(dossier_stats.invitations["total"]).to eq 2
|
17
|
+
expect(dossier_stats.protocol_subscriptions["total"]).to eq 4
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Stats do
|
4
|
+
let(:response_body) do
|
5
|
+
{
|
6
|
+
'1' => {
|
7
|
+
"responses" => {"total" => 10},
|
8
|
+
"invitations" => {"total" => 2},
|
9
|
+
"protocol_subscriptions" => {"total" => 4}
|
10
|
+
},
|
11
|
+
'2' => {
|
12
|
+
"responses" => {"total" => 10},
|
13
|
+
"invitations" => {"total" => 2},
|
14
|
+
"protocol_subscriptions" => {"total" => 4}
|
15
|
+
},
|
16
|
+
'4' => {
|
17
|
+
"responses" => {"total" => 11},
|
18
|
+
"invitations" => {"total" => 7},
|
19
|
+
"protocol_subscriptions" => {"total" => 1}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'assigns fields to attr_accessors' do
|
25
|
+
stats = Stats.new dossiers: response_body
|
26
|
+
|
27
|
+
expect(stats.dossiers.size).to eq 3
|
28
|
+
|
29
|
+
expect(stats.dossiers["4"].responses["total"]).to eq 11
|
30
|
+
expect(stats.dossiers["4"].invitations["total"]).to eq 7
|
31
|
+
expect(stats.dossiers["4"].protocol_subscriptions["total"]).to eq 1
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-rom-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Esposito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -146,14 +146,17 @@ files:
|
|
146
146
|
- lib/roqua/rom_api/create_response.rb
|
147
147
|
- lib/roqua/rom_api/endpoint.rb
|
148
148
|
- lib/roqua/rom_api/get_questionnaire.rb
|
149
|
+
- lib/roqua/rom_api/list_dossier_stats.rb
|
149
150
|
- lib/roqua/rom_api/list_protocol_subscriptions.rb
|
150
151
|
- lib/roqua/rom_api/list_responses.rb
|
151
152
|
- lib/roqua/rom_api/models.rb
|
153
|
+
- lib/roqua/rom_api/models/dossier_stats.rb
|
152
154
|
- lib/roqua/rom_api/models/fill_out_request.rb
|
153
155
|
- lib/roqua/rom_api/models/measurement_sequence.rb
|
154
156
|
- lib/roqua/rom_api/models/protocol_subscription.rb
|
155
157
|
- lib/roqua/rom_api/models/questionnaire.rb
|
156
158
|
- lib/roqua/rom_api/models/response.rb
|
159
|
+
- lib/roqua/rom_api/models/stats.rb
|
157
160
|
- lib/roqua/rom_api/report_calculations.rb
|
158
161
|
- lib/roqua/rom_api/sessions.rb
|
159
162
|
- lib/roqua/rom_api/sessions/basic_auth_session.rb
|
@@ -167,11 +170,14 @@ files:
|
|
167
170
|
- spec/lib/roqua/rom_api/create_fill_out_request_spec.rb
|
168
171
|
- spec/lib/roqua/rom_api/create_response_spec.rb
|
169
172
|
- spec/lib/roqua/rom_api/endpoint_spec.rb
|
173
|
+
- spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
|
170
174
|
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
171
175
|
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
176
|
+
- spec/lib/roqua/rom_api/models/dossier_stats_spec.rb
|
172
177
|
- spec/lib/roqua/rom_api/models/fill_out_request_spec.rb
|
173
178
|
- spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb
|
174
179
|
- spec/lib/roqua/rom_api/models/response_spec.rb
|
180
|
+
- spec/lib/roqua/rom_api/models/stats_spec.rb
|
175
181
|
- spec/lib/roqua/rom_api/report_calculations_spec.rb
|
176
182
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
177
183
|
- spec/lib/roqua/rom_api/start_fill_out_session_spec.rb
|
@@ -202,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
208
|
version: '0'
|
203
209
|
requirements: []
|
204
210
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.2.2
|
206
212
|
signing_key:
|
207
213
|
specification_version: 4
|
208
214
|
summary: API wrapper gem around RoQua's ROM API
|
@@ -211,11 +217,14 @@ test_files:
|
|
211
217
|
- spec/lib/roqua/rom_api/create_fill_out_request_spec.rb
|
212
218
|
- spec/lib/roqua/rom_api/create_response_spec.rb
|
213
219
|
- spec/lib/roqua/rom_api/endpoint_spec.rb
|
220
|
+
- spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
|
214
221
|
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
215
222
|
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
223
|
+
- spec/lib/roqua/rom_api/models/dossier_stats_spec.rb
|
216
224
|
- spec/lib/roqua/rom_api/models/fill_out_request_spec.rb
|
217
225
|
- spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb
|
218
226
|
- spec/lib/roqua/rom_api/models/response_spec.rb
|
227
|
+
- spec/lib/roqua/rom_api/models/stats_spec.rb
|
219
228
|
- spec/lib/roqua/rom_api/report_calculations_spec.rb
|
220
229
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
221
230
|
- spec/lib/roqua/rom_api/start_fill_out_session_spec.rb
|