rbc 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a3731beac6830ccaeb731bea39085387a18fa60
4
- data.tar.gz: fefacafc5c889919dfd74a1980ef2db4a7a20662
3
+ metadata.gz: 58bec22030a792ff01fa066a212112f31b5b79ab
4
+ data.tar.gz: 5718e2a4934ff95b6bd3c2f31388144ebc25967a
5
5
  SHA512:
6
- metadata.gz: 3f58393a6e1ad1752f7ea19b773fee346df289bc807547ad16a5182cc86e268d8107ad6e9396e30336ff02f02efa765f770fadcc21f1eb8bec1ffb3abbcce561
7
- data.tar.gz: 24c0edf06d10c7d91b6eb2995ad369c70102be9424d76ee28c860f9e55e720944c43dd771e9cda3f7cdda491cb2330ce894d41028c53ca57890a834db471a892
6
+ metadata.gz: 06115488596735702907f26c2ee7f7ac76aa0e4d75498fea9687377b59076f2b16a85a3500506942703e56d020f5233c8bd2cd6fb866aa6b3e9aa2f35bd36c3c
7
+ data.tar.gz: 78097bcc290d74b60cf552f320f59c80177c06bbbc8669168584db209df589ff90b4c522c1a9b386b551944b37e5ab3d8e96deb90d3885bde9a1c2c484884f88
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbc (0.2.8)
4
+ rbc (0.2.9)
5
5
  httparty (~> 0.9, >= 0.9.0)
6
6
  nokogiri (>= 1.5.5)
7
7
 
data/lib/rbc.rb CHANGED
@@ -6,9 +6,9 @@ class RBC
6
6
  include RBCVersion
7
7
  include BSIServices
8
8
  BSI_INSTANCES = {
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'
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
- raise RuntimError, "Invalid url" unless url_target.match(/^https?:\/\/(.+):\d{4}\/bsi\/xmlrpc$/)
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')))
@@ -1,3 +1,3 @@
1
1
  module RBCVersion
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -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[:mirror])
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.8
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-28 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler