Class: ActionPush::Provider::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/action_push/provider/base.rb

Direct Known Subclasses

Ios::Message, Test

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) {|_self| ... } ⇒ Base

Returns a new instance of Base.

Yields:

  • (_self)

Yield Parameters:



30
31
32
33
34
# File 'lib/action_push/provider/base.rb', line 30

def initialize(params = {})
  assign(params)

  yield(self) if block_given?
end

Instance Attribute Details

#deliveredObject

Boolean

true if push was successfully sent to the delivery gate



28
29
30
# File 'lib/action_push/provider/base.rb', line 28

def delivered
  @delivered
end

#delivery_methodObject

Proc

object which is responds to #call



20
21
22
# File 'lib/action_push/provider/base.rb', line 20

def delivery_method
  @delivery_method
end

#delivery_responseObject

any

response from the delivery gate



24
25
26
# File 'lib/action_push/provider/base.rb', line 24

def delivery_response
  @delivery_response
end

#payloadObject

extra data (JSON) to sent with a PUSH message as a payload



16
17
18
# File 'lib/action_push/provider/base.rb', line 16

def payload
  @payload
end

#scheduledObject

Boolean

If the PUSH message scheduled to deliver



8
9
10
# File 'lib/action_push/provider/base.rb', line 8

def scheduled
  @scheduled
end

#tokenObject

String

Device token



12
13
14
# File 'lib/action_push/provider/base.rb', line 12

def token
  @token
end

Instance Method Details

#assign(params = {}) ⇒ Self

Returns:

  • (Self)


37
38
39
40
41
# File 'lib/action_push/provider/base.rb', line 37

def assign(params = {})
  params.each { |key, value| public_send("#{key}=", value) }

  self
end

#bodyObject

Raises:

  • (NotImplementedError)


55
56
57
# File 'lib/action_push/provider/base.rb', line 55

def body
  raise NotImplementedError, __method__
end

#body=(_value) ⇒ Object

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/action_push/provider/base.rb', line 47

def body=(_value)
  raise NotImplementedError, __method__
end

#deliverObject



59
60
61
# File 'lib/action_push/provider/base.rb', line 59

def deliver
  delivery_method.call(self) if scheduled
end

#titleObject

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/action_push/provider/base.rb', line 51

def title
  raise NotImplementedError, __method__
end

#title=(_value) ⇒ Object

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/action_push/provider/base.rb', line 43

def title=(_value)
  raise NotImplementedError, __method__
end