Class: RBC
Constant Summary collapse
- BSI_INSTANCES =
{ 'mirror' => 'https://websvc-mirror.bsisystems.com:2271/bsi/xmlrpc', 'staging' => 'https://websvc-mirror.bsisystems.com:2271/bsi/xmlrpc', 'production' => 'https://websvc.bsisystems.com:2262/bsi/xmlrpc' }
Constants included from RBCVersion
Instance Attribute Summary collapse
-
#common ⇒ Object
Returns the value of attribute common.
-
#creds ⇒ Object
Returns the value of attribute creds.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#test ⇒ Object
Returns the value of attribute test.
-
#url_target ⇒ Object
Returns the value of attribute url_target.
Instance Method Summary collapse
-
#initialize(creds, options = {:debug=>false, :stealth=>false, :instance=>:mirror}) ⇒ RBC
constructor
Initialize connection based on provided credentials.
Constructor Details
#initialize(creds, options = {:debug=>false, :stealth=>false, :instance=>:mirror}) ⇒ RBC
Initialize connection based on provided credentials
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rbc.rb', line 24 def initialize(creds, ={:debug=>false, :stealth=>false, :instance=>:mirror}) [:stealth] ||= false [:instance] ||= 'mirror' raise ArgumentError, """ No credentials hash provided, expected a hash in the form of: { :user => 'username', :pass => 'password', :server => 'MYBSIDATABASE', } """ if creds.class != Hash || creds[:user].nil? || creds[:pass].nil? || creds[:server].nil? [:url] ||= BSI_INSTANCES[[:instance].to_s] @url_target = [:url] if [:stealth]==false && @url_target.nil? raise ArgumentError, 'Please provide either a valid instance key or specify a custom url using option key :url => \'https://...\'' end self.session_id = creds[:session_id] if creds[:session_id] services = YAML::load(File.open(File.join(File.dirname(__FILE__), 'service_spec.yaml'))) (services.keys).each do |k| instance_eval( "self.#{k} = #{k.to_s.capitalize}.new(creds, options.merge( { :methods => services[k][:methods] } ) )" ) end @test = Test.new(creds, ) @common = Common.new(creds, ) =begin # Initialize BSI service connection adaptors @attachment = Attachment.new(creds, options.merge({:methods => %w(download) } ) ) @batch = Batch.new(creds, options.merge( { :methods => %w(addVials commit create delete get getBatchProperties getHeaders getVialProperties performL1Checks performL2Checks removeVials update updateVials reserveAvailableBsiIds)}) ) @database = Database.new(creds, options.merge( { :methods => %w(getFields getTables normalizeValues)}) ) @shipment = Shipment.new(creds, options.merge( { :methods => %w(getProperties getShipment submit update uploadManifest updateDiscrepancyResolutionSuggestions)}) ) @requisition= Requisition.new(creds, options.merge( { :methods => %w(addVials getAttachments getProperties getReqDiscrepancies removeVials save submit submitSavedRequisitions update updateDiscrepancyResolutions updatePriorities uploadAttachment uploadManifest)}) ) @reults = Report.new(creds, options.merge( { :methods => %w(createResultsBatch)}) ) @report = Report.new(creds, options.merge( { :methods => %w(count execute)}) ) @study = Study.new(creds, options.merge( { :methods => %w(getAttachments)}) ) @user = User.new(creds, options.merge( { :methods => %w(authorize create getInfo update)}) ) @subject = Subject.new(creds, options.merge( { :methods => %w(deleteSubject getAttachments getSubject getSubjectProperties performL1Checks performL2Checks saveNewSubject saveSubject)}) ) =end @common.logon if @session_id.nil? end |
Instance Attribute Details
#common ⇒ Object
Returns the value of attribute common.
14 15 16 |
# File 'lib/rbc.rb', line 14 def common @common end |
#creds ⇒ Object
Returns the value of attribute creds.
14 15 16 |
# File 'lib/rbc.rb', line 14 def creds @creds end |
#session_id ⇒ Object
Returns the value of attribute session_id.
14 15 16 |
# File 'lib/rbc.rb', line 14 def session_id @session_id end |
#test ⇒ Object
Returns the value of attribute test.
14 15 16 |
# File 'lib/rbc.rb', line 14 def test @test end |
#url_target ⇒ Object
Returns the value of attribute url_target.
14 15 16 |
# File 'lib/rbc.rb', line 14 def url_target @url_target end |