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.



213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/lazylead/model.rb', line 213

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