Class: Twilio::REST::Notify::V1::ServiceContext::NotificationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Notify::V1::ServiceContext::NotificationInstance
- Defined in:
- lib/twilio-ruby/rest/notify/v1/service/notification.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the Notification resource.
-
#action ⇒ String
The actions to display for the notification.
-
#alexa ⇒ Hash
Deprecated.
-
#apn ⇒ Hash
The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings.
-
#body ⇒ String
The notification text.
-
#data ⇒ Hash
The custom key-value pairs of the notification's payload.
-
#date_created ⇒ Time
The date and time in GMT when the resource was created specified in RFC 2822 format.
-
#facebook_messenger ⇒ Hash
Deprecated.
-
#fcm ⇒ Hash
The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings.
-
#gcm ⇒ Hash
The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings.
-
#identities ⇒ Array<String>
The list of
identityvalues of the Users to notify. -
#initialize(version, payload, service_sid: nil) ⇒ NotificationInstance
constructor
Initialize the NotificationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #priority ⇒ Priority
-
#segments ⇒ Array<String>
The list of Segments to notify.
-
#service_sid ⇒ String
The SID of the Service the resource is associated with.
-
#sid ⇒ String
The unique string that we created to identify the Notification resource.
-
#sms ⇒ Hash
The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings.
-
#sound ⇒ String
The name of the sound to be played for the notification.
-
#tags ⇒ Array<String>
The tags that select the Bindings to notify.
-
#title ⇒ String
The notification title.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#ttl ⇒ String
How long, in seconds, the notification is valid.
Constructor Details
#initialize(version, payload, service_sid: nil) ⇒ NotificationInstance
Initialize the NotificationInstance
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 245 def initialize(version, payload , service_sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'service_sid' => payload['service_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'identities' => payload['identities'], 'tags' => payload['tags'], 'segments' => payload['segments'], 'priority' => payload['priority'], 'ttl' => payload['ttl'] == nil ? payload['ttl'] : payload['ttl'].to_i, 'title' => payload['title'], 'body' => payload['body'], 'sound' => payload['sound'], 'action' => payload['action'], 'data' => payload['data'], 'apn' => payload['apn'], 'gcm' => payload['gcm'], 'fcm' => payload['fcm'], 'sms' => payload['sms'], 'facebook_messenger' => payload['facebook_messenger'], 'alexa' => payload['alexa'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the Notification resource.
283 284 285 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 283 def account_sid @properties['account_sid'] end |
#action ⇒ String
Returns The actions to display for the notification. For APNS, translates to the aps.category value. For GCM, translates to the data.twi_action value. For SMS, this parameter is not supported and is omitted from deliveries to those channels.
349 350 351 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 349 def action @properties['action'] end |
#alexa ⇒ Hash
Returns Deprecated.
391 392 393 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 391 def alexa @properties['alexa'] end |
#apn ⇒ Hash
Returns The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS Payload item, therefore the aps key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the APNS documentation for more details. We reserve keys that start with twi_ for future use. Custom keys that start with twi_ are not allowed.
361 362 363 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 361 def apn @properties['apn'] end |
#body ⇒ String
Returns The notification text. For FCM and GCM, translates to data.twi_body. For APNS, translates to aps.alert.body. For SMS, translates to body. SMS requires either this body value, or media_urls attribute defined in the sms parameter of the notification.
337 338 339 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 337 def body @properties['body'] end |
#data ⇒ Hash
Returns The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to data in the FCM and GCM payloads. FCM and GCM reserve certain keys that cannot be used in those channels. For APNS, attributes of data are inserted into the APNS payload as custom properties outside of the aps dictionary. In all channels, we reserve keys that start with twi_ for future use. Custom keys that start with twi_ are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels.
355 356 357 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 355 def data @properties['data'] end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in RFC 2822 format.
295 296 297 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 295 def date_created @properties['date_created'] end |
#facebook_messenger ⇒ Hash
Returns Deprecated.
385 386 387 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 385 def facebook_messenger @properties['facebook_messenger'] end |
#fcm ⇒ Hash
Returns The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the FCM documentation for more details. Target parameters to, registration_ids, condition, and notification_key are not allowed in this parameter. We reserve keys that start with twi_ for future use. Custom keys that start with twi_ are not allowed. FCM also reserves certain keys, which cannot be used in that channel.
373 374 375 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 373 def fcm @properties['fcm'] end |
#gcm ⇒ Hash
Returns The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters to, registration_ids, and notification_key are not allowed. We reserve keys that start with twi_ for future use. Custom keys that start with twi_ are not allowed.
367 368 369 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 367 def gcm @properties['gcm'] end |
#identities ⇒ Array<String>
Returns The list of identity values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list.
301 302 303 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 301 def identities @properties['identities'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
403 404 405 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 403 def inspect "<Twilio.Notify.V1.NotificationInstance>" end |
#priority ⇒ Priority
319 320 321 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 319 def priority @properties['priority'] end |
#segments ⇒ Array<String>
Returns The list of Segments to notify. The Segment resource is deprecated. Use the tags property, instead.
313 314 315 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 313 def segments @properties['segments'] end |
#service_sid ⇒ String
Returns The SID of the Service the resource is associated with.
289 290 291 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 289 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Notification resource.
277 278 279 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 277 def sid @properties['sid'] end |
#sms ⇒ Hash
Returns The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding form parameter of the Twilio Message resource. These parameters of the Message resource are supported in snake case format: body, media_urls, status_callback, and max_price. The status_callback parameter overrides the corresponding parameter in the messaging service, if configured. The media_urls property expects a JSON array.
379 380 381 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 379 def sms @properties['sms'] end |
#sound ⇒ String
Returns The name of the sound to be played for the notification. For FCM and GCM, this Translates to data.twi_sound. For APNS, this translates to aps.sound. SMS does not support this property.
343 344 345 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 343 def sound @properties['sound'] end |
#tags ⇒ Array<String>
Returns The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property.
307 308 309 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 307 def @properties['tags'] end |
#title ⇒ String
Returns The notification title. For FCM and GCM, this translates to the data.twi_title value. For APNS, this translates to the aps.alert.title value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices.
331 332 333 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 331 def title @properties['title'] end |
#to_s ⇒ Object
Provide a user friendly representation
397 398 399 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 397 def to_s "<Twilio.Notify.V1.NotificationInstance>" end |
#ttl ⇒ String
Returns How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property.
325 326 327 |
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 325 def ttl @properties['ttl'] end |