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 that created this Notification resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



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
275
276
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 249

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'],
        'request_variables' => payload['request_variables'],
        'response_body' => payload['response_body'],
        'response_headers' => payload['response_headers'],
        'sid' => payload['sid'],
        'uri' => payload['uri'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Call Notification resource.

Returns:



291
292
293
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 291

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.



297
298
299
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 297

def api_version
    @properties['api_version']
end

#call_sidString

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

Returns:



303
304
305
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 303

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:



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

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 date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



309
310
311
# File 'lib/twilio-ruby/rest/api/v2010/account/call/notification.rb', line 309

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



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

def date_updated
    @properties['date_updated']
end

#error_codeString

Returns A unique error code for the error condition that is described in our [Error Dictionary](www.twilio.com/docs/api/errors).

Returns:



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

def error_code
    @properties['error_code']
end

#fetchNotificationInstance

Fetch the NotificationInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#logString

Returns An integer log level that corresponds to the type of notification: ‘0` is ERROR, `1` is WARNING.

Returns:

  • (String)

    An integer log level that corresponds to the type of notification: ‘0` is ERROR, `1` is WARNING.



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

def log
    @properties['log']
end

#message_dateTime

Returns The date the notification was actually generated in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from ‘date_created`.

Returns:

  • (Time)

    The date the notification was actually generated in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from ‘date_created`.



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

def message_date
    @properties['message_date']
end

#message_textString

Returns The text of the notification.

Returns:

  • (String)

    The text of the notification.



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

def message_text
    @properties['message_text']
end

#more_infoString

Returns The URL for more information about the error condition. This value is a page in our [Error Dictionary](www.twilio.com/docs/api/errors).

Returns:

  • (String)

    The URL for more information about the error condition. This value is a page in our [Error Dictionary](www.twilio.com/docs/api/errors).



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

def more_info
    @properties['more_info']
end

#request_methodString

Returns The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers.

Returns:

  • (String)

    The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers.



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

def request_method
    @properties['request_method']
end

#request_urlString

Returns The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called.

Returns:

  • (String)

    The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called.



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

def request_url
    @properties['request_url']
end

#request_variablesString

Returns The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API.

Returns:

  • (String)

    The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API.



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

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.



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

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.



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

def response_headers
    @properties['response_headers']
end

#sidString

Returns The unique string that that we created to identify the Call Notification resource.

Returns:

  • (String)

    The unique string that that we created to identify the Call Notification resource.



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

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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`.



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

def uri
    @properties['uri']
end