Class: Apnotic::Notification
- Inherits:
-
Object
- Object
- Apnotic::Notification
- Defined in:
- lib/apnotic/notification.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#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.
-
#badge ⇒ Object
Returns the value of attribute badge.
-
#category ⇒ Object
Returns the value of attribute category.
-
#content_available ⇒ Object
Returns the value of attribute content_available.
-
#custom_payload ⇒ Object
Returns the value of attribute custom_payload.
-
#expiration ⇒ Object
Returns the value of attribute expiration.
-
#mutable_content ⇒ Object
Returns the value of attribute mutable_content.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#topic ⇒ Object
Returns the value of attribute topic.
-
#url_args ⇒ Object
Returns the value of attribute url_args.
Instance Method Summary collapse
- #authorization_header ⇒ Object
- #body ⇒ Object
-
#initialize(token) ⇒ Notification
constructor
A new instance of Notification.
Constructor Details
#initialize(token) ⇒ Notification
Returns a new instance of Notification.
11 12 13 14 |
# File 'lib/apnotic/notification.rb', line 11 def initialize(token) @token = token @apns_id = SecureRandom.uuid end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def alert @alert end |
#apns_collapse_id ⇒ Object
Returns the value of attribute apns_collapse_id.
9 10 11 |
# File 'lib/apnotic/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/notification.rb', line 9 def apns_id @apns_id end |
#authorization ⇒ Object
Returns the value of attribute authorization.
9 10 11 |
# File 'lib/apnotic/notification.rb', line 9 def @authorization end |
#badge ⇒ Object
Returns the value of attribute badge.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def badge @badge end |
#category ⇒ Object
Returns the value of attribute category.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def category @category end |
#content_available ⇒ Object
Returns the value of attribute content_available.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def content_available @content_available end |
#custom_payload ⇒ Object
Returns the value of attribute custom_payload.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def custom_payload @custom_payload end |
#expiration ⇒ Object
Returns the value of attribute expiration.
9 10 11 |
# File 'lib/apnotic/notification.rb', line 9 def expiration @expiration end |
#mutable_content ⇒ Object
Returns the value of attribute mutable_content.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def mutable_content @mutable_content end |
#priority ⇒ Object
Returns the value of attribute priority.
9 10 11 |
# File 'lib/apnotic/notification.rb', line 9 def priority @priority end |
#sound ⇒ Object
Returns the value of attribute sound.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def sound @sound end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/apnotic/notification.rb', line 7 def token @token end |
#topic ⇒ Object
Returns the value of attribute topic.
9 10 11 |
# File 'lib/apnotic/notification.rb', line 9 def topic @topic end |
#url_args ⇒ Object
Returns the value of attribute url_args.
8 9 10 |
# File 'lib/apnotic/notification.rb', line 8 def url_args @url_args end |
Instance Method Details
#authorization_header ⇒ Object
20 21 22 |
# File 'lib/apnotic/notification.rb', line 20 def ? "bearer #{}" : nil end |
#body ⇒ Object
16 17 18 |
# File 'lib/apnotic/notification.rb', line 16 def body JSON.dump(to_hash).force_encoding(Encoding::BINARY) end |