roqua-rom-api 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/lib/roqua/rom_api/cancel_fill_out_request.rb +6 -1
- data/lib/roqua/rom_api/create_fill_out_request.rb +11 -3
- data/lib/roqua/rom_api/models/protocol.rb +15 -0
- data/lib/roqua/rom_api/models/respondent.rb +1 -0
- data/lib/roqua/rom_api/start_protocol_subscription.rb +3 -2
- data/lib/roqua/rom_api/version.rb +1 -1
- data/spec/fabricators/basic_auth_session_fabricator.rb +1 -1
- data/spec/lib/roqua/rom_api/models/fill_out_request_spec.rb +2 -2
- data/spec/lib/roqua/rom_api/models/response_spec.rb +2 -2
- data/spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb +1 -1
- data/spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb +3 -1
- data/spec/spec_helper.rb +5 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f93240e16e4d8389c9b002a0093974f5eb830c8b7b52ae38751d92dc90cb9295
|
4
|
+
data.tar.gz: e4dea8ee1a71809ad2e4dcf70663ac2ec5c912aff199a16a8f8fc09b28f48389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a101b1214e3b626007dcc9a49c1531deb3fa986d83b82f750f208230de88fe7619724667f7851676e74714040a5ecd402bafe4bec4ecd3c9af4d8cfd9a658d
|
7
|
+
data.tar.gz: 877e509d76bbd5de5f8b538ffdb5da70f5b5b992549f1cf6e43db674af12df2c532b8868283c1dae1a8cbb371dc85c052c805b98e7a668b0cdce337be4738114
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
module Roqua
|
2
2
|
module RomApi
|
3
|
-
# @
|
3
|
+
# @example To create a fill out request run:
|
4
|
+
# Roqua::RomApi::CancelFillOutRequest.run! \
|
5
|
+
# dossier_id: dossier_id,
|
6
|
+
# fill_out_request_id: for_id
|
4
7
|
class CancelFillOutRequest < Endpoint
|
5
8
|
string :dossier_id
|
6
9
|
string :fill_out_request_id
|
7
10
|
|
11
|
+
private
|
12
|
+
|
8
13
|
def execute
|
9
14
|
validate_response_for do
|
10
15
|
basic_auth_session.delete("/dossiers/#{dossier_id}/fill_out_requests/#{fill_out_request_id}")
|
@@ -1,6 +1,12 @@
|
|
1
1
|
module Roqua
|
2
2
|
module RomApi
|
3
|
-
# @
|
3
|
+
# @example To create a fill out request run:
|
4
|
+
# Roqua::RomApi::CreateFillOutRequest.run! \
|
5
|
+
# dossier_id: dossier_id,
|
6
|
+
# questionnaire_keys: ['key1', 'key2'],
|
7
|
+
# callback_url: notify_callback_path(token: 'secret')
|
8
|
+
#
|
9
|
+
# @see http://docs.roqua.net/developer/rom/dossier/fill_out_requests/ for more info on how callbacks work.
|
4
10
|
class CreateFillOutRequest < Endpoint
|
5
11
|
string :dossier_id
|
6
12
|
integer :measurement_sequence_id, default: nil
|
@@ -8,11 +14,13 @@ module Roqua
|
|
8
14
|
string :respondent_type, default: nil
|
9
15
|
string :callback_url, default: nil
|
10
16
|
array :reminders, default: []
|
11
|
-
time
|
12
|
-
time
|
17
|
+
time :open_from, default: nil, allow_nil: true
|
18
|
+
time :open_till, default: nil, allow_nil: true
|
13
19
|
|
14
20
|
validates :dossier_id, presence: {allow_blank: false}
|
15
21
|
|
22
|
+
private
|
23
|
+
|
16
24
|
def execute
|
17
25
|
validate_response_for do
|
18
26
|
fill_out_request = {
|
@@ -6,11 +6,26 @@ module Roqua
|
|
6
6
|
class Protocol
|
7
7
|
include Virtus.model
|
8
8
|
|
9
|
+
# @!attribute [r] id
|
10
|
+
# @return [Integer]
|
9
11
|
attribute :id, Integer
|
12
|
+
# @!attribute key
|
13
|
+
# @return [String]
|
14
|
+
attribute :key, String
|
15
|
+
# @!attribute name
|
16
|
+
# @return [String]
|
10
17
|
attribute :name, String
|
18
|
+
# @!attribute description
|
19
|
+
# @return [String]
|
11
20
|
attribute :description, String
|
21
|
+
# @!attribute active
|
22
|
+
# @return [Boolean]
|
12
23
|
attribute :active, Boolean
|
24
|
+
# @!attribute automatic
|
25
|
+
# @return [Boolean]
|
13
26
|
attribute :automatic, Boolean
|
27
|
+
# @!attribute measurements
|
28
|
+
# @return [Array<Measurement>]
|
14
29
|
attribute :measurements, Array[Models::Measurement]
|
15
30
|
end
|
16
31
|
end
|
@@ -3,13 +3,14 @@ module Roqua
|
|
3
3
|
# @api private
|
4
4
|
class StartProtocolSubscription < Endpoint
|
5
5
|
string :dossier_id
|
6
|
-
string :protocol_key
|
6
|
+
string :protocol_key, default: nil # Pass the key
|
7
|
+
integer :protocol_id, default: nil # or the id
|
7
8
|
time :start_at, default: nil
|
8
9
|
hash :flags, default: {}, strip: false
|
9
10
|
hash :textvars, default: {}, strip: false
|
10
11
|
|
11
12
|
def execute
|
12
|
-
options = {protocol_key: protocol_key, flags: flags, textvars: textvars}
|
13
|
+
options = {protocol_key: protocol_key, protocol_id: protocol_id, flags: flags, textvars: textvars}
|
13
14
|
options[:start_at] = start_at.to_i if start_at
|
14
15
|
validate_response_for do
|
15
16
|
basic_auth_session.post("/dossiers/#{dossier_id}/protocol_subscriptions", options)
|
@@ -2,6 +2,6 @@ Fabricator(:basic_auth_session, from: Roqua::RomApi::Sessions::BasicAuthSession)
|
|
2
2
|
initialize_with do
|
3
3
|
Roqua::RomApi::Sessions::BasicAuthSession.new username: 'some_username',
|
4
4
|
password: 'some_password',
|
5
|
-
rom_host: 'http://roqua.
|
5
|
+
rom_host: 'http://test.rom.roqua.eu'
|
6
6
|
end
|
7
7
|
end
|
@@ -4,7 +4,7 @@ describe FillOutRequest do
|
|
4
4
|
let(:response_body) do
|
5
5
|
{'id' => 123,
|
6
6
|
'respondent_type' => 'patient_version',
|
7
|
-
'completing_url' => 'http://roqua.
|
7
|
+
'completing_url' => 'http://test.rom.roqua.eu/client/session/new?token=26aee9a4'
|
8
8
|
}
|
9
9
|
end
|
10
10
|
|
@@ -12,6 +12,6 @@ describe FillOutRequest do
|
|
12
12
|
response = FillOutRequest.new response_body
|
13
13
|
expect(response.id).to eq 123
|
14
14
|
expect(response.respondent_type).to eq 'patient_version'
|
15
|
-
expect(response.completing_url).to eq 'http://roqua.
|
15
|
+
expect(response.completing_url).to eq 'http://test.rom.roqua.eu/client/session/new?token=26aee9a4'
|
16
16
|
end
|
17
17
|
end
|
@@ -13,7 +13,7 @@ describe Response do
|
|
13
13
|
'completer_type' => 'patient',
|
14
14
|
'completed_at' => nil,
|
15
15
|
'status' => 'open',
|
16
|
-
'completing_url' => 'http://roqua.
|
16
|
+
'completing_url' => 'http://test.rom.roqua.eu/client/session/new?token=26aee9a4',
|
17
17
|
'values' => {'some' => 'values'},
|
18
18
|
'outcome' => {'some' => 'outcome'}}
|
19
19
|
end
|
@@ -31,7 +31,7 @@ describe Response do
|
|
31
31
|
expect(response.completed_at).to eq nil
|
32
32
|
expect(response.completer_type).to eq 'patient'
|
33
33
|
expect(response.status).to eq 'open'
|
34
|
-
expect(response.completing_url).to eq 'http://roqua.
|
34
|
+
expect(response.completing_url).to eq 'http://test.rom.roqua.eu/client/session/new?token=26aee9a4'
|
35
35
|
expect(response.values).to eq('some' => 'values')
|
36
36
|
expect(response.outcome).to eq('some' => 'outcome')
|
37
37
|
end
|
@@ -48,7 +48,7 @@ describe BasicAuthSession do
|
|
48
48
|
|
49
49
|
describe '#get' do
|
50
50
|
it 'performs a get request' do
|
51
|
-
expect(HTTParty).to receive(:get).with('http://roqua.
|
51
|
+
expect(HTTParty).to receive(:get).with('http://test.rom.roqua.eu/api/v1/some_path.json',
|
52
52
|
query: {some: 'param'},
|
53
53
|
basic_auth: {username: 'some_username', password: 'some_password'})
|
54
54
|
.and_return(response)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe StartProtocolSubscription do
|
4
|
-
let(:options) { {dossier_id: 'some_dossier_id', protocol_key: 'some_key',
|
4
|
+
let(:options) { {dossier_id: 'some_dossier_id', protocol_key: 'some_key', protocol_id: nil,
|
5
5
|
flags: {some_flag: true}, textvars: {some_var: 'string'}} }
|
6
6
|
let(:session) { Sessions::BasicAuthSession.new }
|
7
7
|
let(:response) { httparty_response({}) }
|
@@ -13,6 +13,7 @@ describe StartProtocolSubscription do
|
|
13
13
|
it 'does a post to the rom protocol_subscription api' do
|
14
14
|
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions",
|
15
15
|
protocol_key: options[:protocol_key],
|
16
|
+
protocol_id: options[:protocol_id],
|
16
17
|
flags: {some_flag: true},
|
17
18
|
textvars: {some_var: 'string'})
|
18
19
|
StartProtocolSubscription.run!(options)
|
@@ -22,6 +23,7 @@ describe StartProtocolSubscription do
|
|
22
23
|
start_at = Time.now
|
23
24
|
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/protocol_subscriptions",
|
24
25
|
protocol_key: options[:protocol_key],
|
26
|
+
protocol_id: options[:protocol_id],
|
25
27
|
start_at: start_at.to_i,
|
26
28
|
flags: {some_flag: true},
|
27
29
|
textvars: {some_var: 'string'})
|
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,11 @@ include Roqua::RomApi
|
|
6
6
|
include Roqua::RomApi::Sessions
|
7
7
|
include Roqua::RomApi::Models
|
8
8
|
|
9
|
+
# It seems sometimes the Rails constant is defined and Rails.root is injected (which is nil at that moment) resulting
|
10
|
+
# in missing fabricators. Let's just set the path to the current directory to fix this. See:
|
11
|
+
# https://github.com/paulelliott/fabrication/blob/42db96f11cbf80d22bd9c87dbf6740894c2b2bdc/lib/fabrication/config.rb#L42
|
12
|
+
Fabrication::Config.path_prefix = ['.']
|
13
|
+
|
9
14
|
Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'support', '*.rb')].each {|f| require f}
|
10
15
|
|
11
16
|
I18n.load_path << Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'support', '*.yml')]
|
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.2.
|
4
|
+
version: 2.2.1
|
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: 2018-06-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: httparty
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
250
|
+
rubygems_version: 2.7.6
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: API wrapper gem around RoQua's ROM API
|
@@ -283,4 +283,3 @@ test_files:
|
|
283
283
|
- spec/spec_helper.rb
|
284
284
|
- spec/support/httparty_helpers.rb
|
285
285
|
- spec/support/test.yml
|
286
|
-
has_rdoc:
|