Class: QueuedDispatch

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/forge/app/models/queued_dispatch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.send_queued!Object



23
24
25
# File 'lib/forge/app/models/queued_dispatch.rb', line 23

def self.send_queued!
  self.queued.all.each { |m| m.send! }
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/forge/app/models/queued_dispatch.rb', line 36

def failed?
  self.failed_attempts > 0 && !self.sent?
end

#mark_as_opened!Object



27
28
29
# File 'lib/forge/app/models/queued_dispatch.rb', line 27

def mark_as_opened!
  self.opened_at = Time.now and self.save
end

#send!Object

Action Methods



16
17
18
19
20
# File 'lib/forge/app/models/queued_dispatch.rb', line 16

def send!
  DispatchMailer.dispatch(self.dispatch, self.subscriber.email, self.subscriber.name, self.subscriber.id).deliver
  self.sent_at = Time.now
  self.save
end

#sent?Boolean

Query Methods

Returns:

  • (Boolean)


32
33
34
# File 'lib/forge/app/models/queued_dispatch.rb', line 32

def sent?
  self.sent_at
end