roqua-rom-api 0.1.1 → 0.1.2
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/ChangeLog.md +22 -1
- data/README.md +12 -8
- data/config/locales/nl.yml +18 -0
- data/config/locales/validation_errors.nl.yml +56 -0
- data/lib/i18n/i18n.rb +12 -0
- data/lib/roqua-rom-api.rb +2 -1
- data/lib/roqua/rom_api.rb +2 -2
- data/lib/roqua/rom_api/endpoint.rb +10 -3
- data/lib/roqua/rom_api/{protocol_subscriptions.rb → list_protocol_subscriptions.rb} +3 -3
- data/lib/roqua/rom_api/{responses.rb → list_responses.rb} +3 -3
- data/lib/roqua/rom_api/models/protocol_subscription.rb +1 -2
- data/lib/roqua/rom_api/models/response.rb +9 -2
- data/lib/roqua/rom_api/start_fill_out_session.rb +6 -4
- data/lib/roqua/rom_api/version.rb +1 -1
- data/roqua_rom_api.gemspec +1 -2
- data/spec/lib/roqua/rom_api/endpoint_spec.rb +18 -9
- data/spec/lib/roqua/rom_api/{protocol_subscriptions_spec.rb → list_protocol_subscriptions_spec.rb} +4 -4
- data/spec/lib/roqua/rom_api/{responses_spec.rb → list_responses_spec.rb} +4 -4
- data/spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb +0 -1
- data/spec/lib/roqua/rom_api/models/response_spec.rb +10 -8
- data/spec/lib/roqua/rom_api/start_fill_out_session_spec.rb +6 -8
- metadata +15 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 955e1f5fc17c5ca47534572d1ab46b245201f087
|
4
|
+
data.tar.gz: 40ef22892320a4cf7e75672cb67687b4f09adc61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f3bb605f18114ead59c27d0fbcfe5ad39d520486709989fb6397264d30d95169e7a3762971ac69b30855b9331f6babe2c8f5bd2be5591e8f96496747bbbe9ab
|
7
|
+
data.tar.gz: 9583dbf69a04111b033450b19fa8930b5b66e7781b56522b6dad39bcae4d95f0c853236daacb6efcd84702e0e5d545c8e62e47ab3cf702d1c3b1c8d82f650a95
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
### 0.1.
|
1
|
+
### 0.1.2 / 2014-05-13
|
2
|
+
|
3
|
+
#### Responses API
|
4
|
+
* rename Responses to ListResponses
|
5
|
+
* return responses through `result` accessor
|
6
|
+
|
7
|
+
#### ProtocolSubscriptions API
|
8
|
+
* rename ProtocolSubscriptions to ListProtocolSubscriptions
|
9
|
+
* return protocol_subscriptions through `result` accessor
|
10
|
+
* remove `state` from ProtocolSubscriptions API
|
11
|
+
* only list active ProtocolSubscriptions
|
12
|
+
|
13
|
+
#### FillOutSessions API
|
14
|
+
* return questionnaire_url through `result` accessor
|
15
|
+
|
16
|
+
#### Localization
|
17
|
+
* Instead of full messages the HTTP API returns hashes with attribute and error keys. The Ruby Gem uses these keys to compile localized messages using I18n.
|
18
|
+
|
19
|
+
#### Validations
|
20
|
+
* Some of the 422 response codes are changed to 404 and will now raise an exception when using the Ruby Gem. See the [HTTP API documentation](http://roqua.github.io/developer/rom_v1/dossier/) for more info.
|
21
|
+
|
22
|
+
### 0.1.1 / 2014-04-23
|
2
23
|
|
3
24
|
* Validate api responses
|
4
25
|
* From now on the Responses API is accessible through the Responses interactor. The received responses can be obtained through the `#responses` accessor when the interactor outcome is valid.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# RoQua ROM API
|
2
2
|
|
3
3
|
Make sure the following environment variables are defined:
|
4
4
|
|
@@ -8,6 +8,10 @@ Make sure the following environment variables are defined:
|
|
8
8
|
|
9
9
|
An HTTP basic auth username password combination can be generated in the RoQua admin interface integration tab
|
10
10
|
|
11
|
+
## I18n
|
12
|
+
|
13
|
+
By default the ROM API Gem supports the `:nl` language only. If you use another locale or want to change some of the messages, simply extend your locale file by providing a value for some or all of the keys defined `config/locales/*.yml` in the root of this Gem.
|
14
|
+
|
11
15
|
## FillOut Sessions
|
12
16
|
|
13
17
|
To start filling out a questionnaire run:
|
@@ -25,7 +29,7 @@ To start filling out a questionnaire run:
|
|
25
29
|
Redirect to the questionnaire url received when the outcome is valid:
|
26
30
|
|
27
31
|
if outcome.valid?
|
28
|
-
redirect_to outcome.
|
32
|
+
redirect_to outcome.result
|
29
33
|
|
30
34
|
or do something with the validation errors:
|
31
35
|
|
@@ -38,16 +42,16 @@ or do something with the validation errors:
|
|
38
42
|
### Index
|
39
43
|
To retrieve active protocol subscriptions run:
|
40
44
|
|
41
|
-
outcome = Roqua::RomApi::
|
45
|
+
outcome = Roqua::RomApi::ListProtocolSubscriptions.run dossier_id: dossier_id
|
42
46
|
|
43
47
|
#### Parameters
|
44
48
|
|
45
49
|
* `dossier_id:` [Required] - Unique dossier identifier for the patient you want the subscriptions for.
|
46
50
|
|
47
|
-
When the request succeeds,
|
51
|
+
When the request succeeds, an array of subscriptions is returned:
|
48
52
|
|
49
53
|
if outcome.valid?
|
50
|
-
subscriptions = outcome.
|
54
|
+
subscriptions = outcome.result
|
51
55
|
|
52
56
|
Else some validation errors can be shown:
|
53
57
|
|
@@ -105,16 +109,16 @@ Else the validation errors can be inspected:
|
|
105
109
|
|
106
110
|
To retrieve filled out, pending or scheduled questionnaires run:
|
107
111
|
|
108
|
-
outcome = Roqua::RomApi::
|
112
|
+
outcome = Roqua::RomApi::ListResponses.run dossier_id: dossier_id
|
109
113
|
|
110
114
|
#### Parameters
|
111
115
|
|
112
116
|
* `dossier_id:` [Required] - Unique dossier identifier for the patient you want the responses for.
|
113
117
|
|
114
|
-
When the request succeeds,
|
118
|
+
When the request succeeds, an array of responses is returned:
|
115
119
|
|
116
120
|
if outcome.valid?
|
117
|
-
responses = outcome.
|
121
|
+
responses = outcome.result
|
118
122
|
|
119
123
|
Else some validation errors can be shown:
|
120
124
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
nl:
|
2
|
+
active_interaction:
|
3
|
+
errors:
|
4
|
+
models:
|
5
|
+
roqua/rom_api/start_fill_out_session:
|
6
|
+
attributes:
|
7
|
+
questionnaire_key:
|
8
|
+
questionnaire_not_found_by_key: met sleutel '%{value}' niet gevonden
|
9
|
+
roqua/rom_api/start_protocol_subscription:
|
10
|
+
attributes:
|
11
|
+
protocol_key:
|
12
|
+
protocol_not_found_by_key: met sleutel '%{value}' niet gevonden
|
13
|
+
attributes:
|
14
|
+
roqua/rom_api/start_fill_out_session:
|
15
|
+
questionnaire_key: Vragenlijst
|
16
|
+
return_to: Return url
|
17
|
+
roqua/rom_api/start_protocol_subscription:
|
18
|
+
protocol_key: Protocol
|
@@ -0,0 +1,56 @@
|
|
1
|
+
nl:
|
2
|
+
errors: &errors
|
3
|
+
format: ! '%{attribute} %{message}'
|
4
|
+
messages:
|
5
|
+
accepted: moet worden geaccepteerd
|
6
|
+
blank: moet opgegeven zijn
|
7
|
+
confirmation: komt niet met de bevestiging overeen
|
8
|
+
empty: moet opgegeven zijn
|
9
|
+
equal_to: moet gelijk zijn aan %{count}
|
10
|
+
even: moet even zijn
|
11
|
+
exclusion: is niet beschikbaar
|
12
|
+
greater_than: moet groter zijn dan %{count}
|
13
|
+
greater_than_or_equal_to: moet groter dan of gelijk zijn aan %{count}
|
14
|
+
inclusion: is niet in de lijst opgenomen
|
15
|
+
invalid: is ongeldig
|
16
|
+
less_than: moet minder zijn dan %{count}
|
17
|
+
less_than_or_equal_to: moet minder dan of gelijk zijn aan %{count}
|
18
|
+
not_a_number: is geen getal
|
19
|
+
not_an_integer: moet een geheel getal zijn
|
20
|
+
odd: moet oneven zijn
|
21
|
+
record_invalid: ! 'Validatie mislukt: %{errors}'
|
22
|
+
taken: is al in gebruik
|
23
|
+
too_long: is te lang (maximaal %{count} tekens)
|
24
|
+
too_short: is te kort (minimaal %{count} tekens)
|
25
|
+
wrong_length: heeft onjuiste lengte (moet %{count} tekens lang zijn)
|
26
|
+
invalid_key: mag enkel kleine letters, cijfers en underscores bevatten en moet beginnen met een letter.
|
27
|
+
valid_ip_addresses: moeten geldige IP-adressen zijn
|
28
|
+
template:
|
29
|
+
body: ! 'Controleer de volgende velden:'
|
30
|
+
header:
|
31
|
+
one: ! '%{model} niet opgeslagen: 1 fout gevonden'
|
32
|
+
other: ! '%{model} niet opgeslagen: %{count} fouten gevonden'
|
33
|
+
activemodel:
|
34
|
+
errors:
|
35
|
+
<<: *errors
|
36
|
+
activerecord:
|
37
|
+
errors:
|
38
|
+
<<: *errors
|
39
|
+
active_interaction:
|
40
|
+
errors:
|
41
|
+
messages:
|
42
|
+
invalid: is ongeldig
|
43
|
+
invalid_type: is geen geldige %{type}
|
44
|
+
missing: is vereist
|
45
|
+
types:
|
46
|
+
array: array
|
47
|
+
boolean: boolean
|
48
|
+
date: date
|
49
|
+
date_time: date time
|
50
|
+
file: file
|
51
|
+
float: float
|
52
|
+
hash: hash
|
53
|
+
integer: integer
|
54
|
+
model: model
|
55
|
+
string: string
|
56
|
+
time: time
|
data/lib/i18n/i18n.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
begin
|
2
|
+
require 'rails'
|
3
|
+
module I18n
|
4
|
+
class Railtie < ::Rails::Railtie #:nodoc:
|
5
|
+
initializer 'rails-i18n' do |app|
|
6
|
+
I18n.load_path << Dir[File.join(File.expand_path(File.dirname(__FILE__) + '/../../config/locales'), '*.yml')]
|
7
|
+
I18n.load_path.flatten!
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
rescue LoadError
|
12
|
+
end
|
data/lib/roqua-rom-api.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require 'roqua/rom_api'
|
1
|
+
require 'roqua/rom_api'
|
2
|
+
require 'i18n/i18n'
|
data/lib/roqua/rom_api.rb
CHANGED
@@ -3,8 +3,8 @@ require 'roqua/rom_api/version'
|
|
3
3
|
require 'roqua/rom_api/sessions'
|
4
4
|
require 'roqua/rom_api/models'
|
5
5
|
require 'roqua/rom_api/endpoint'
|
6
|
-
require 'roqua/rom_api/
|
7
|
-
require 'roqua/rom_api/
|
6
|
+
require 'roqua/rom_api/list_protocol_subscriptions'
|
7
|
+
require 'roqua/rom_api/list_responses'
|
8
8
|
require 'roqua/rom_api/start_fill_out_session'
|
9
9
|
require 'roqua/rom_api/start_protocol_subscription'
|
10
10
|
require 'roqua/rom_api/stop_protocol_subscription'
|
@@ -6,11 +6,18 @@ module Roqua
|
|
6
6
|
|
7
7
|
def validate_response_for
|
8
8
|
response = yield
|
9
|
-
if response && response['errors']
|
10
|
-
response['errors'].each do |
|
11
|
-
|
9
|
+
if response.is_a?(Hash) && response['errors']
|
10
|
+
response['errors'].each do |attribute, attribute_errors|
|
11
|
+
attribute_errors.each do |error|
|
12
|
+
errors.add attribute.to_sym, error.to_sym
|
13
|
+
end
|
12
14
|
end
|
15
|
+
else
|
16
|
+
response_to_result response
|
13
17
|
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def response_to_result(response)
|
14
21
|
response
|
15
22
|
end
|
16
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Roqua
|
2
2
|
module RomApi
|
3
3
|
# @api private
|
4
|
-
class
|
4
|
+
class ListProtocolSubscriptions < Endpoint
|
5
5
|
string :dossier_id
|
6
6
|
|
7
7
|
def execute
|
@@ -10,8 +10,8 @@ module Roqua
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def response_to_result(response)
|
14
|
+
response.map { |s| Models::ProtocolSubscription.new(s) }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Roqua
|
2
2
|
module RomApi
|
3
3
|
# @api private
|
4
|
-
class
|
4
|
+
class ListResponses < Endpoint
|
5
5
|
string :dossier_id
|
6
6
|
|
7
7
|
def execute
|
@@ -10,8 +10,8 @@ module Roqua
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def response_to_result(response)
|
14
|
+
response.map { |r| Models::Response.new(r) }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -2,14 +2,13 @@ module Roqua
|
|
2
2
|
module RomApi
|
3
3
|
module Models
|
4
4
|
class ProtocolSubscription
|
5
|
-
include Virtus
|
5
|
+
include Virtus.model
|
6
6
|
|
7
7
|
attribute :id, Integer
|
8
8
|
attribute :daily_start_time, Integer
|
9
9
|
attribute :next_run_time, DateTime
|
10
10
|
attribute :start_at, DateTime
|
11
11
|
attribute :stop_at, DateTime
|
12
|
-
attribute :state, String
|
13
12
|
attribute :protocol_key, String
|
14
13
|
attribute :protocol_name, String
|
15
14
|
|
@@ -4,15 +4,22 @@ module Roqua
|
|
4
4
|
module RomApi
|
5
5
|
module Models
|
6
6
|
class Response
|
7
|
-
include Virtus
|
7
|
+
include Virtus.model
|
8
8
|
|
9
|
-
attribute :
|
9
|
+
attribute :questionnaire_name, String
|
10
|
+
attribute :questionnaire_key, String
|
10
11
|
attribute :open_from, DateTime
|
11
12
|
attribute :open_till, DateTime
|
12
13
|
attribute :completing_url, String
|
13
14
|
attribute :completer_type, String
|
14
15
|
attribute :completed_at, DateTime
|
15
16
|
attribute :status, String
|
17
|
+
|
18
|
+
def name
|
19
|
+
ActiveSupport::Deprecation.warn(
|
20
|
+
'name is deprecated and will be removed in future releases, use questionnaire_name instead.', caller)
|
21
|
+
questionnaire_name
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -5,18 +5,20 @@ module Roqua
|
|
5
5
|
string :dossier_id
|
6
6
|
string :questionnaire_key
|
7
7
|
string :return_to
|
8
|
+
string :stylesheet, default: nil
|
8
9
|
|
9
10
|
def execute
|
10
11
|
validate_response_for do
|
11
12
|
RomApi.basic_auth_session.post("/dossiers/#{dossier_id}/fill_out_sessions",
|
12
13
|
questionnaire_key: questionnaire_key,
|
13
|
-
return_to: return_to
|
14
|
+
return_to: return_to,
|
15
|
+
stylesheet: stylesheet)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
18
|
-
|
19
|
+
def response_to_result(response)
|
20
|
+
response['questionnaire_url']
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
22
|
-
end
|
24
|
+
end
|
data/roqua_rom_api.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.add_dependency 'httparty', '~> 0.12.0'
|
20
20
|
gem.add_dependency 'active_interaction', '~> 1.1'
|
21
|
-
gem.add_dependency 'virtus'
|
22
|
-
# we keep it simple to be compliant with both.
|
21
|
+
gem.add_dependency 'virtus', '~> 1.0'
|
23
22
|
|
24
23
|
gem.add_development_dependency 'bundler', '~> 1.0'
|
25
24
|
gem.add_development_dependency 'rake', '~> 10.1'
|
@@ -9,28 +9,37 @@ describe Endpoint do
|
|
9
9
|
response.stringify_keys
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def response_to_result(response)
|
14
|
+
response['key']
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
describe 'with validations' do
|
15
|
-
it 'returns the response' do
|
16
|
-
outcome = TestEndpoint.run response: {'
|
17
|
-
expect(outcome.result).to eq(
|
19
|
+
it 'returns the parsed response' do
|
20
|
+
outcome = TestEndpoint.run response: {'key' => ['values']}
|
21
|
+
expect(outcome.result).to eq(['values'])
|
18
22
|
end
|
19
23
|
|
20
24
|
it 'is valid' do
|
21
|
-
result = TestEndpoint.run response: {'
|
25
|
+
result = TestEndpoint.run response: {'key' => ['values']}
|
22
26
|
expect(result).to be_valid
|
23
27
|
end
|
24
28
|
|
25
29
|
context 'when the response contains errors' do
|
26
30
|
it 'adds the errors' do
|
27
|
-
|
28
|
-
expect(
|
31
|
+
outcome = TestEndpoint.run response: {'errors' => {'base' => ['Some annoying error']}}
|
32
|
+
expect(outcome.errors.full_messages.first).to match('Some annoying error')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'marks the outcome as invalid' do
|
36
|
+
outcome = TestEndpoint.run response: {'errors' => {'base' => ['Some annoying error']}}
|
37
|
+
expect(outcome).not_to be_valid
|
29
38
|
end
|
30
39
|
|
31
|
-
it '
|
32
|
-
|
33
|
-
expect(result).
|
40
|
+
it 'does not return a result' do
|
41
|
+
outcome = TestEndpoint.run response: {'errors' => {'base' => ['Some annoying error']}}
|
42
|
+
expect(outcome.result).to be_nil
|
34
43
|
end
|
35
44
|
end
|
36
45
|
end
|
data/spec/lib/roqua/rom_api/{protocol_subscriptions_spec.rb → list_protocol_subscriptions_spec.rb}
RENAMED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ListProtocolSubscriptions do
|
4
4
|
let(:options) { {dossier_id: '1'} }
|
5
5
|
let(:api_path) { "/dossiers/#{options[:dossier_id]}/protocol_subscriptions" }
|
6
|
-
let(:response) {
|
6
|
+
let(:response) { [{"id" => 1}] }
|
7
7
|
let(:session) { Fabricate :basic_auth_session }
|
8
8
|
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
9
9
|
|
10
|
-
it 'returns an array of
|
10
|
+
it 'returns an array of protocol_subscriptions objects' do
|
11
11
|
allow(session).to receive(:get).with(api_path).and_return response
|
12
|
-
protocol_subscriptions =
|
12
|
+
protocol_subscriptions = ListProtocolSubscriptions.run(options).result
|
13
13
|
|
14
14
|
expect(protocol_subscriptions).to be_a(Array)
|
15
15
|
expect(protocol_subscriptions.first).to be_a(ProtocolSubscription)
|
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ListResponses do
|
4
4
|
let(:options) { {dossier_id: '1'} }
|
5
5
|
let(:api_path) { "/dossiers/#{options[:dossier_id]}/responses" }
|
6
|
-
let(:response) {
|
6
|
+
let(:response) { [{"questionnaire_name" => "response_1"}, {"questionnaire_name" => "response_2"}] }
|
7
7
|
let(:session) { Fabricate :basic_auth_session }
|
8
8
|
before { allow(BasicAuthSession).to receive(:new).and_return session }
|
9
9
|
|
10
10
|
it 'returns an array of response objects' do
|
11
11
|
allow(session).to receive(:get).with(api_path).and_return response
|
12
|
-
responses =
|
12
|
+
responses = ListResponses.run(options).result
|
13
13
|
|
14
14
|
expect(responses).to be_a(Array)
|
15
15
|
expect(responses.first).to be_a(Response)
|
16
|
-
expect(responses.first.
|
16
|
+
expect(responses.first.questionnaire_name).to eq('response_1')
|
17
17
|
end
|
18
18
|
end
|
@@ -19,7 +19,6 @@ describe ProtocolSubscription do
|
|
19
19
|
expect(protocol_subscription.next_run_time).to eq nil
|
20
20
|
expect(protocol_subscription.start_at).to eq DateTime.parse("2014-04-10T14:00:28+02:00")
|
21
21
|
expect(protocol_subscription.stop_at).to eq nil
|
22
|
-
expect(protocol_subscription.state).to eq "a"
|
23
22
|
expect(protocol_subscription.protocol_key).to eq 'pkey'
|
24
23
|
expect(protocol_subscription.protocol_name).to eq 'pname'
|
25
24
|
end
|
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Response do
|
4
4
|
let(:response_body) do
|
5
|
-
{'
|
5
|
+
{'questionnaire_name' => 'RS-12',
|
6
|
+
'questionnaire_key' => 'rs12',
|
6
7
|
'open_from' => '2014-02-19T14:15:49+01:00',
|
7
8
|
'open_till' => '2014-02-20T14:15:49+01:00',
|
8
9
|
'completer_type' => 'patient',
|
@@ -13,12 +14,13 @@ describe Response do
|
|
13
14
|
|
14
15
|
it 'assigns fields to attr_accessors' do
|
15
16
|
response = Response.new response_body
|
16
|
-
expect(response.
|
17
|
-
expect(response.
|
18
|
-
expect(response.
|
19
|
-
expect(response.
|
20
|
-
expect(response.
|
21
|
-
expect(response.
|
22
|
-
expect(response.
|
17
|
+
expect(response.questionnaire_name).to eq 'RS-12'
|
18
|
+
expect(response.questionnaire_key).to eq 'rs12'
|
19
|
+
expect(response.open_from).to eq DateTime.parse('2014-02-19T14:15:49+01:00')
|
20
|
+
expect(response.open_till).to eq DateTime.parse('2014-02-20T14:15:49+01:00')
|
21
|
+
expect(response.completed_at).to eq nil
|
22
|
+
expect(response.completer_type).to eq 'patient'
|
23
|
+
expect(response.status).to eq 'open'
|
24
|
+
expect(response.completing_url).to eq 'http://roqua.dev/client/session/new?token=26aee9a4'
|
23
25
|
end
|
24
26
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe StartFillOutSession do
|
4
|
-
let(:options) { {dossier_id: 'some_dossier_id', questionnaire_key: 'some_key',
|
4
|
+
let(:options) { {dossier_id: 'some_dossier_id', questionnaire_key: 'some_key',
|
5
|
+
return_to: '/some/return/url', stylesheet: 'https://example.org/stylesheet.css'} }
|
5
6
|
let(:session) { Sessions::BasicAuthSession.new }
|
6
7
|
let(:response) { double('response', :[] => nil) }
|
7
8
|
before do
|
@@ -12,17 +13,14 @@ describe StartFillOutSession do
|
|
12
13
|
it 'does a post to the rom fill_out_sessions api' do
|
13
14
|
expect(session).to receive(:post).with("/dossiers/#{options[:dossier_id]}/fill_out_sessions",
|
14
15
|
questionnaire_key: options[:questionnaire_key],
|
15
|
-
return_to: options[:return_to]
|
16
|
+
return_to: options[:return_to],
|
17
|
+
stylesheet: options[:stylesheet])
|
16
18
|
StartFillOutSession.run!(options)
|
17
19
|
end
|
18
20
|
|
19
|
-
it 'returns the
|
20
|
-
expect(StartFillOutSession.run!(options)).to eq(response)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'gives access to the received questionnaire url' do
|
21
|
+
it 'returns the received questionnaire url' do
|
24
22
|
allow(session).to receive(:post).and_return 'questionnaire_url' => 'some_questionnaire_url'
|
25
23
|
outcome = StartFillOutSession.run(options)
|
26
|
-
expect(outcome.
|
24
|
+
expect(outcome.result).to eq('some_questionnaire_url')
|
27
25
|
end
|
28
26
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Esposito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: virtus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,14 +136,17 @@ files:
|
|
136
136
|
- LICENSE.txt
|
137
137
|
- README.md
|
138
138
|
- Rakefile
|
139
|
+
- config/locales/nl.yml
|
140
|
+
- config/locales/validation_errors.nl.yml
|
141
|
+
- lib/i18n/i18n.rb
|
139
142
|
- lib/roqua-rom-api.rb
|
140
143
|
- lib/roqua/rom_api.rb
|
141
144
|
- lib/roqua/rom_api/endpoint.rb
|
145
|
+
- lib/roqua/rom_api/list_protocol_subscriptions.rb
|
146
|
+
- lib/roqua/rom_api/list_responses.rb
|
142
147
|
- lib/roqua/rom_api/models.rb
|
143
148
|
- lib/roqua/rom_api/models/protocol_subscription.rb
|
144
149
|
- lib/roqua/rom_api/models/response.rb
|
145
|
-
- lib/roqua/rom_api/protocol_subscriptions.rb
|
146
|
-
- lib/roqua/rom_api/responses.rb
|
147
150
|
- lib/roqua/rom_api/sessions.rb
|
148
151
|
- lib/roqua/rom_api/sessions/basic_auth_session.rb
|
149
152
|
- lib/roqua/rom_api/start_fill_out_session.rb
|
@@ -153,10 +156,10 @@ files:
|
|
153
156
|
- roqua_rom_api.gemspec
|
154
157
|
- spec/fabricators/basic_auth_session_fabricator.rb
|
155
158
|
- spec/lib/roqua/rom_api/endpoint_spec.rb
|
159
|
+
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
160
|
+
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
156
161
|
- spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb
|
157
162
|
- spec/lib/roqua/rom_api/models/response_spec.rb
|
158
|
-
- spec/lib/roqua/rom_api/protocol_subscriptions_spec.rb
|
159
|
-
- spec/lib/roqua/rom_api/responses_spec.rb
|
160
163
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
161
164
|
- spec/lib/roqua/rom_api/start_fill_out_session_spec.rb
|
162
165
|
- spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
|
@@ -190,10 +193,10 @@ summary: API wrapper gem around RoQua's ROM API
|
|
190
193
|
test_files:
|
191
194
|
- spec/fabricators/basic_auth_session_fabricator.rb
|
192
195
|
- spec/lib/roqua/rom_api/endpoint_spec.rb
|
196
|
+
- spec/lib/roqua/rom_api/list_protocol_subscriptions_spec.rb
|
197
|
+
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
193
198
|
- spec/lib/roqua/rom_api/models/protocol_subscription_spec.rb
|
194
199
|
- spec/lib/roqua/rom_api/models/response_spec.rb
|
195
|
-
- spec/lib/roqua/rom_api/protocol_subscriptions_spec.rb
|
196
|
-
- spec/lib/roqua/rom_api/responses_spec.rb
|
197
200
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
198
201
|
- spec/lib/roqua/rom_api/start_fill_out_session_spec.rb
|
199
202
|
- spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
|