Class: Notifu::Actor

Inherits:
Object show all
Includes:
Util, Sidekiq::Worker
Defined in:
lib/notifu/workers/actor.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

option

Class Attribute Details

.descObject

Returns the value of attribute desc.



29
30
31
# File 'lib/notifu/workers/actor.rb', line 29

def desc
  @desc
end

.nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/notifu/workers/actor.rb', line 28

def name
  @name
end

.retryObject

Returns the value of attribute retry.



30
31
32
# File 'lib/notifu/workers/actor.rb', line 30

def retry
  @retry
end

Instance Attribute Details

#contactsObject

Returns the value of attribute contacts.



25
26
27
# File 'lib/notifu/workers/actor.rb', line 25

def contacts
  @contacts
end

#issueObject

Returns the value of attribute issue.



24
25
26
# File 'lib/notifu/workers/actor.rb', line 24

def issue
  @issue
end

Instance Method Details

#actObject

‘act` function must be defined in child classes (provides notification actors modularity)



36
37
38
# File 'lib/notifu/workers/actor.rb', line 36

def act
  exit 1
end

#load_data(args) ⇒ Object



49
50
51
52
# File 'lib/notifu/workers/actor.rb', line 49

def load_data args
  self.issue = Notifu::Model::Issue.with(:notifu_id, args[0])
  self.contacts = args[1].map { |contact| Notifu::Model::Contact.with(:name, contact) }
end

#perform(*args) ⇒ Object



43
44
45
46
47
# File 'lib/notifu/workers/actor.rb', line 43

def perform *args
  sleep 2
  load_data args
  act
end