roqua-rom-api 0.0.4 → 0.0.5
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 +7 -7
- data/lib/roqua/rom_api/list_responses.rb +2 -5
- data/lib/roqua/rom_api/{results → models}/response.rb +1 -1
- data/lib/roqua/rom_api/models.rb +1 -0
- data/lib/roqua/rom_api/sessions/basic_auth_session.rb +3 -3
- data/lib/roqua/rom_api/sessions.rb +9 -1
- data/lib/roqua/rom_api/start_protocol_subscription.rb +1 -3
- data/lib/roqua/rom_api/version.rb +1 -1
- data/lib/roqua/rom_api.rb +2 -2
- data/spec/lib/roqua/rom_api/{results → models}/response_spec.rb +0 -0
- data/spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb +18 -18
- data/spec/spec_helper.rb +1 -1
- metadata +6 -6
- data/lib/roqua/rom_api/results.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16fc5f0f04495f71a7a5658cdcd60939d44b7d89
|
4
|
+
data.tar.gz: ff78fb08b0c1fe66a2745c38f376d0c79068e759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e8e9bad8b0c40ee0a1ce2bc4b1b6595ac3af61823f8160dacbe2309a4a32e9c4c837ce707824746dc83eca74dcc9be00d7794ed1d82626d429b440b2e31761
|
7
|
+
data.tar.gz: c3cd6a83c3b7806db832b30ae6cb701633ec4742c8a6ebdc969e85218064d7769e4327bac72ba81959d5b1591d28efde0d7e65671765b6b0fcd9fdd3eb402b53
|
data/ChangeLog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
roqua-rom-api (0.0.
|
4
|
+
roqua-rom-api (0.0.5)
|
5
5
|
active_interaction (~> 1.0.4)
|
6
6
|
httparty (~> 0.12.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
active_interaction (1.0.
|
11
|
+
active_interaction (1.0.5)
|
12
12
|
activemodel (>= 3, < 5)
|
13
13
|
activemodel (4.0.3)
|
14
14
|
activesupport (= 4.0.3)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
multi_json (~> 1.3)
|
20
20
|
thread_safe (~> 0.1)
|
21
21
|
tzinfo (~> 0.3.37)
|
22
|
-
atomic (1.1.
|
22
|
+
atomic (1.1.15)
|
23
23
|
builder (3.1.4)
|
24
24
|
celluloid (0.15.2)
|
25
25
|
timers (~> 1.1.0)
|
@@ -56,7 +56,7 @@ GEM
|
|
56
56
|
lumberjack (1.0.4)
|
57
57
|
method_source (0.8.2)
|
58
58
|
minitest (4.7.5)
|
59
|
-
multi_json (1.
|
59
|
+
multi_json (1.9.0)
|
60
60
|
multi_xml (0.5.5)
|
61
61
|
nio4r (1.0.0)
|
62
62
|
pry (0.9.12.6)
|
@@ -78,10 +78,10 @@ GEM
|
|
78
78
|
ruby-progressbar (1.4.1)
|
79
79
|
slop (3.4.7)
|
80
80
|
thor (0.18.1)
|
81
|
-
thread_safe (0.
|
82
|
-
atomic
|
81
|
+
thread_safe (0.2.0)
|
82
|
+
atomic (>= 1.1.7, < 2)
|
83
83
|
timers (1.1.0)
|
84
|
-
tzinfo (0.3.
|
84
|
+
tzinfo (0.3.39)
|
85
85
|
yard (0.8.7.3)
|
86
86
|
|
87
87
|
PLATFORMS
|
@@ -2,15 +2,12 @@ module Roqua
|
|
2
2
|
module RomApi
|
3
3
|
# @api private
|
4
4
|
class ListResponses < ActiveInteraction::Base
|
5
|
-
include Sessions
|
6
|
-
include Results
|
7
5
|
string :dossier_id
|
8
6
|
|
9
7
|
def execute
|
10
|
-
|
11
|
-
response = session.get "/dossiers/#{dossier_id}/responses"
|
8
|
+
response = RomApi.basic_auth_session.get "/dossiers/#{dossier_id}/responses"
|
12
9
|
JSON.parse(response.body)['responses'].map do |response_entry|
|
13
|
-
Response.new response_entry
|
10
|
+
Models::Response.new response_entry
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'roqua/rom_api/models/response'
|
@@ -6,9 +6,9 @@ module Roqua
|
|
6
6
|
attr_reader :username
|
7
7
|
attr_reader :password
|
8
8
|
|
9
|
-
def initialize(rom_host: ENV['
|
10
|
-
username: ENV['
|
11
|
-
password: ENV['
|
9
|
+
def initialize(rom_host: ENV['ROM_HOST'],
|
10
|
+
username: ENV['ROM_KEY'],
|
11
|
+
password: ENV['ROM_SECRET'])
|
12
12
|
@rom_host = rom_host
|
13
13
|
@username = username
|
14
14
|
@password = password
|
@@ -1,2 +1,10 @@
|
|
1
1
|
require 'httparty'
|
2
|
-
require 'roqua/rom_api/sessions/basic_auth_session'
|
2
|
+
require 'roqua/rom_api/sessions/basic_auth_session'
|
3
|
+
|
4
|
+
module Roqua
|
5
|
+
module RomApi
|
6
|
+
def self.basic_auth_session(*arguments, &block)
|
7
|
+
Sessions::BasicAuthSession.new(*arguments, &block)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -2,17 +2,15 @@ module Roqua
|
|
2
2
|
module RomApi
|
3
3
|
# @api private
|
4
4
|
class StartProtocolSubscription < ActiveInteraction::Base
|
5
|
-
include Sessions
|
6
5
|
string :dossier_id
|
7
6
|
string :protocol_key
|
8
7
|
time :start_at, default: nil
|
9
8
|
|
10
9
|
def execute
|
11
|
-
session = BasicAuthSession.new
|
12
10
|
options = {dossier_id: dossier_id,
|
13
11
|
protocol_key: protocol_key}
|
14
12
|
options[:start_at] = start_at.to_i if start_at
|
15
|
-
response =
|
13
|
+
response = RomApi.basic_auth_session.post '/protocol_subscriptions', options
|
16
14
|
fail response.parsed_response.inspect unless (200..299).include? response.code
|
17
15
|
response
|
18
16
|
end
|
data/lib/roqua/rom_api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'roqua/rom_api/version'
|
2
1
|
require 'active_interaction'
|
2
|
+
require 'roqua/rom_api/version'
|
3
3
|
require 'roqua/rom_api/sessions'
|
4
|
-
require 'roqua/rom_api/
|
4
|
+
require 'roqua/rom_api/models'
|
5
5
|
require 'roqua/rom_api/start_protocol_subscription'
|
6
6
|
require 'roqua/rom_api/list_responses'
|
File without changes
|
@@ -7,41 +7,41 @@ describe BasicAuthSession do
|
|
7
7
|
|
8
8
|
describe '#initialize' do
|
9
9
|
it 'sets the rom_host instance attribute' do
|
10
|
-
session =
|
10
|
+
session = Roqua::RomApi.basic_auth_session rom_host: 'some_rom_host'
|
11
11
|
expect(session.rom_host).to eq('some_rom_host')
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'defaults the rom_host to the
|
15
|
-
orginal_env_rom_host = ENV['
|
16
|
-
ENV['
|
17
|
-
session =
|
18
|
-
ENV['
|
14
|
+
it 'defaults the rom_host to the ROM_HOST env variable' do
|
15
|
+
orginal_env_rom_host = ENV['ROM_HOST']
|
16
|
+
ENV['ROM_HOST'] = 'some_env_rom_host'
|
17
|
+
session = Roqua::RomApi.basic_auth_session
|
18
|
+
ENV['ROM_HOST'] = orginal_env_rom_host
|
19
19
|
expect(session.rom_host).to eq('some_env_rom_host')
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'sets the username instance variable' do
|
23
|
-
session =
|
23
|
+
session = Roqua::RomApi.basic_auth_session username: 'some_username'
|
24
24
|
expect(session.username).to eq('some_username')
|
25
25
|
end
|
26
26
|
|
27
|
-
it 'defaults the username to the
|
28
|
-
orginal_env_rom_key = ENV['
|
29
|
-
ENV['
|
30
|
-
session =
|
31
|
-
ENV['
|
27
|
+
it 'defaults the username to the ROM_KEY env variable' do
|
28
|
+
orginal_env_rom_key = ENV['ROM_KEY']
|
29
|
+
ENV['ROM_KEY'] = 'some_env_rom_key'
|
30
|
+
session = Roqua::RomApi.basic_auth_session
|
31
|
+
ENV['ROM_KEY'] = orginal_env_rom_key
|
32
32
|
expect(session.username).to eq('some_env_rom_key')
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'sets the password instance variable' do
|
36
|
-
session =
|
36
|
+
session = Roqua::RomApi.basic_auth_session password: 'some_password'
|
37
37
|
expect(session.password).to eq('some_password')
|
38
38
|
end
|
39
39
|
|
40
|
-
it 'defaults the password to the
|
41
|
-
orginal_env_rom_secret = ENV['
|
42
|
-
ENV['
|
43
|
-
session =
|
44
|
-
ENV['
|
40
|
+
it 'defaults the password to the ROM_SECRET env variable' do
|
41
|
+
orginal_env_rom_secret = ENV['ROM_SECRET']
|
42
|
+
ENV['ROM_SECRET'] = 'some_env_rom_secret'
|
43
|
+
session = Roqua::RomApi.basic_auth_session
|
44
|
+
ENV['ROM_SECRET'] = orginal_env_rom_secret
|
45
45
|
expect(session.password).to eq('some_env_rom_secret')
|
46
46
|
end
|
47
47
|
end
|
data/spec/spec_helper.rb
CHANGED
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.5
|
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-03-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -126,8 +126,8 @@ files:
|
|
126
126
|
- lib/roqua-rom-api.rb
|
127
127
|
- lib/roqua/rom_api.rb
|
128
128
|
- lib/roqua/rom_api/list_responses.rb
|
129
|
-
- lib/roqua/rom_api/
|
130
|
-
- lib/roqua/rom_api/
|
129
|
+
- lib/roqua/rom_api/models.rb
|
130
|
+
- lib/roqua/rom_api/models/response.rb
|
131
131
|
- lib/roqua/rom_api/sessions.rb
|
132
132
|
- lib/roqua/rom_api/sessions/basic_auth_session.rb
|
133
133
|
- lib/roqua/rom_api/start_protocol_subscription.rb
|
@@ -135,7 +135,7 @@ files:
|
|
135
135
|
- roqua_rom_api.gemspec
|
136
136
|
- spec/fabricators/basic_auth_session_fabricator.rb
|
137
137
|
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
138
|
-
- spec/lib/roqua/rom_api/
|
138
|
+
- spec/lib/roqua/rom_api/models/response_spec.rb
|
139
139
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
140
140
|
- spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
|
141
141
|
- spec/lib/roqua_rom_api_spec.rb
|
@@ -167,7 +167,7 @@ summary: API wrapper gem around RoQua's ROM API
|
|
167
167
|
test_files:
|
168
168
|
- spec/fabricators/basic_auth_session_fabricator.rb
|
169
169
|
- spec/lib/roqua/rom_api/list_responses_spec.rb
|
170
|
-
- spec/lib/roqua/rom_api/
|
170
|
+
- spec/lib/roqua/rom_api/models/response_spec.rb
|
171
171
|
- spec/lib/roqua/rom_api/sessions/basic_auth_session_spec.rb
|
172
172
|
- spec/lib/roqua/rom_api/start_protocol_subscription_spec.rb
|
173
173
|
- spec/lib/roqua_rom_api_spec.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'roqua/rom_api/results/response'
|