Class: BatchPushNotification::Notification
- Inherits:
-
Object
- Object
- BatchPushNotification::Notification
- Defined in:
- lib/batch_push_notification/notification.rb
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Notification
constructor
A new instance of Notification.
- #payload ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Notification
Returns a new instance of Notification.
3 4 5 6 7 8 9 10 |
# File 'lib/batch_push_notification/notification.rb', line 3 def initialize(args = {}) @group_id = args[:group_id] @tokens = args[:tokens] @custom_ids = args[:custom_ids] @title = args[:title] @body = args[:body] @custom_payload = args[:custom_payload] end |
Instance Method Details
#payload ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/batch_push_notification/notification.rb', line 12 def payload { "group_id": @group_id, "recipients": { "tokens": @tokens, "custom_ids": @custom_ids }, "message": { "title": @title, "body": @body }, "custom_payload": @custom_payload.to_json.to_s, # the API expects a string instead of a JSON object sandbox: BatchPushNotification.sandbox }.to_json end |