Class: Lazylead::ORM::System

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Lazylead::ORM
Defined in:
lib/lazylead/model.rb

Overview

Ticketing systems to monitor.

Instance Method Summary collapse

Methods included from Lazylead::ORM

#env, #inspect, #to_h?, #to_hash, #to_s

Instance Method Details

#connect(log = Log.new) ⇒ Object

Make an instance of ticketing system for future interaction.



233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/lazylead/model.rb', line 233

def connect(log = Log.new)
  opts = to_hash
  if opts["type"].empty?
    log.warn "No task system details provided, an empty stub is used."
    Empty.new
  else
    opts["type"].constantize.new(
      env(opts.except("type", "salt")),
      opts["salt"].blank? ? NoSalt.new : Salt.new(opts["salt"])
    )
  end
end