roqua-rom-api 0.0.1 → 0.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d62c6a258bb660e3611e4a7494931145d54966ed
|
4
|
+
data.tar.gz: 497c244e9b1b0d1e659bf232154d03cb4fa8cde7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c419b26a1a7d6c1b871980f387aae35569024879102a0f8aa231b4c4ecab30e23c24b5e04fadc830e5157be77a5df6f5942f41f1c705b2e634e3d68b98010607
|
7
|
+
data.tar.gz: a610cff81e691ad11585dc20df220c32ef4d8f45dc997c7282b6c89aaa1174aa6c4921e8d6068509c1a50f2da4e8217c2911d3d90644cd8c15a86e9d1ccfefd6
|
data/ChangeLog.md
ADDED
data/Gemfile.lock
CHANGED
data/lib/roqua/rom_api/base.rb
CHANGED
@@ -4,22 +4,18 @@ module Roqua
|
|
4
4
|
module RomApi
|
5
5
|
class Base
|
6
6
|
def self.get(url, params = {})
|
7
|
-
# TODO: Handle http basic authentication here
|
8
7
|
HTTParty.get(api_base + url + '.json', query: params, basic_auth: authentication)
|
9
8
|
end
|
10
9
|
|
11
10
|
def self.post(url, params = {})
|
12
|
-
# TODO: Handle http basic authentication here
|
13
11
|
HTTParty.post(api_base + url + '.json', query: params, basic_auth: authentication)
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.put(url, params = {})
|
17
|
-
# TODO: Handle http basic authentication here
|
18
15
|
HTTParty.put(api_base + url + '.json', query: params, basic_auth: authentication)
|
19
16
|
end
|
20
17
|
|
21
18
|
def self.delete(url, params = {})
|
22
|
-
# TODO: Handle http basic authentication here
|
23
19
|
HTTParty.delete(api_base + url + '.json', query: params, basic_auth: authentication)
|
24
20
|
end
|
25
21
|
|
@@ -7,10 +7,12 @@ module Roqua
|
|
7
7
|
integer :daily_start_time, default: nil
|
8
8
|
|
9
9
|
def execute
|
10
|
-
Base.post '/protocol_subscriptions', dossier_id: dossier_id,
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
15
|
+
response
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,15 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe StartProtocolSubscription do
|
4
|
+
let(:options) do
|
5
|
+
{dossier_id: 'some_dossier_id',
|
6
|
+
protocol_key: 'some_key',
|
7
|
+
start_at: Time.now,
|
8
|
+
daily_start_time: 32400} # nine o'clock
|
9
|
+
end
|
10
|
+
|
4
11
|
it 'does a post to the rom protocol_subscription api' do
|
5
|
-
|
6
|
-
protocol_key: 'some_key',
|
7
|
-
start_at: Time.now,
|
8
|
-
daily_start_time: 32400} # nine o'clock
|
9
|
-
expect(Base).to receive(:post).with '/protocol_subscriptions', dossier_id: options[:dossier_id],
|
12
|
+
expect(Base).to receive(:post).with('/protocol_subscriptions', dossier_id: options[:dossier_id],
|
10
13
|
protocol_key: options[:protocol_key],
|
11
14
|
start_at: options[:start_at].to_i,
|
12
|
-
daily_start_time: options[:daily_start_time]
|
15
|
+
daily_start_time: options[:daily_start_time])
|
16
|
+
.and_return double('response', code: 200)
|
13
17
|
StartProtocolSubscription.run(options)
|
14
18
|
end
|
19
|
+
|
20
|
+
it 'raises when the response HTTP status is not in the 200 range' do
|
21
|
+
allow(Base).to receive(:post).and_return double('response', code: 401)
|
22
|
+
expect { StartProtocolSubscription.run(options) }.to raise_error
|
23
|
+
end
|
15
24
|
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.0.
|
4
|
+
version: 0.0.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-02-
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -88,6 +88,7 @@ extra_rdoc_files: []
|
|
88
88
|
files:
|
89
89
|
- ".document"
|
90
90
|
- ".gitignore"
|
91
|
+
- ChangeLog.md
|
91
92
|
- Gemfile
|
92
93
|
- Gemfile.lock
|
93
94
|
- Guardfile
|