roqua-rom-api 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: 0e9e8469650f722f5c56ad4df3eb6762e7054001
4
- data.tar.gz: eb58901e56a066fc16656e51929d4b57e9916315
3
+ metadata.gz: 1232ec18176d8cb41e579dadce78775014e70034
4
+ data.tar.gz: 94bd0b445ebc2ea4cd317312ca3e2c2c410753fe
5
5
  SHA512:
6
- metadata.gz: b72e1e737e6a9389e2a34578dc9b12545b5338ba9b336227654031baf6af8f1d982ecce08294d16ca9f0996a8131b09f6b3f8f94539734c211881ae8f6ded730
7
- data.tar.gz: 711f77ac9d5a8d642bf1dba8b293cd479fa9f84b8741069aec6e7556ad5955522b4603902eefc82e219d8c4e4c1e4c11a875dffcf69697fea4a4a16001eaeb8d
6
+ metadata.gz: d37f46dface65bab1ce4a1607dda74d34285b48187f8d5982a5df0702355c8bd9cf03dfd86582fdce61b8b7a79d66af5d1b31a0ca0b82f4c9a5a9a8c36d5c220
7
+ data.tar.gz: a3dbaf436487a0951aa6dd1ea0bed1b145142f7f05db105ade285950bc4b709857b95b1509fbb935e9c39e72628726256808ef7e87062813d701eddf61291704
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### HEAD
2
2
 
3
+ ### 2.2.0 / 2017-02-12
4
+
5
+ * Added ListNonResponses
6
+ * Added GetNonResponse
7
+ * Added sbg_info to responses
8
+
3
9
  ### 2.1.0 / 2017-02-07
4
10
 
5
11
  * Added ListProtocollen
data/README.md CHANGED
@@ -120,6 +120,11 @@ To store external data on an existing pending response:
120
120
  id: 230, # response id,
121
121
  answer_data: {some: 'aswer_data'}
122
122
 
123
+ ## [NonResponses](http://docs.roqua.net/developer/rom/dossier/non_responses/)
124
+
125
+ * [List](Roqua/RomApi/ListNonResponses.html)
126
+ * [Get](Roqua/RomApi/GetNonResponse.html)
127
+
123
128
  ## [Protocols](http://docs.roqua.net/developer/rom/global/protocols/)
124
129
 
125
130
  ### List
data/lib/roqua/rom_api.rb CHANGED
@@ -21,6 +21,8 @@ require 'roqua/rom_api/get_protocol'
21
21
  require 'roqua/rom_api/get_measurement'
22
22
  require 'roqua/rom_api/get_respondent'
23
23
  require 'roqua/rom_api/list_respondents'
24
+ require 'roqua/rom_api/list_non_responses'
25
+ require 'roqua/rom_api/get_non_response'
24
26
 
25
27
  module Roqua
26
28
  module RomApi
@@ -0,0 +1,27 @@
1
+ module Roqua
2
+ module RomApi
3
+ # @!method run!(dossier_id: 'some_epd_id', non_response_id: 1)
4
+ # Retrieve specified non_response from specified dossier.
5
+ # @!scope class
6
+ # @return [Models::NonResponse]
7
+ # @param dossier_id: [String] epd_id of dossier (required)
8
+ # @param non_response_id: [Integer] (required)
9
+ # @see http://docs.roqua.net/developer/rom/dossier/non_responses#show json api
10
+ class GetNonResponse < Endpoint
11
+ string :dossier_id
12
+ integer :non_response_id
13
+
14
+ private
15
+
16
+ def execute
17
+ validate_response_for do
18
+ basic_auth_session.get "/dossiers/#{dossier_id}/non_responses/#{non_response_id}"
19
+ end
20
+ end
21
+
22
+ def response_to_result(response)
23
+ Models::NonResponse.new(response)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,10 +3,11 @@ module Roqua
3
3
  # @api private
4
4
  class GetQuestionnaire < Endpoint
