osc_ruby 0.7.1 → 1.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 +4 -4
- data/.codeclimate.yml +25 -25
- data/.gitignore +15 -15
- data/.rspec +1 -1
- data/.rubocop.yml +1156 -1156
- data/.travis.yml +9 -9
- data/Gemfile +3 -3
- data/License.txt +21 -0
- data/README.md +95 -242
- data/Rakefile +2 -2
- data/lib/ext/string.rb +18 -18
- data/lib/osc_ruby/classes/query_results.rb +40 -60
- data/lib/osc_ruby/client.rb +40 -40
- data/lib/osc_ruby/configuration.rb +14 -13
- data/lib/osc_ruby/connect.rb +218 -209
- data/lib/osc_ruby/modules/normalize_module.rb +121 -121
- data/lib/osc_ruby/modules/query_module.rb +69 -69
- data/lib/osc_ruby/modules/validations_module.rb +168 -168
- data/lib/osc_ruby/version.rb +2 -2
- data/lib/osc_ruby.rb +4 -10
- data/osc_ruby.gemspec +28 -29
- data/spec/core/client_spec.rb +96 -96
- data/spec/core/configuration_spec.rb +4 -4
- data/spec/core/connect_spec.rb +366 -364
- data/spec/core/query_results_spec.rb +107 -133
- data/spec/core/spec_helper.rb +25 -25
- data/tasks/rspec.rake +2 -2
- metadata +23 -22
- data/LICENSE.txt +0 -22
- data/lib/osc_ruby/classes/account.rb +0 -75
- data/lib/osc_ruby/classes/answer.rb +0 -117
- data/lib/osc_ruby/classes/incident.rb +0 -13
- data/lib/osc_ruby/classes/product_category_shared.rb +0 -118
- data/lib/osc_ruby/classes/service_category.rb +0 -6
- data/lib/osc_ruby/classes/service_class.rb +0 -66
- data/lib/osc_ruby/classes/service_product.rb +0 -6
- data/lib/osc_ruby/modules/class_factory_module.rb +0 -165
- data/lib/osc_ruby/modules/nested_resource_module.rb +0 -10
- data/spec/core/account_spec.rb +0 -497
- data/spec/core/answer_spec.rb +0 -545
- data/spec/core/service_category_spec.rb +0 -445
- data/spec/core/service_product_spec.rb +0 -443
data/spec/core/client_spec.rb
CHANGED
@@ -1,97 +1,97 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe OSCRuby::Client do
|
4
|
-
subject { client }
|
5
|
-
|
6
|
-
context '#initialize' do
|
7
|
-
|
8
|
-
it 'should require a block' do
|
9
|
-
expect { OSCRuby::Client.new }.to raise_error(ArgumentError)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should raise exception if interface is blank' do
|
13
|
-
expect do
|
14
|
-
OSCRuby::Client.new do |config|
|
15
|
-
config.interface = ''
|
16
|
-
end
|
17
|
-
end.to raise_error("Interface cannot be nil or blank")
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should raise exception if username is blank' do
|
21
|
-
expect do
|
22
|
-
OSCRuby::Client.new do |config|
|
23
|
-
config.interface = 'test'
|
24
|
-
config.username = ''
|
25
|
-
end
|
26
|
-
end.to raise_error("Username cannot be nil or blank")
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should raise exception if password is blank' do
|
30
|
-
expect do
|
31
|
-
OSCRuby::Client.new do |config|
|
32
|
-
config.interface = 'test'
|
33
|
-
config.username = 'test_username'
|
34
|
-
config.password = ''
|
35
|
-
end
|
36
|
-
end.to raise_error("Password cannot be nil or blank")
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should raise exception if no_ssl_verify not a TrueClass nor a FalseClass' do
|
40
|
-
expect do
|
41
|
-
OSCRuby::Client.new do |config|
|
42
|
-
config.interface = 'test'
|
43
|
-
config.username = 'test_username'
|
44
|
-
config.password = 'password'
|
45
|
-
config.no_ssl_verify = 'true'
|
46
|
-
end
|
47
|
-
end.to raise_error("The no SSL verification setting must be set to true or false")
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should raise exception if Connect Version is null' do
|
51
|
-
expect do
|
52
|
-
OSCRuby::Client.new do |config|
|
53
|
-
config.interface = 'test'
|
54
|
-
config.username = 'test_username'
|
55
|
-
config.password = 'password'
|
56
|
-
config.version = nil
|
57
|
-
end
|
58
|
-
end.to raise_error("Connect version cannot be null")
|
59
|
-
end
|
60
|
-
|
61
|
-
let(:client){
|
62
|
-
OSCRuby::Client.new do |config|
|
63
|
-
config.interface = 'test'
|
64
|
-
config.username = 'test_username'
|
65
|
-
config.password = 'test_password'
|
66
|
-
config.no_ssl_verify = true
|
67
|
-
end
|
68
|
-
}
|
69
|
-
|
70
|
-
it 'should create a configuration object' do
|
71
|
-
|
72
|
-
expect{client}.to_not raise_error
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'should have interface set to "test" and not "test1"' do
|
77
|
-
expect(client.config.interface).to eq('test')
|
78
|
-
expect(client.config.interface).not_to eq('test1')
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should have username set to "test_username" and not "test1_username"' do
|
82
|
-
expect(client.config.username).to eq('test_username')
|
83
|
-
expect(client.config.username).not_to eq('test1_username')
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should have password set to "test_password" and not "test1_password"' do
|
87
|
-
expect(client.config.password).to eq('test_password')
|
88
|
-
expect(client.config.password).not_to eq('test1_password')
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should have no_ssl set to true and not false' do
|
92
|
-
expect(client.config.no_ssl_verify).to eq(true)
|
93
|
-
expect(client.config.no_ssl_verify).not_to eq(false)
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
1
|
+
require 'core/spec_helper'
|
2
|
+
|
3
|
+
describe OSCRuby::Client do
|
4
|
+
subject { client }
|
5
|
+
|
6
|
+
context '#initialize' do
|
7
|
+
|
8
|
+
it 'should require a block' do
|
9
|
+
expect { OSCRuby::Client.new }.to raise_error(ArgumentError)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should raise exception if interface is blank' do
|
13
|
+
expect do
|
14
|
+
OSCRuby::Client.new do |config|
|
15
|
+
config.interface = ''
|
16
|
+
end
|
17
|
+
end.to raise_error("Interface cannot be nil or blank")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should raise exception if username is blank' do
|
21
|
+
expect do
|
22
|
+
OSCRuby::Client.new do |config|
|
23
|
+
config.interface = 'test'
|
24
|
+
config.username = ''
|
25
|
+
end
|
26
|
+
end.to raise_error("Username cannot be nil or blank")
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should raise exception if password is blank' do
|
30
|
+
expect do
|
31
|
+
OSCRuby::Client.new do |config|
|
32
|
+
config.interface = 'test'
|
33
|
+
config.username = 'test_username'
|
34
|
+
config.password = ''
|
35
|
+
end
|
36
|
+
end.to raise_error("Password cannot be nil or blank")
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should raise exception if no_ssl_verify not a TrueClass nor a FalseClass' do
|
40
|
+
expect do
|
41
|
+
OSCRuby::Client.new do |config|
|
42
|
+
config.interface = 'test'
|
43
|
+
config.username = 'test_username'
|
44
|
+
config.password = 'password'
|
45
|
+
config.no_ssl_verify = 'true'
|
46
|
+
end
|
47
|
+
end.to raise_error("The no SSL verification setting must be set to true or false")
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should raise exception if Connect Version is null' do
|
51
|
+
expect do
|
52
|
+
OSCRuby::Client.new do |config|
|
53
|
+
config.interface = 'test'
|
54
|
+
config.username = 'test_username'
|
55
|
+
config.password = 'password'
|
56
|
+
config.version = nil
|
57
|
+
end
|
58
|
+
end.to raise_error("Connect version cannot be null")
|
59
|
+
end
|
60
|
+
|
61
|
+
let(:client){
|
62
|
+
OSCRuby::Client.new do |config|
|
63
|
+
config.interface = 'test'
|
64
|
+
config.username = 'test_username'
|
65
|
+
config.password = 'test_password'
|
66
|
+
config.no_ssl_verify = true
|
67
|
+
end
|
68
|
+
}
|
69
|
+
|
70
|
+
it 'should create a configuration object' do
|
71
|
+
|
72
|
+
expect{client}.to_not raise_error
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should have interface set to "test" and not "test1"' do
|
77
|
+
expect(client.config.interface).to eq('test')
|
78
|
+
expect(client.config.interface).not_to eq('test1')
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should have username set to "test_username" and not "test1_username"' do
|
82
|
+
expect(client.config.username).to eq('test_username')
|
83
|
+
expect(client.config.username).not_to eq('test1_username')
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should have password set to "test_password" and not "test1_password"' do
|
87
|
+
expect(client.config.password).to eq('test_password')
|
88
|
+
expect(client.config.password).not_to eq('test1_password')
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should have no_ssl set to true and not false' do
|
92
|
+
expect(client.config.no_ssl_verify).to eq(true)
|
93
|
+
expect(client.config.no_ssl_verify).not_to eq(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
97
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe OSCRuby::Configuration do
|
4
|
-
subject { OSCRuby::Configuration.new }
|
1
|
+
require 'core/spec_helper'
|
2
|
+
|
3
|
+
describe OSCRuby::Configuration do
|
4
|
+
subject { OSCRuby::Configuration.new }
|
5
5
|
end
|