Class: OneSignal::Responses::Notification

Inherits:
BaseResponse show all
Defined in:
lib/onesignal/responses/notification.rb

Overview

Example JSON {

"id":           '481a2734-6b7d-11e4-a6ea-4b53294fa671',
"successful":   15,
"failed":       1,
"converted":    3,
"remaining":    0,
"queued_at":    1_415_914_655,
"send_after":   1_415_914_655,
"completed_at": 1_415_914_656,
"url":          'https://yourWebsiteToOpen.com',
"data":         {
  "foo":  'bar',
  "your": 'custom metadata'
},
"canceled":     false,
"headings":     {
  "en": 'English and default language heading',
  "es": 'Spanish language heading'
},
"contents":     {
  "en": 'English language content',
  "es": 'Hola'
}

}

Constant Summary collapse

ATTRIBUTES_WHITELIST =
%i[id successful failed converted remaining
queued_at send_after completed_at url data
canceled headings contents].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResponse

#initialize

Constructor Details

This class inherits a constructor from OneSignal::Responses::BaseResponse

Class Method Details

.from_json(json) ⇒ Object



39
40
41
42
# File 'lib/onesignal/responses/notification.rb', line 39

def self.from_json json
  body = json.is_a?(String) ? JSON.parse(json) : json
  new(body)
end

Instance Method Details

#canceled?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/onesignal/responses/notification.rb', line 35

def canceled?
  canceled
end