Class: BaseHelper
- Inherits:
-
Object
- Object
- BaseHelper
- Defined in:
- lib/nexpose_ticketing/helpers/base_helper.rb
Direct Known Subclasses
JiraHelper, RemedyHelper, ServiceDeskHelper, ServiceNowHelper
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#service_data ⇒ Object
Returns the value of attribute service_data.
Instance Method Summary collapse
-
#finish ⇒ Object
Performs any necessary clean-up.
-
#initialize(service_data, options, mode) ⇒ BaseHelper
constructor
A new instance of BaseHelper.
-
#load_dependencies ⇒ Object
Load the mode helper specified in the config.
Constructor Details
#initialize(service_data, options, mode) ⇒ BaseHelper
Returns a new instance of BaseHelper.
13 14 15 16 17 18 19 20 21 |
# File 'lib/nexpose_ticketing/helpers/base_helper.rb', line 13 def initialize(service_data, , mode) @service_data = service_data @options = @log = NexposeTicketing::NxLogger.instance @metrics = NexposeTicketing::TicketMetrics.new load_dependencies @mode_helper = mode end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/nexpose_ticketing/helpers/base_helper.rb', line 11 def @options end |
#service_data ⇒ Object
Returns the value of attribute service_data.
11 12 13 |
# File 'lib/nexpose_ticketing/helpers/base_helper.rb', line 11 def service_data @service_data end |
Instance Method Details
#finish ⇒ Object
Performs any necessary clean-up
40 41 42 |
# File 'lib/nexpose_ticketing/helpers/base_helper.rb', line 40 def finish @metrics.finish end |
#load_dependencies ⇒ Object
Load the mode helper specified in the config
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nexpose_ticketing/helpers/base_helper.rb', line 24 def load_dependencies file = "#{@options[:ticket_mode]}_mode.rb".downcase path = File.join(File.dirname(__FILE__), "../modes/#{file}") @log.("Loading #{@options[:ticket_mode]} mode dependencies.") begin require_relative path rescue => e error = "Ticket mode dependency '#{file}' could not be loaded." @log. e.to_s @log. error fail error end end |