rbc 0.2.8 → 0.2.9
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/Gemfile.lock +1 -1
- data/lib/rbc.rb +10 -7
- data/lib/rbc/version.rb +1 -1
- data/spec/rbc_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58bec22030a792ff01fa066a212112f31b5b79ab
|
4
|
+
data.tar.gz: 5718e2a4934ff95b6bd3c2f31388144ebc25967a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06115488596735702907f26c2ee7f7ac76aa0e4d75498fea9687377b59076f2b16a85a3500506942703e56d020f5233c8bd2cd6fb866aa6b3e9aa2f35bd36c3c
|
7
|
+
data.tar.gz: 78097bcc290d74b60cf552f320f59c80177c06bbbc8669168584db209df589ff90b4c522c1a9b386b551944b37e5ab3d8e96deb90d3885bde9a1c2c484884f88
|
data/Gemfile.lock
CHANGED
data/lib/rbc.rb
CHANGED
@@ -6,9 +6,9 @@ class RBC
|
|
6
6
|
include RBCVersion
|
7
7
|
include BSIServices
|
8
8
|
BSI_INSTANCES = {
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
'mirror' => 'https://websvc-mirror.bsisystems.com:2271/bsi/xmlrpc',
|
10
|
+
'staging' => 'https://websvc-mirror.bsisystems.com:2271/bsi/xmlrpc',
|
11
|
+
'production' => 'https://websvc.bsisystems.com:2262/bsi/xmlrpc'
|
12
12
|
}
|
13
13
|
|
14
14
|
attr_accessor :session_id, :url_target, :creds, :test, :common
|
@@ -22,6 +22,8 @@ class RBC
|
|
22
22
|
|
23
23
|
# Initialize connection based on provided credentials
|
24
24
|
def initialize(creds, options={:debug=>false, :stealth=>false, :instance=>:mirror})
|
25
|
+
options[:stealth] ||= false
|
26
|
+
options[:instance] ||= 'mirror'
|
25
27
|
raise ArgumentError, """
|
26
28
|
No credentials hash provided, expected a hash in the form of:
|
27
29
|
{
|
@@ -30,11 +32,12 @@ No credentials hash provided, expected a hash in the form of:
|
|
30
32
|
:server => 'MYBSIDATABASE',
|
31
33
|
}
|
32
34
|
""" if creds.class != Hash || creds[:user].nil? || creds[:pass].nil? || creds[:server].nil?
|
33
|
-
raise ArgumentError, 'Please provide either a valid instance or specify a custom url using option key :url => \'https://...\'' if BSI_INSTANCES[options[:instance]].nil? && options[:url].nil? && options[:stealth]==false
|
34
|
-
options[:url] = BSI_INSTANCES[options[:instance]] unless options[:url]
|
35
|
-
self.url_target = options[:url]
|
36
35
|
|
37
|
-
|
36
|
+
options[:url] ||= BSI_INSTANCES[options[:instance].to_s]
|
37
|
+
@url_target = options[:url]
|
38
|
+
if options[:stealth]==false && @url_target.nil?
|
39
|
+
raise ArgumentError, 'Please provide either a valid instance key or specify a custom url using option key :url => \'https://...\''
|
40
|
+
end
|
38
41
|
|
39
42
|
self.session_id = creds[:session_id] if creds[:session_id]
|
40
43
|
services = YAML::load(File.open(File.join(File.dirname(__FILE__), 'service_spec.yaml')))
|
data/lib/rbc/version.rb
CHANGED
data/spec/rbc_spec.rb
CHANGED
@@ -13,11 +13,13 @@ describe RBC do
|
|
13
13
|
expect{RBC.new([])}.to raise_error(ArgumentError)
|
14
14
|
expect{RBC.new({:user => 'me'})}.to raise_error(ArgumentError)
|
15
15
|
expect{RBC.new({:user => 'me', :pass => 'too'})}.to raise_error(ArgumentError)
|
16
|
+
expect{RBC.new({:user => 'me', :pass => 'too', :server => 'my_server'}, {:instance => :bad_instance})}.to raise_error(ArgumentError)
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'takes an optional instance parameter' do
|
19
20
|
@bsi = RBC.new({:user => 'me', :pass => 'pass', :server => 'server'}, {:instance => :mirror})
|
20
|
-
expect(@bsi.url_target).to eq(RBC::BSI_INSTANCES[
|
21
|
+
expect(@bsi.url_target).to eq(RBC::BSI_INSTANCES['mirror'])
|
22
|
+
expect(@bsi.url_target)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Christensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|