Class: Push0r::Service Abstract
- Inherits:
-
Object
- Object
- Push0r::Service
- Defined in:
- lib/push0r/Service.rb
Overview
Service is the base class for all implemented push services. A Service encapsulates everything that is necessary to take a batch of push notifications and transmit it to the receivers.
Direct Known Subclasses
Instance Method Summary collapse
-
#can_send?(message) ⇒ Boolean
abstract
Called on the service every time a PushMessage is added to a Queue in order to determine whether it can send the given message.
-
#end_push ⇒ Array(Array<String>, Array<String>)
abstract
Called on the service during the flushing of a Queue after the last PushMessage has been sent.
-
#init_push ⇒ void
abstract
Called on the service during the flushing of a Queue before the first PushMessage is sent.
-
#send(message) ⇒ void
abstract
Sends a single push message.
Instance Method Details
#can_send?(message) ⇒ Boolean
Called on the service every time a PushMessage is added to a Queue in order to determine whether it can send the given message.
16 17 18 |
# File 'lib/push0r/Service.rb', line 16 def can_send?() return false end |
#end_push ⇒ Array(Array<String>, Array<String>)
Called on the service during the flushing of a Queue after the last PushMessage has been sent. If the service manages its own internal queue, this is the place to actually transmit all messages.
44 45 46 47 |
# File 'lib/push0r/Service.rb', line 44 def end_push ## empty return [[], []] end |
#init_push ⇒ void
This method returns an undefined value.
Called on the service during the flushing of a Queue before the first PushMessage is sent.
35 36 37 |
# File 'lib/push0r/Service.rb', line 35 def init_push ## empty end |
#send(message) ⇒ void
This method returns an undefined value.
Sends a single push message. This is called during the flushing of a Queue for every enqueued PushMessage. The service may create its own internal queue in order to efficiently batch the messages.
26 27 28 |
# File 'lib/push0r/Service.rb', line 26 def send() ## empty end |