allscripts_unity_client 1.3.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +66 -66
- data/allscripts_unity_client.gemspec +32 -32
- data/lib/allscripts_unity_client/client.rb +215 -205
- data/lib/allscripts_unity_client/client_driver.rb +15 -42
- data/lib/allscripts_unity_client/client_options.rb +68 -0
- data/lib/allscripts_unity_client/json_client_driver.rb +46 -50
- data/lib/allscripts_unity_client/json_unity_request.rb +20 -20
- data/lib/allscripts_unity_client/json_unity_response.rb +1 -1
- data/lib/allscripts_unity_client/soap_client_driver.rb +29 -29
- data/lib/allscripts_unity_client/timezone.rb +15 -10
- data/lib/allscripts_unity_client/unity_request.rb +17 -17
- data/lib/allscripts_unity_client/unity_response.rb +3 -3
- data/lib/allscripts_unity_client/utilities.rb +5 -5
- data/lib/allscripts_unity_client/version.rb +1 -1
- data/lib/allscripts_unity_client.rb +21 -25
- data/spec/allscripts_unity_client_spec.rb +12 -16
- data/spec/client_driver_spec.rb +1 -49
- data/spec/client_options_spec.rb +134 -0
- data/spec/client_spec.rb +9 -9
- data/spec/factories/allscripts_unity_client_parameters_factory.rb +2 -2
- data/spec/factories/client_driver_factory.rb +4 -5
- data/spec/factories/client_factory.rb +2 -2
- data/spec/factories/client_options.rb +13 -0
- data/spec/factories/json_client_driver_factory.rb +1 -1
- data/spec/factories/json_unity_request_factory.rb +1 -1
- data/spec/factories/json_unity_response_factory.rb +1 -1
- data/spec/factories/magic_request_factory.rb +4 -4
- data/spec/factories/soap_client_driver_factory.rb +1 -1
- data/spec/factories/timezone_factory.rb +2 -2
- data/spec/factories/unity_request_factory.rb +3 -3
- data/spec/factories/unity_response_factory.rb +2 -2
- data/spec/json_client_driver_spec.rb +18 -86
- data/spec/json_unity_request_spec.rb +7 -7
- data/spec/json_unity_response_spec.rb +6 -6
- data/spec/soap_client_driver_spec.rb +20 -82
- data/spec/spec_helper.rb +5 -9
- data/spec/support/shared_examples_for_client_driver.rb +37 -58
- data/spec/support/shared_examples_for_unity_request.rb +13 -13
- data/spec/support/shared_examples_for_unity_response.rb +4 -4
- data/spec/timezone_spec.rb +31 -11
- data/spec/unity_request_spec.rb +7 -7
- data/spec/unity_response_spec.rb +4 -4
- data/spec/utilities_spec.rb +2 -2
- metadata +30 -57
@@ -1,28 +1,28 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
1
|
+
require 'allscripts_unity_client/utilities'
|
2
|
+
require 'allscripts_unity_client/timezone'
|
3
|
+
require 'allscripts_unity_client/unity_request'
|
4
|
+
require 'allscripts_unity_client/json_unity_request'
|
5
|
+
require 'allscripts_unity_client/unity_response'
|
6
|
+
require 'allscripts_unity_client/json_unity_response'
|
7
|
+
require 'allscripts_unity_client/client'
|
8
|
+
require 'allscripts_unity_client/client_driver'
|
9
|
+
require 'allscripts_unity_client/client_options'
|
10
|
+
require 'allscripts_unity_client/soap_client_driver'
|
11
|
+
require 'allscripts_unity_client/json_client_driver'
|
11
12
|
|
12
13
|
module AllscriptsUnityClient
|
13
14
|
class APIError < RuntimeError
|
14
15
|
end
|
15
16
|
|
16
|
-
def self.create(
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def self.create(options = {})
|
18
|
+
options[:mode] ||= :soap
|
19
|
+
options[:log] = true unless options[:log] === false
|
20
|
+
raise_if_options_invalid options
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
client_driver = SOAPClientDriver.new(parameters[:base_unity_url], parameters[:username], parameters[:password], parameters[:appname], parameters[:proxy], parameters[:timezone], parameters[:logger], parameters[:log])
|
22
|
+
if options[:mode] == :json
|
23
|
+
client_driver = JSONClientDriver.new(options)
|
24
|
+
else
|
25
|
+
client_driver = SOAPClientDriver.new(options)
|
26
26
|
end
|
27
27
|
|
28
28
|
client = Client.new(client_driver)
|
@@ -31,12 +31,8 @@ module AllscriptsUnityClient
|
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
def self.
|
35
|
-
raise ArgumentError,
|
36
|
-
raise ArgumentError, ":base_unity_url required" if parameters[:base_unity_url].nil?
|
37
|
-
raise ArgumentError, ":username required" if parameters[:username].nil?
|
38
|
-
raise ArgumentError, ":password required" if parameters[:password].nil?
|
39
|
-
raise ArgumentError, ":appname required" if parameters[:appname].nil?
|
34
|
+
def self.raise_if_options_invalid(options)
|
35
|
+
raise ArgumentError, ':mode must be :json or :soap' unless [:json, :soap].include?(options[:mode])
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
@@ -6,44 +6,40 @@ describe 'AllscriptsUnityClient' do
|
|
6
6
|
subject { AllscriptsUnityClient }
|
7
7
|
|
8
8
|
describe '.create' do
|
9
|
-
context 'when given :
|
9
|
+
context 'when given mode: :soap' do
|
10
10
|
it 'returns a SOAPClient' do
|
11
|
-
parameters =
|
11
|
+
parameters = build(:allscripts_unity_client_parameters, mode: :soap)
|
12
12
|
expect(subject.create(parameters).client_type).to be(:soap)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
context 'when given :
|
16
|
+
context 'when given mode: :json' do
|
17
17
|
it 'returns a client with client_type :json' do
|
18
|
-
parameters =
|
18
|
+
parameters = build(:allscripts_unity_client_parameters, mode: :json)
|
19
19
|
expect(subject.create(parameters).client_type).to be(:json)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when not given :mode' do
|
24
24
|
it 'returns a client with client_type :soap' do
|
25
|
-
parameters =
|
25
|
+
parameters = build(:allscripts_unity_client_parameters)
|
26
26
|
parameters[:mode] = nil
|
27
27
|
expect(subject.create(parameters).client_type).to be(:soap)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe '.
|
33
|
-
context 'when not given :
|
34
|
-
it { expect { subject.send(:
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when not given :username' do
|
38
|
-
it { expect { subject.send(:raise_if_parameters_invalid, FactoryGirl.build(:allscripts_unity_client_parameters, :username => nil)) }.to raise_error(ArgumentError) }
|
32
|
+
describe '.raise_if_options_invalid' do
|
33
|
+
context 'when not given :mode' do
|
34
|
+
it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: nil)) }.to raise_error(ArgumentError) }
|
39
35
|
end
|
40
36
|
|
41
|
-
context 'when
|
42
|
-
it { expect { subject.send(:
|
37
|
+
context 'when given mode: :json' do
|
38
|
+
it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: :json)) }.not_to raise_error }
|
43
39
|
end
|
44
40
|
|
45
|
-
context 'when
|
46
|
-
it { expect { subject.send(:
|
41
|
+
context 'when given mode: :soap' do
|
42
|
+
it { expect { subject.send(:raise_if_options_invalid, build(:allscripts_unity_client_parameters, mode: :soap)) }.not_to raise_error }
|
47
43
|
end
|
48
44
|
end
|
49
45
|
end
|
data/spec/client_driver_spec.rb
CHANGED
@@ -3,55 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe 'ClientDriver' do
|
4
4
|
it_behaves_like 'a client driver'
|
5
5
|
|
6
|
-
subject {
|
7
|
-
|
8
|
-
describe '#initialize' do
|
9
|
-
context 'when nil is given for base_unity_url' do
|
10
|
-
it { expect { FactoryGirl.build(:client_driver, :base_unity_url => nil) }.to raise_error(ArgumentError) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when nil is given for username' do
|
14
|
-
it { expect { FactoryGirl.build(:client_driver, :username => nil) }.to raise_error(ArgumentError) }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when nil is given for password' do
|
18
|
-
it { expect { FactoryGirl.build(:client_driver, :password => nil) }.to raise_error(ArgumentError) }
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when nil is given for appname' do
|
22
|
-
it { expect { FactoryGirl.build(:client_driver, :appname => nil) }.to raise_error(ArgumentError) }
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'when given a base_unity_url with a trailing /' do
|
26
|
-
it 'sets @base_unity_url without the trailing /' do
|
27
|
-
client_driver = FactoryGirl.build(:client_driver, :base_unity_url => "http://www.example.com/")
|
28
|
-
expect(client_driver.base_unity_url).to eq("http://www.example.com")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when nil is given for timezone' do
|
33
|
-
it 'sets @timezone to UTC' do
|
34
|
-
client_driver = FactoryGirl.build(:client_driver, :timezone => nil)
|
35
|
-
utc_timezone = FactoryGirl.build(:timezone, :zone_identifier => "UTC")
|
36
|
-
expect(client_driver.timezone.tzinfo).to eq(utc_timezone.tzinfo)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'when nil is given for logger' do
|
41
|
-
it 'sets @logger to Logger' do
|
42
|
-
client_driver = FactoryGirl.build(:client_driver, :logger => nil)
|
43
|
-
expect(client_driver.logger).to be_instance_of(Logger)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'when logger is set' do
|
48
|
-
it 'sets @logger to logger' do
|
49
|
-
logger = double("logger")
|
50
|
-
client_driver = FactoryGirl.build(:client_driver, :logger => logger)
|
51
|
-
expect(client_driver.logger).to be(logger)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
6
|
+
subject { build(:client_driver) }
|
55
7
|
|
56
8
|
describe '#client_type' do
|
57
9
|
it { expect(subject.client_type).to be(:none) }
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'ClientOptions' do
|
4
|
+
subject { build(:client_options) }
|
5
|
+
|
6
|
+
let(:url_with_slash) { 'http://www.example.com/' }
|
7
|
+
let(:url_without_slash) { 'http://www.example.com' }
|
8
|
+
let(:utc_timezone) { AllscriptsUnityClient::Timezone.new('UTC') }
|
9
|
+
let(:america_los_angeles) { 'America/Los_Angeles' }
|
10
|
+
let(:america_los_angeles_timezone) { AllscriptsUnityClient::Timezone.new('America/Los_Angeles') }
|
11
|
+
let(:client_options_hash) { { base_unity_url: 'http://www.example.com', username: 'username', password: 'password', appname: 'appname', proxy: 'proxy', timezone: 'UTC', logger: nil } }
|
12
|
+
|
13
|
+
describe '#initialize' do
|
14
|
+
context 'when given a base_unity_url that ends in a slash (/)' do
|
15
|
+
it 'strips the slash' do
|
16
|
+
expect(build(:client_options, base_unity_url: url_with_slash).base_unity_url).to eq(url_without_slash)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#validate_options' do
|
22
|
+
context 'when not given base_unity_url' do
|
23
|
+
it { expect { build(:client_options, base_unity_url: nil) }.to raise_error(ArgumentError) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when not given username' do
|
27
|
+
it { expect { build(:client_options, username: nil) }.to raise_error(ArgumentError) }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when not given password' do
|
31
|
+
it { expect { build(:client_options, password: nil) }.to raise_error(ArgumentError) }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when not given appname' do
|
35
|
+
it { expect { build(:client_options, appname: nil) }.to raise_error(ArgumentError) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#base_unity_url=' do
|
40
|
+
context 'when given a base_unity_url that ends in a slash (/)' do
|
41
|
+
it 'strips the slash' do
|
42
|
+
subject.base_unity_url = url_with_slash
|
43
|
+
expect(subject.base_unity_url).to eq(url_without_slash)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when given nil' do
|
48
|
+
it { expect { subject.base_unity_url = nil }.to raise_error(ArgumentError) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#username=' do
|
53
|
+
context 'when given nil' do
|
54
|
+
it { expect { subject.username = nil }.to raise_error(ArgumentError) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when given username' do
|
58
|
+
it { expect { subject.username = 'username' }.not_to raise_error }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#password=' do
|
63
|
+
context 'when given nil' do
|
64
|
+
it { expect { subject.password = nil }.to raise_error(ArgumentError) }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when given password' do
|
68
|
+
it { expect { subject.password = 'password' }.not_to raise_error }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#appname=' do
|
73
|
+
context 'when given nil' do
|
74
|
+
it { expect { subject.appname = nil }.to raise_error(ArgumentError) }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when given appname' do
|
78
|
+
it { expect { subject.appname = 'appname' }.not_to raise_error }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#timezone=' do
|
83
|
+
context 'when given nil' do
|
84
|
+
it 'sets timezone to UTC' do
|
85
|
+
subject.timezone = nil
|
86
|
+
expect(subject.timezone).to eq(utc_timezone)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'when given tzinfo string' do
|
91
|
+
it 'sets it to correct Timezone' do
|
92
|
+
subject.timezone = america_los_angeles
|
93
|
+
expect(subject.timezone).to eq(america_los_angeles_timezone)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe '#proxy?' do
|
99
|
+
context 'when proxy is nil' do
|
100
|
+
it 'returns false' do
|
101
|
+
expect(subject.proxy?).to be_falsey
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when proxy is not nil' do
|
106
|
+
it 'returns true' do
|
107
|
+
subject.proxy = url_with_slash
|
108
|
+
expect(subject.proxy?).to be_truthy
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'when proxy is empty string' do
|
113
|
+
it 'returns false' do
|
114
|
+
subject.proxy = ''
|
115
|
+
expect(subject.proxy?).to be_falsey
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#logger?' do
|
121
|
+
context 'when logger is nil' do
|
122
|
+
it 'returns false' do
|
123
|
+
expect(subject.logger?).to be_falsey
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'when logger is not nil' do
|
128
|
+
it 'returns true' do
|
129
|
+
subject.logger = double('logger')
|
130
|
+
expect(subject.logger?).to be_truthy
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/spec/client_spec.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Client' do
|
4
|
-
subject {
|
4
|
+
subject { build(:client) }
|
5
5
|
|
6
6
|
describe '#initialize' do
|
7
7
|
context 'when given nil for client_driver' do
|
8
|
-
it { expect {
|
8
|
+
it { expect { build(:client, client_driver: nil) }.to raise_error(ArgumentError) }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#magic' do
|
13
13
|
it 'calls magic on @client_driver' do
|
14
|
-
subject.client_driver = double(:
|
14
|
+
subject.client_driver = double(magic: 'magic')
|
15
15
|
subject.magic
|
16
16
|
expect(subject.client_driver).to have_received(:magic)
|
17
17
|
end
|
@@ -19,7 +19,7 @@ describe 'Client' do
|
|
19
19
|
|
20
20
|
describe '#get_security_token!' do
|
21
21
|
it 'calls get_security_token! on @client_driver' do
|
22
|
-
subject.client_driver = double(
|
22
|
+
subject.client_driver = double(get_security_token!: 'get_security_token!')
|
23
23
|
subject.get_security_token!
|
24
24
|
expect(subject.client_driver).to have_received(:get_security_token!)
|
25
25
|
end
|
@@ -27,7 +27,7 @@ describe 'Client' do
|
|
27
27
|
|
28
28
|
describe '#retire_security_token!' do
|
29
29
|
it 'calls retire_security_token! on @client_driver' do
|
30
|
-
subject.client_driver = double(
|
30
|
+
subject.client_driver = double(retire_security_token!: 'retire_security_token!')
|
31
31
|
subject.retire_security_token!
|
32
32
|
expect(subject.client_driver).to have_received(:retire_security_token!)
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe 'Client' do
|
|
35
35
|
|
36
36
|
describe '#security_token?' do
|
37
37
|
it 'calls security_token? on @client_driver' do
|
38
|
-
subject.client_driver = double(
|
38
|
+
subject.client_driver = double(security_token?: 'security_token?')
|
39
39
|
subject.security_token?
|
40
40
|
expect(subject.client_driver).to have_received(:security_token?)
|
41
41
|
end
|
@@ -43,7 +43,7 @@ describe 'Client' do
|
|
43
43
|
|
44
44
|
describe '#client_type' do
|
45
45
|
it 'calls client_type on @client_driver' do
|
46
|
-
subject.client_driver = double(:
|
46
|
+
subject.client_driver = double(client_type: 'client_type?')
|
47
47
|
subject.client_type
|
48
48
|
expect(subject.client_driver).to have_received(:client_type)
|
49
49
|
end
|
@@ -393,8 +393,8 @@ describe 'Client' do
|
|
393
393
|
describe '#nokogiri_to_string' do
|
394
394
|
context 'when given a Nokogiri::XML::Builder' do
|
395
395
|
it 'returns an XML string' do
|
396
|
-
builder = Nokogiri::XML::Builder.new { |xml| xml.field
|
397
|
-
expect(subject.send(:nokogiri_to_string, builder)).to eq(
|
396
|
+
builder = Nokogiri::XML::Builder.new { |xml| xml.field 'test' }
|
397
|
+
expect(subject.send(:nokogiri_to_string, builder)).to eq('<field>test</field>')
|
398
398
|
end
|
399
399
|
end
|
400
400
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :allscripts_unity_client_parameters, :
|
2
|
+
factory :allscripts_unity_client_parameters, class: Hash do
|
3
3
|
initialize_with { attributes }
|
4
4
|
|
5
|
-
base_unity_url
|
5
|
+
base_unity_url 'http://www.example.com'
|
6
6
|
username Faker::Name.name
|
7
7
|
password Faker::Internet.password
|
8
8
|
appname Faker::Name.name
|
@@ -1,14 +1,13 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :client_driver, :
|
3
|
-
initialize_with { new(base_unity_url, username, password, appname, proxy, timezone, logger
|
2
|
+
factory :client_driver, class: AllscriptsUnityClient::ClientDriver do
|
3
|
+
initialize_with { new(base_unity_url: base_unity_url, username: username, password: password, appname: appname, proxy: proxy, timezone: timezone, logger: logger) }
|
4
4
|
|
5
|
-
base_unity_url
|
5
|
+
base_unity_url 'http://www.example.com'
|
6
6
|
username Faker::Name.name
|
7
7
|
password Faker::Internet.password
|
8
8
|
appname Faker::Name.name
|
9
9
|
proxy nil
|
10
|
-
timezone
|
10
|
+
timezone 'America/Phoenix'
|
11
11
|
logger nil
|
12
|
-
log false
|
13
12
|
end
|
14
13
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :client, :
|
2
|
+
factory :client, class: AllscriptsUnityClient::Client do
|
3
3
|
initialize_with { new(client_driver) }
|
4
4
|
|
5
|
-
client_driver {
|
5
|
+
client_driver { build(:client_driver) }
|
6
6
|
end
|
7
7
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :client_options, class: AllscriptsUnityClient::ClientOptions do
|
3
|
+
initialize_with { new(base_unity_url: base_unity_url, username: username, password: password, appname: appname, proxy: proxy, timezone: timezone, logger: logger) }
|
4
|
+
|
5
|
+
base_unity_url 'http://www.example.com'
|
6
|
+
username Faker::Name.name
|
7
|
+
password Faker::Internet.password
|
8
|
+
appname Faker::Name.name
|
9
|
+
proxy nil
|
10
|
+
timezone 'America/Phoenix'
|
11
|
+
logger nil
|
12
|
+
end
|
13
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :magic_request, :
|
2
|
+
factory :magic_request, class: Hash do
|
3
3
|
initialize_with { attributes }
|
4
4
|
|
5
5
|
action nil
|
@@ -16,10 +16,10 @@ FactoryGirl.define do
|
|
16
16
|
data nil
|
17
17
|
end
|
18
18
|
|
19
|
-
factory :populated_magic_request, :
|
20
|
-
action
|
19
|
+
factory :populated_magic_request, parent: :magic_request do
|
20
|
+
action %w(GetServerInfo GetProviders).sample
|
21
21
|
appname Faker::Company.name
|
22
|
-
userid
|
22
|
+
userid %w(jmedici lmccoy).sample
|
23
23
|
patientid Faker::Number.number(3)
|
24
24
|
token SecureRandom.uuid
|
25
25
|
parameter1 Faker::Internet.domain_word
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :timezone, :
|
2
|
+
factory :timezone, class: AllscriptsUnityClient::Timezone do
|
3
3
|
initialize_with { new(zone_identifier) }
|
4
4
|
|
5
|
-
zone_identifier
|
5
|
+
zone_identifier 'America/Phoenix'
|
6
6
|
end
|
7
7
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :unity_request, :
|
2
|
+
factory :unity_request, class: AllscriptsUnityClient::UnityRequest do
|
3
3
|
initialize_with { new(parameters, timezone, appname, security_token) }
|
4
4
|
|
5
|
-
parameters
|
6
|
-
timezone
|
5
|
+
parameters { build(:magic_request) }
|
6
|
+
timezone { build(:timezone) }
|
7
7
|
appname Faker::Name.name
|
8
8
|
security_token SecureRandom.uuid
|
9
9
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :unity_response, :
|
2
|
+
factory :unity_response, class: AllscriptsUnityClient::UnityResponse do
|
3
3
|
initialize_with { new(response, timezone) }
|
4
4
|
|
5
5
|
response {}
|
6
|
-
timezone
|
6
|
+
timezone { build(:timezone) }
|
7
7
|
end
|
8
8
|
end
|