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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_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 SID of the [Account](www.twilio.com/docs/api/rest/account) that created the Call Notification resource.

  • call_sid (String) (defaults to: nil)

    The SID of the [Call](www.twilio.com/docs/api/voice/call) the Call Notification resource is associated with.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Call Notification resource to fetch.



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 269

def initialize(version, payload, account_sid: nil, call_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' => , 'call_sid' => call_sid, 'sid' => sid || @properties['sid'], }
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



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

def 
  @properties['account_sid']
end

#api_versionString

Returns The API version used to create the Call Notification resource.

Returns:

  • (String)

    The API version used to create the Call Notification resource



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

def api_version
  @properties['api_version']
end

#call_sidString

Returns The SID of the Call the resource is associated with.

Returns:

  • (String)

    The SID of the Call the resource is associated with



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

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:



302
303
304
305
306
307
308
309
310
311
312
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 302

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

#date_createdTime

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

Returns:

  • (Time)

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



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the NotificationInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



426
427
428
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 426

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



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

def error_code
  @properties['error_code']
end

#fetchNotificationInstance

Fetch a NotificationInstance

Returns:



419
420
421
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 419

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



439
440
441
442
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 439

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



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

def log
  @properties['log']
end

#message_dateTime

Returns The date the notification was generated.

Returns:

  • (Time)

    The date the notification was generated



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

def message_date
  @properties['message_date']
end

#message_textString

Returns The text of the notification.

Returns:

  • (String)

    The text of the notification



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

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



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

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



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

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



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

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



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

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



394
395
396
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 394

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



400
401
402
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 400

def response_headers
  @properties['response_headers']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



406
407
408
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 406

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



432
433
434
435
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 432

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

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`



412
413
414
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 412

def uri
  @properties['uri']
end