Class: Fuey::Inspections::Support::SAP
- Inherits:
-
Object
- Object
- Fuey::Inspections::Support::SAP
- Defined in:
- lib/fuey_client/fuey/inspections/support/sap.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ SAP
constructor
A new instance of SAP.
- #ping ⇒ Object
Constructor Details
#initialize(config) ⇒ SAP
Returns a new instance of SAP.
5 6 7 |
# File 'lib/fuey_client/fuey/inspections/support/sap.rb', line 5 def initialize(config) @config = config end |
Instance Method Details
#ping ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fuey_client/fuey/inspections/support/sap.rb', line 9 def ping require 'sapnwrfc' ::SAPNW::Base.config = @config conn = ::SAPNW::Base.rfc_connect attrib = conn.connection_attributes fld = conn.discover("RFC_PING") fl = fld.new_function_call response = fl.invoke [true, response] rescue Gem::LoadError return [false, %(Could not RFC Ping because the sapnwrfc gem is not available)] rescue Exception => caught return [false, caught.error] if caught.respond_to?(:error) #SAP errors [false, caught.inspect] ensure conn.close unless conn.nil? end |