Class: Apnotic::AbstractNotification
- Inherits:
-
Object
- Object
- Apnotic::AbstractNotification
- Defined in:
- lib/apnotic/abstract_notification.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#apns_collapse_id ⇒ Object
Returns the value of attribute apns_collapse_id.
-
#apns_id ⇒ Object
Returns the value of attribute apns_id.
-
#authorization ⇒ Object
Returns the value of attribute authorization.
-
#expiration ⇒ Object
Returns the value of attribute expiration.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#push_type ⇒ Object
Returns the value of attribute push_type.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#topic ⇒ Object
Returns the value of attribute topic.
Instance Method Summary collapse
- #authorization_header ⇒ Object
- #background_notification? ⇒ Boolean
- #body ⇒ Object
-
#initialize(token) ⇒ AbstractNotification
constructor
A new instance of AbstractNotification.
Constructor Details
#initialize(token) ⇒ AbstractNotification
Returns a new instance of AbstractNotification.
17 18 19 20 |
# File 'lib/apnotic/abstract_notification.rb', line 17 def initialize(token) @token = token @apns_id = SecureRandom.uuid end |
Instance Attribute Details
#apns_collapse_id ⇒ Object
Returns the value of attribute apns_collapse_id.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def apns_collapse_id @apns_collapse_id end |
#apns_id ⇒ Object
Returns the value of attribute apns_id.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def apns_id @apns_id end |
#authorization ⇒ Object
Returns the value of attribute authorization.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def @authorization end |
#expiration ⇒ Object
Returns the value of attribute expiration.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def expiration @expiration end |
#priority ⇒ Object
Returns the value of attribute priority.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def priority @priority end |
#push_type ⇒ Object
Returns the value of attribute push_type.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def push_type @push_type end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
8 9 10 |
# File 'lib/apnotic/abstract_notification.rb', line 8 def token @token end |
#topic ⇒ Object
Returns the value of attribute topic.
9 10 11 |
# File 'lib/apnotic/abstract_notification.rb', line 9 def topic @topic end |
Instance Method Details
#authorization_header ⇒ Object
26 27 28 |
# File 'lib/apnotic/abstract_notification.rb', line 26 def ? "bearer #{}" : nil end |
#background_notification? ⇒ Boolean
30 31 32 |
# File 'lib/apnotic/abstract_notification.rb', line 30 def background_notification? false end |
#body ⇒ Object
22 23 24 |
# File 'lib/apnotic/abstract_notification.rb', line 22 def body JSON.dump(to_hash).force_encoding(Encoding::BINARY) end |