Class: Push0r::Service Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/push0r/Service.rb

Overview

This class is abstract.

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

ApnsService, GcmService

Instance Method Summary collapse

Instance Method Details

#can_send?(message) ⇒ Boolean

This method is 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.

Parameters:

Returns:

  • (Boolean)

    true if this service can send the given message, otherwise false

See Also:



16
17
18
# File 'lib/push0r/Service.rb', line 16

def can_send?(message)
  return false
end

#end_pushArray(Array<String>, Array<String>)

This method is abstract.

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.

Returns:

  • (Array(Array<String>, Array<String>))

    Failed new RegId Messages

See Also:



44
45
46
47
# File 'lib/push0r/Service.rb', line 44

def end_push
  ## empty
  return [[], []]
end

#init_pushvoid

This method is abstract.

This method returns an undefined value.

Called on the service during the flushing of a Queue before the first PushMessage is sent.

See Also:



35
36
37
# File 'lib/push0r/Service.rb', line 35

def init_push
  ## empty
end

#send(message) ⇒ void

This method is abstract.

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.

Parameters:

See Also:



26
27
28
# File 'lib/push0r/Service.rb', line 26

def send(message)
  ## empty
end