Class: Lazylead::ORM::Task

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

Overview

General lazylead task.

Instance Method Summary collapse

Methods included from Lazylead::ORM

#env, #inspect, #to_hash, #to_s

Instance Method Details

#exec(log = Log::NOTHING) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/lazylead/model.rb', line 91

def exec(log = Log::NOTHING)
  log.debug("Task ##{id} '#{name}' is started")
  action.constantize
        .new(log)
        .run(system.connect(log), postman(log), props)
  log.debug("Task ##{id} '#{name}' is completed")
end

#postman(log = Log::NOTHING) ⇒ Object



104
105
106
107
108
109
110
111
# File 'lib/lazylead/model.rb', line 104

def postman(log = Log::NOTHING)
  if props.key? "postman"
    props["postman"].constantize.new(log)
  else
    log.warn "No postman details provided, an local stub is used."
    Postman.new
  end
end

#propsObject



99
100
101
102
# File 'lib/lazylead/model.rb', line 99

def props
  return @prop if defined? @prop
  @prop = team.to_hash.merge(to_hash)
end