5
5
  string :questionnaire_key
6
+ boolean :use_legacy_keys, default: true
6
7
 
7
8
  def execute
8
9
  validate_response_for do
9
- basic_auth_session.get "/questionnaires/#{questionnaire_key}"
10
+ basic_auth_session.get "/questionnaires/#{questionnaire_key}", use_legacy_keys: use_legacy_keys
10
11
  end
11
12
  end
12
13
 
@@ -0,0 +1,25 @@
1
+ module Roqua
2
+ module RomApi
3
+ # @!method run!(dossier_id: 'some_epd_id')
4
+ # Retrieve all non_responses belonging to specified dossier.
5
+ # @!scope class
6
+ # @return [Array<Models::NonResponse>]
7
+ # @param dossier_id: [String] epd_id of dossier (required)
8
+ # @see http://docs.roqua.net/developer/rom/dossier/non_responses#index json api
9
+ class ListNonResponses < Endpoint
10
+ string :dossier_id
11
+
12
+ private
13
+
14
+ def execute
15
+ validate_response_for do
16
+ basic_auth_session.get "/dossiers/#{dossier_id}/non_responses"
17
+ end
18
+ end
19
+
20
+ def response_to_result(response)
21
+ response.map { |r| Models::NonResponse.new(r) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -8,3 +8,4 @@ require 'roqua/rom_api/models/measurement'
8
8
  require 'roqua/rom_api/models/protocol'
9
9
  require 'roqua/rom_api/models/dossier_stats'
10
10
  require 'roqua/rom_api/models/stats'
11
+ require 'roqua/rom_api/models/non_response'
@@ -0,0 +1,33 @@
1
+ require 'virtus'
2
+
3
+ module Roqua
4
+ module RomApi
5
+ module Models
6
+ class NonResponse
7
+ include Virtus.model
8
+
9
+ # @!attribute [r] id
10
+ # @return [Integer]
11
+ attribute :id, Integer
12
+ # @!attribute non_response_at
13
+ # @return [DateTime]
14
+ attribute :non_response_at, DateTime
15
+ # @!attribute response_ids
16
+ # @return [Array<Integer>]
17
+ attribute :response_ids, Array[Integer]
18
+ # @!attribute reason_group
19
+ # @return [String]
20
+ attribute :reason_group, String
21
+ # @!attribute reason_option
22
+ # @return [String]
23
+ attribute :reason_option, String
24
+ # @!attribute reason_code
25
+ # @return [String]
26
+ attribute :reason_code, String
27
+ # @!attribute reason_other
28
+ # @return [String]
29
+ attribute :reason_other, String
30
+ end
31
+ end
32
+ end
33
+ end
@@ -14,6 +14,7 @@ module Roqua
14
14
  attribute :short_description, String
15
15
  attribute :questions, Hash
16
16
  attribute :scores, Hash
17
+ attribute :sbg_info, Hash
17
18
  attribute :textvars, Hash
18
19
  attribute :flags, Hash
19
20
  attribute :charts, Array
@@ -10,6 +10,8 @@ module Roqua
10
10
  attribute :respondent_id, Integer
11
11
  attribute :questionnaire_name, String
12
12
  attribute :questionnaire_key, String
13
+ attribute :measurement_id, Integer
14
+ attribute :non_response_id, Integer
13
15
  attribute :open_from, DateTime
14
16
  attribute :open_till, DateTime
15
17
  attribute :started_at, DateTime
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module RomApi
3
- VERSION = '2.1.0'
3
+ VERSION = '2.2.0'
4
4
  end
5
5
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe GetNonResponse do
4
+ let(:options) { {dossier_id: 'some_epd_id', non_response_id: 1} }
5
+ let(:api_path) { "/dossiers/#{options[:dossier_id]}/non_responses/1" }
6
+ let(:response) { httparty_response \
7
+ 'id' => 1,
8
+ 'non_response_at' => "2017-02-08T11:02:41+01:00",
9
+ 'response_ids' => [1, 5, 9],
10
+ 'reason_group' => "Patiënt is wel benaderd voor de ROM meting, maar:",
11
+ 'reason_option' => "Patiënt retourneert meetinstrument niet.",
12
+ 'reason_code' => '04',
13
+ 'reason_other' => 'ik type, dus ik ben' }
14
+ let(:session) { Fabricate :basic_auth_session }
15
+ before { allow(BasicAuthSession).to receive(:new).and_return session }
16
+
17
+ it 'returns non_response objects' do
18
+ allow(session).to receive(:get).with(api_path).and_return response
19
+ non_response = GetNonResponse.run(options).result
20
+
21
+ expect(non_response.id).to eq 1
22
+ expect(non_response.non_response_at).to eq Time.parse("2017-02-08T11:02:41+01:00")
23
+ expect(non_response.response_ids).to eq [1, 5, 9]
24
+ expect(non_response.reason_group).to eq "Patiënt is wel benaderd voor de ROM meting, maar:"
25
+ expect(non_response.reason_option).to eq "Patiënt retourneert meetinstrument niet."
26
+ expect(non_response.reason_code).to eq '04'
27
+ expect(non_response.reason_other).to eq 'ik type, dus ik ben'
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe ListNonResponses do
4
+ let(:options) { {dossier_id: 'some_epd_id'} }
5
+ let(:api_path) { "/dossiers/#{options[:dossier_id]}/non_responses" }
6
+ let(:response) { httparty_response [{
7
+ 'id' => 1,
8
+ 'non_response_at' => "2017-02-08T11:02:41+01:00",
9
+ 'response_ids' => [1, 5, 9],
10
+ 'reason_group' => "Patiënt is wel benaderd voor de ROM meting, maar:",
11
+ 'reason_option' => "Patiënt retourneert meetinstrument niet.",
12
+ 'reason_code' => '04',
13
+ 'reason_other' => 'ik type, dus ik ben'}] }
14
+ let(:session) { Fabricate :basic_auth_session }
15
+ before { allow(BasicAuthSession).to receive(:new).and_return session }
16
+
17
+ it 'returns non_response objects' do
18
+ allow(session).to receive(:get).with(api_path).and_return response
19
+ non_responses = ListNonResponses.run(options).result
20
+
21
+ expect(non_responses.first.id).to eq 1
22
+ expect(non_responses.first.non_response_at).to eq Time.parse("2017-02-08T11:02:41+01:00")
23
+ expect(non_responses.first.response_ids).to eq [1, 5, 9]
24
+ expect(non_responses.first.reason_group).to eq "Patiënt is wel benaderd voor de ROM meting, maar:"
25
+ expect(non_responses.first.reason_option).to eq "Patiënt retourneert meetinstrument niet."
26
+ expect(non_responses.first.reason_code).to eq '04'
27
+ expect(non_responses.first.reason_other).to eq 'ik type, dus ik ben'
28
+ end
29
+ end
@@ -4,6 +4,9 @@ describe Response do
4
4
  let(:response_body) do
5
5
  {'questionnaire_name' => 'RS-12',
6
6
  'questionnaire_key' => 'rs12',
7
+ 'respondent_id' => 2,
8
+ 'measurement_id' => 3,
9
+ 'non_response_id' => 4,
7
10
  'open_from' => '2014-02-19T14:15:49+01:00',
8
11
  'open_till' => '2014-02-20T14:15:49+01:00',
9
12
  'started_at' => '2014-02-19T15:15:49+01:00',
@@ -19,6 +22,9 @@ describe Response do
19
22
  response = Response.new response_body
20
23
  expect(response.questionnaire_name).to eq 'RS-12'
21
24
  expect(response.questionnaire_key).to eq 'rs12'
25
+ expect(response.respondent_id).to eq 2
26
+ expect(response.measurement_id).to eq 3
27
+ expect(response.non_response_id).to eq 4
22
28
  expect(response.open_from).to eq DateTime.parse('2014-02-19T14:15:49+01:00')
23
29
  expect(response.open_till).to eq DateTime.parse('2014-02-20T14:15:49+01:00')
24
30
  expect(response.started_at).to eq DateTime.parse('2014-02-19T15:15:49+01:00')
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: 2.1.0
4
+ version: 2.2.0
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: 2017-02-07 00:00:00.000000000 Z
15
+ date: 2017-02-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: httparty
@@ -165,10 +165,12 @@ files:
165
165
  - lib/roqua/rom_api/create_response.rb
166
166
  - lib/roqua/rom_api/endpoint.rb
167
167
  - lib/roqua/rom_api/get_measurement.rb
168
+ - lib/roqua/rom_api/get_non_response.rb
168
169
  - lib/roqua/rom_api/get_protocol.rb
169
170
  - lib/roqua/rom_api/get_questionnaire.rb
170
171
  - lib/roqua/rom_api/get_respondent.rb
171
172
  - lib/roqua/rom_api/list_dossier_stats.rb
173
+ - lib/roqua/rom_api/list_non_responses.rb
172
174
  - lib/roqua/rom_api/list_protocol_subscriptions.rb
173
175
  - lib/roqua/rom_api/list_protocols.rb
174
176
  - lib/roqua/rom_api/list_respondents.rb
@@ -178,6 +180,7 @@ files:
178
180
  - lib/roqua/rom_api/models/fill_out_request.rb
179
181
  - lib/roqua/rom_api/models/measurement.rb
180
182
  - lib/roqua/rom_api/models/measurement_sequence.rb
183
+ - lib/roqua/rom_api/models/non_response.rb
181
184
  - lib/roqua/rom_api/models/protocol.rb
182
185
  - lib/roqua/rom_api/models/protocol_subscription.rb
183
186
  - lib/roqua/rom_api/models/questionnaire.rb
@@ -199,9 +202,11 @@ files:
199
202
  - spec/lib/roqua/rom_api/create_response_spec.rb
200
203
  - spec/lib/roqua/rom_api/endpoint_spec.rb
201
204
  - spec/lib/roqua/rom_api/get_measurement_spec.rb
205
+ - spec/lib/roqua/rom_api/get_non_response_spec.rb
202
206
  - spec/lib/roqua/rom_api/get_protocol_spec.rb
203
207
  - spec/lib/roqua/rom_api/get_respondent_spec.rb
204
208
  - spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
209
+ - spec/lib/roqua/rom_api/list_non_responses_spec.rb
205
210
  - spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
206
211
  - spec/lib/roqua/rom_api/list_protocols_spec.rb
207
212
  - spec/lib/roqua/rom_api/list_respondents_spec.rb
@@ -242,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
247
  version: '0'
243
248
  requirements: []
244
249
  rubyforge_project:
245
- rubygems_version: 2.6.8
250
+ rubygems_version: 2.5.1
246
251
  signing_key:
247
252
  specification_version: 4
248
253
  summary: API wrapper gem around RoQua's ROM API
@@ -253,9 +258,11 @@ test_files:
253
258
  - spec/lib/roqua/rom_api/create_response_spec.rb
254
259
  - spec/lib/roqua/rom_api/endpoint_spec.rb
255
260
  - spec/lib/roqua/rom_api/get_measurement_spec.rb
261
+ - spec/lib/roqua/rom_api/get_non_response_spec.rb
256
262
  - spec/lib/roqua/rom_api/get_protocol_spec.rb
257
263
  - spec/lib/roqua/rom_api/get_respondent_spec.rb
258
264
  - spec/lib/roqua/rom_api/list_dossier_stats_spec.rb
265
+ - spec/lib/roqua/rom_api/list_non_responses_spec.rb
259
266
  - spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
260
267
  - spec/lib/roqua/rom_api/list_protocols_spec.rb
261
268
  - spec/lib/roqua/rom_api/list_respondents_spec.rb