Class: Twilio::REST::Api::V2010::AccountContext::NotificationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/notification.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ NotificationInstance

Initialize the NotificationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The unique id of the Account responsible for this notification.

  • sid (String) (defaults to: nil)

    The notification Sid that uniquely identifies this resource



244
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
273
274
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 244

def initialize(version, payload, account_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'api_version' => payload['api_version'],
      'call_sid' => payload['call_sid'],
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'error_code' => payload['error_code'],
      'log' => payload['log'],
      'message_date' => Twilio.deserialize_rfc2822(payload['message_date']),
      'message_text' => payload['message_text'],
      'more_info' => payload['more_info'],
      'request_method' => payload['request_method'],
      'request_url' => payload['request_url'],
      'sid' => payload['sid'],
      'uri' => payload['uri'],
      'request_variables' => payload['request_variables'],
      'response_body' => payload['response_body'],
      'response_headers' => payload['response_headers'],
  }

  # Context
  @instance_context = nil
  @params = {
      'account_sid' => ,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The unique sid that identifies this account.

Returns:

  • (String)

    The unique sid that identifies this account



293
294
295
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 293

def 
  @properties['account_sid']
end

#api_versionString

Returns The version of the Twilio API in use.

Returns:

  • (String)

    The version of the Twilio API in use



299
300
301
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 299

def api_version
  @properties['api_version']
end

#call_sidString

Returns The string that uniquely identifies the call.

Returns:

  • (String)

    The string that uniquely identifies the call



305
306
307
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 305

def call_sid
  @properties['call_sid']
end

#contextNotificationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



280
281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 280

def context
  unless @instance_context
    @instance_context = NotificationContext.new(
        @version,
        @params['account_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#date_createdTime

Returns The date this resource was created.

Returns:

  • (Time)

    The date this resource was created



311
312
313
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 311

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this resource was last updated.

Returns:

  • (Time)

    The date this resource was last updated



317
318
319
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 317

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the NotificationInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



403
404
405
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 403

def delete
  context.delete
end

#error_codeString

Returns A unique error code corresponding to the notification.

Returns:

  • (String)

    A unique error code corresponding to the notification



323
324
325
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 323

def error_code
  @properties['error_code']
end

#fetchNotificationInstance

Fetch a NotificationInstance

Returns:



396
397
398
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 396

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



416
417
418
419
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 416

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.NotificationInstance #{values}>"
end

#logString

Returns An integer log level.

Returns:

  • (String)

    An integer log level



329
330
331
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 329

def log
  @properties['log']
end

#message_dateTime

Returns The date the notification was generated.

Returns:

  • (Time)

    The date the notification was generated



335
336
337
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 335

def message_date
  @properties['message_date']
end

#message_textString

Returns The text of the notification.

Returns:

  • (String)

    The text of the notification.



341
342
343
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 341

def message_text
  @properties['message_text']
end

#more_infoString

Returns A URL for more information about the error code.

Returns:

  • (String)

    A URL for more information about the error code



347
348
349
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 347

def more_info
  @properties['more_info']
end

#request_methodString

Returns HTTP method used with the request url.

Returns:

  • (String)

    HTTP method used with the request url



353
354
355
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 353

def request_method
  @properties['request_method']
end

#request_urlString

Returns URL of the resource that generated the notification.

Returns:

  • (String)

    URL of the resource that generated the notification



359
360
361
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 359

def request_url
  @properties['request_url']
end

#request_variablesString

Returns Twilio-generated HTTP variables sent to the server.

Returns:

  • (String)

    Twilio-generated HTTP variables sent to the server



365
366
367
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 365

def request_variables
  @properties['request_variables']
end

#response_bodyString

Returns The HTTP body returned by your server.

Returns:

  • (String)

    The HTTP body returned by your server.



371
372
373
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 371

def response_body
  @properties['response_body']
end

#response_headersString

Returns The HTTP headers returned by your server.

Returns:

  • (String)

    The HTTP headers returned by your server.



377
378
379
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 377

def response_headers
  @properties['response_headers']
end

#sidString

Returns A string that uniquely identifies this notification.

Returns:

  • (String)

    A string that uniquely identifies this notification



383
384
385
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 383

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



409
410
411
412
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 409

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.NotificationInstance #{values}>"
end

#uriString

Returns The URI for this resource.

Returns:

  • (String)

    The URI for this resource



389
390
391
# File 'lib/twilio-ruby/rest/api/v2010/account/notification.rb', line 389

def uri
  @properties['uri']
end