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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d62c6a258bb660e3611e4a7494931145d54966ed
4
- data.tar.gz: 497c244e9b1b0d1e659bf232154d03cb4fa8cde7
3
+ metadata.gz: 6799541e853eb01fd30aa3acf6adf501f0dc9df1
4
+ data.tar.gz: b799b813379d314f5cde25a9d238bc910167b218
5
5
  SHA512:
6
- metadata.gz: c419b26a1a7d6c1b871980f387aae35569024879102a0f8aa231b4c4ecab30e23c24b5e04fadc830e5157be77a5df6f5942f41f1c705b2e634e3d68b98010607
7
- data.tar.gz: a610cff81e691ad11585dc20df220c32ef4d8f45dc997c7282b6c89aaa1174aa6c4921e8d6068509c1a50f2da4e8217c2911d3d90644cd8c15a86e9d1ccfefd6
6
+ metadata.gz: 4f8b7c6571b8f4170c95b2c002ff5b32065dc0b79e30668998eb6a5d6b2ca78dd5376c861bca06f9599785f128ea641c78295baf72363948a0883e07310f7630
7
+ data.tar.gz: b71f01c1dbdadacf838a526454d6bbc23bc87101bc658796b03ae06b92ca3f5cbae2e7708d328b2417a7e635cd4e9f36a12919748cec60b207e50d1957604425
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.3 / 2014-02-18
2
+
3
+ * Remove daily start time from api
4
+
1
5
  ### 0.0.2 / 2014-02-17
2
6
 
3
7
  * Raise when API response is not in 200 range
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roqua-rom-api (0.0.2)
4
+ roqua-rom-api (0.0.3)
5
5
  active_interaction (~> 1.0.4)
6
6
  httparty (~> 0.12.0)
7
7
 
data/README.md CHANGED
@@ -1,16 +1,37 @@
1
1
  # roqua-rom-api
2
2
 
3
- Description goes here.
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
 
@@ -2,6 +2,7 @@ require 'httparty'
2
2
 
3
3
  module Roqua
4
4
  module RomApi
5
+ # @api private
5
6
  class Base
6
7
  def self.get(url, params = {})
7
8
  HTTParty.get(api_base + url + '.json', query: params, basic_auth: authentication)
@@ -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
- response = Base.post '/protocol_subscriptions', dossier_id: dossier_id,
11
- protocol_key: protocol_key,
12
- start_at: (start_at.to_i if start_at),
13
- daily_start_time: daily_start_time
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
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module RomApi
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  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.2
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-17 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty