Class: Rapns::Daemon::Delivery

Inherits:
Object
  • Object
show all
Includes:
Reflectable
Defined in:
lib/rapns/daemon/delivery.rb

Direct Known Subclasses

Apns::Delivery, Gcm::Delivery

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Reflectable

#reflect

Class Method Details

.perform(*args) ⇒ Object



6
7
8
# File 'lib/rapns/daemon/delivery.rb', line 6

def self.perform(*args)
  new(*args).perform
end

Instance Method Details

#mark_deliveredObject



19
20
21
22
# File 'lib/rapns/daemon/delivery.rb', line 19

def mark_delivered
  Rapns::Daemon.store.mark_delivered(@notification)
  reflect(:notification_delivered, @notification)
end

#mark_failed(code, description) ⇒ Object



24
25
26
27
# File 'lib/rapns/daemon/delivery.rb', line 24

def mark_failed(code, description)
  Rapns::Daemon.store.mark_failed(@notification, code, description)
  reflect(:notification_failed, @notification)
end

#retry_after(notification, deliver_after) ⇒ Object



10
11
12
13
# File 'lib/rapns/daemon/delivery.rb', line 10

def retry_after(notification, deliver_after)
  Rapns::Daemon.store.retry_after(notification, deliver_after)
  reflect(:notification_will_retry, notification)
end

#retry_exponentially(notification) ⇒ Object



15
16
17
# File 'lib/rapns/daemon/delivery.rb', line 15

def retry_exponentially(notification)
  retry_after(notification, Time.now + 2 ** (notification.retries + 1))
end