Class: Twilio::REST::Notify::V1::ServiceContext::NotificationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/notify/v1/service/notification.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil) ⇒ NotificationInstance

Initialize the NotificationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The SID of the [Service](www.twilio.com/docs/notify/api/service-resource) the resource is associated with.



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 200

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'].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_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



236
237
238
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 236

def 
  @properties['account_sid']
end

#actionString

Returns The actions to display for the notification.

Returns:

  • (String)

    The actions to display for the notification



302
303
304
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 302

def action
  @properties['action']
end

#alexaHash

Returns Deprecated.

Returns:

  • (Hash)

    Deprecated



344
345
346
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 344

def alexa
  @properties['alexa']
end

#apnHash

Returns The APNS-specific payload that overrides corresponding attributes in a generic payload for APNS Bindings.

Returns:

  • (Hash)

    The APNS-specific payload that overrides corresponding attributes in a generic payload for APNS Bindings



314
315
316
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 314

def apn
  @properties['apn']
end

#bodyString

Returns The notification body text.

Returns:

  • (String)

    The notification body text



290
291
292
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 290

def body
  @properties['body']
end

#dataHash

Returns The custom key-value pairs of the notification’s payload.

Returns:

  • (Hash)

    The custom key-value pairs of the notification’s payload



308
309
310
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 308

def data
  @properties['data']
end

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created



248
249
250
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 248

def date_created
  @properties['date_created']
end

#facebook_messengerHash

Returns Deprecated.

Returns:

  • (Hash)

    Deprecated



338
339
340
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 338

def facebook_messenger
  @properties['facebook_messenger']
end

#fcmHash

Returns The FCM-specific payload that overrides corresponding attributes in generic payload for FCM Bindings.

Returns:

  • (Hash)

    The FCM-specific payload that overrides corresponding attributes in generic payload for FCM Bindings



326
327
328
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 326

def fcm
  @properties['fcm']
end

#gcmHash

Returns The GCM-specific payload that overrides corresponding attributes in generic payload for GCM Bindings.

Returns:

  • (Hash)

    The GCM-specific payload that overrides corresponding attributes in generic payload for GCM Bindings



320
321
322
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 320

def gcm
  @properties['gcm']
end

#identitiesString

Returns The list of identity values of the Users to notify.

Returns:

  • (String)

    The list of identity values of the Users to notify



254
255
256
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 254

def identities
  @properties['identities']
end

#inspectObject

Provide a detailed, user friendly representation



356
357
358
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 356

def inspect
  "<Twilio.Notify.V1.NotificationInstance>"
end

#prioritynotification.Priority

Returns The priority of the notification.

Returns:

  • (notification.Priority)

    The priority of the notification



272
273
274
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 272

def priority
  @properties['priority']
end

#segmentsString

Returns The list of Segments to notify.

Returns:

  • (String)

    The list of Segments to notify



266
267
268
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 266

def segments
  @properties['segments']
end

#service_sidString

Returns The SID of the Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Service that the resource is associated with



242
243
244
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 242

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



230
231
232
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 230

def sid
  @properties['sid']
end

#smsHash

Returns The SMS-specific payload that overrides corresponding attributes in generic payload for SMS Bindings.

Returns:

  • (Hash)

    The SMS-specific payload that overrides corresponding attributes in generic payload for SMS Bindings



332
333
334
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 332

def sms
  @properties['sms']
end

#soundString

Returns The name of the sound to be played for the notification.

Returns:

  • (String)

    The name of the sound to be played for the notification



296
297
298
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 296

def sound
  @properties['sound']
end

#tagsString

Returns The tags that select the Bindings to notify.

Returns:

  • (String)

    The tags that select the Bindings to notify



260
261
262
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 260

def tags
  @properties['tags']
end

#titleString

Returns The notification title.

Returns:

  • (String)

    The notification title



284
285
286
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 284

def title
  @properties['title']
end

#to_sObject

Provide a user friendly representation



350
351
352
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 350

def to_s
  "<Twilio.Notify.V1.NotificationInstance>"
end

#ttlString

Returns How long, in seconds, the notification is valid.

Returns:

  • (String)

    How long, in seconds, the notification is valid



278
279
280
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 278

def ttl
  @properties['ttl']
end