roqua-rom-api 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +29 -8
- data/lib/roqua/rom_api/base.rb +1 -0
- data/lib/roqua/rom_api/start_protocol_subscription.rb +6 -6
- data/lib/roqua/rom_api/version.rb +1 -1
- data/spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb +11 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6799541e853eb01fd30aa3acf6adf501f0dc9df1
|
4
|
+
data.tar.gz: b799b813379d314f5cde25a9d238bc910167b218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8b7c6571b8f4170c95b2c002ff5b32065dc0b79e30668998eb6a5d6b2ca78dd5376c861bca06f9599785f128ea641c78295baf72363948a0883e07310f7630
|
7
|
+
data.tar.gz: b71f01c1dbdadacf838a526454d6bbc23bc87101bc658796b03ae06b92ca3f5cbae2e7708d328b2417a7e635cd4e9f36a12919748cec60b207e50d1957604425
|
data/ChangeLog.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,37 @@
|
|
1
1
|
# roqua-rom-api
|
2
2
|
|
3
|
-
|
3
|
+
Make sure the following environment variables are defined:
|
4
|
+
|
5
|
+
ENV['ROQUA_ROM_HOST'] # uri of the RoQua application whose API you are targeting
|
6
|
+
ENV['ROQUA_ROM_KEY'] # username used for HTTP basic authentication on the RoQua API
|
7
|
+
ENV['ROQUA_ROM_SECRET'] # password used for HTTP basic authentication on the RoQua API
|
8
|
+
|
9
|
+
A HTTP basic auth username password combination can be generated in the RoQua admin interface integration tab
|
10
|
+
|
11
|
+
## Protocol Subscriptions
|
12
|
+
|
13
|
+
To subscribe to a protocol run the following command:
|
14
|
+
|
15
|
+
Roqua::RomApi::StartProtocolSubscription.run dossier_id: dossier_id,
|
16
|
+
protocol_key: protocol_key,
|
17
|
+
start_at: start_at
|
18
|
+
|
19
|
+
#### Subscription options
|
20
|
+
|
21
|
+
* `dossier_id:` [Required] - Unique identifier for the patient to be subscribed.
|
22
|
+
* `protocol_key:` [Required] - Key uniquely identifying the protocol of interest as specified in RoQua.
|
23
|
+
* `start_at:` [Defaults to the present] - Timestamp specifying when the first measurement should be prepared.
|
24
|
+
|
4
25
|
|
5
26
|
## Contributing to roqua-rom-api
|
6
27
|
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
28
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
29
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
30
|
+
* Fork the project.
|
31
|
+
* Start a feature/bugfix branch.
|
32
|
+
* Commit and push until you are happy with your contribution.
|
33
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
34
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
35
|
|
15
36
|
## Copyright
|
16
37
|
|
data/lib/roqua/rom_api/base.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
module Roqua
|
2
2
|
module RomApi
|
3
|
+
# @api private
|
3
4
|
class StartProtocolSubscription < ActiveInteraction::Base
|
4
5
|
string :dossier_id
|
5
6
|
string :protocol_key
|
6
7
|
time :start_at, default: nil
|
7
|
-
integer :daily_start_time, default: nil
|
8
8
|
|
9
9
|
def execute
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
fail response.inspect unless response.code / 100 == 2
|
10
|
+
options = {dossier_id: dossier_id,
|
11
|
+
protocol_key: protocol_key}
|
12
|
+
options[:start_at] = start_at.to_i if start_at
|
13
|
+
response = Base.post '/protocol_subscriptions', options
|
14
|
+
fail response.parsed_response.inspect unless response.code / 100 == 2
|
15
15
|
response
|
16
16
|
end
|
17
17
|
end
|
@@ -3,20 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe StartProtocolSubscription do
|
4
4
|
let(:options) do
|
5
5
|
{dossier_id: 'some_dossier_id',
|
6
|
-
protocol_key: 'some_key'
|
7
|
-
start_at: Time.now,
|
8
|
-
daily_start_time: 32400} # nine o'clock
|
6
|
+
protocol_key: 'some_key'} # nine o'clock
|
9
7
|
end
|
10
8
|
|
11
9
|
it 'does a post to the rom protocol_subscription api' do
|
12
10
|
expect(Base).to receive(:post).with('/protocol_subscriptions', dossier_id: options[:dossier_id],
|
13
|
-
protocol_key: options[:protocol_key]
|
14
|
-
start_at: options[:start_at].to_i,
|
15
|
-
daily_start_time: options[:daily_start_time])
|
11
|
+
protocol_key: options[:protocol_key])
|
16
12
|
.and_return double('response', code: 200)
|
17
13
|
StartProtocolSubscription.run(options)
|
18
14
|
end
|
19
15
|
|
16
|
+
it 'passes in the start_at option when provided' do
|
17
|
+
start_at = Time.now
|
18
|
+
expect(Base).to receive(:post).with('/protocol_subscriptions', dossier_id: options[:dossier_id],
|
19
|
+
protocol_key: options[:protocol_key],
|
20
|
+
start_at: start_at.to_i)
|
21
|
+
.and_return double('response', code: 200)
|
22
|
+
StartProtocolSubscription.run(options.merge start_at: start_at)
|
23
|
+
end
|
24
|
+
|
20
25
|
it 'raises when the response HTTP status is not in the 200 range' do
|
21
26
|
allow(Base).to receive(:post).and_return double('response', code: 401)
|
22
27
|
expect { StartProtocolSubscription.run(options) }.to raise_error
|
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.0.
|
4
|
+
version: 0.0.3
|
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-02-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|