Class: Pushbots::Push
- Inherits:
-
Object
- Object
- Pushbots::Push
- Defined in:
- lib/pushbots/push.rb
Overview
Push class Holds shared data between single and batch push notifications
Constant Summary collapse
- PLATFORM_TYPE =
{ ios: 0, android: 1, chrome: 2 }.freeze
- PLATFORM_TYPE_R =
[:ios, :android, :chrome].freeze
- STATUS =
{ created: 'created', delivered: 'delivered', failed: 'failed' }.freeze
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#response ⇒ Object
Returns the value of attribute response.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(platform, message, type) ⇒ Push
constructor
A new instance of Push.
Constructor Details
#initialize(platform, message, type) ⇒ Push
Returns a new instance of Push.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pushbots/push.rb', line 12 def initialize(platform, , type) self.type = type if type == :one validates_platform(platform) self.platform = PLATFORM_TYPE[platform] elsif type == :all validates_platforms(platform) self.platform = platform.map { |t| PLATFORM_TYPE[t] } end self. = self.status = STATUS[:created] end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/pushbots/push.rb', line 5 def end |
#platform ⇒ Object
Returns the value of attribute platform.
5 6 7 |
# File 'lib/pushbots/push.rb', line 5 def platform @platform end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/pushbots/push.rb', line 5 def response @response end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/pushbots/push.rb', line 5 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/pushbots/push.rb', line 5 def type @type end |