Class: Twilio::REST::Verify::V2::ServiceContext::WebhookInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/webhook.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ WebhookInstance

Initialize the WebhookInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Webhook resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 286

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'service_sid' => payload['service_sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'event_types' => payload['event_types'],
        'status' => payload['status'],
        'version' => payload['version'],
        'webhook_url' => payload['webhook_url'],
        'webhook_method' => payload['webhook_method'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'service_sid' => service_sid  || @properties['service_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 Service resource.

Returns:



335
336
337
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 335

def 
    @properties['account_sid']
end

#contextWebhookContext

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

Returns:



314
315
316
317
318
319
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 314

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



377
378
379
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 377

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



383
384
385
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 383

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the WebhookInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



396
397
398
399
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 396

def delete

    context.delete
end

#event_typesArray<String>

Returns The array of events that this Webhook is subscribed to. Possible event types: ‘*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`.

Returns:

  • (Array<String>)

    The array of events that this Webhook is subscribed to. Possible event types: ‘*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`



347
348
349
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 347

def event_types
    @properties['event_types']
end

#fetchWebhookInstance

Fetch the WebhookInstance

Returns:



404
405
406
407
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 404

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the webhook. **This value should not contain PII.**.

Returns:

  • (String)

    The string that you assigned to describe the webhook. **This value should not contain PII.**



341
342
343
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 341

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



443
444
445
446
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 443

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

#service_sidString

Returns The unique SID identifier of the Service.

Returns:

  • (String)

    The unique SID identifier of the Service.



329
330
331
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 329

def service_sid
    @properties['service_sid']
end

#sidString

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

Returns:

  • (String)

    The unique string that we created to identify the Webhook resource.



323
324
325
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 323

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


353
354
355
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 353

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



436
437
438
439
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 436

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

#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance

Update the WebhookInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the webhook. **This value should not contain PII.**

  • event_types (Array[String]) (defaults to: :unset)

    The array of events that this Webhook is subscribed to. Possible event types: ‘*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`

  • webhook_url (String) (defaults to: :unset)

    The URL associated with this Webhook.

  • status (Status) (defaults to: :unset)
  • version (Version) (defaults to: :unset)

Returns:



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 417

def update(
    friendly_name: :unset, 
    event_types: :unset, 
    webhook_url: :unset, 
    status: :unset, 
    version: :unset
)

    context.update(
        friendly_name: friendly_name, 
        event_types: event_types, 
        webhook_url: webhook_url, 
        status: status, 
        version: version, 
    )
end

#urlString

Returns The absolute URL of the Webhook resource.

Returns:

  • (String)

    The absolute URL of the Webhook resource.



389
390
391
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 389

def url
    @properties['url']
end

#versionVersion

Returns:



359
360
361
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 359

def version
    @properties['version']
end

#webhook_methodMethods

Returns:

  • (Methods)


371
372
373
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 371

def webhook_method
    @properties['webhook_method']
end

#webhook_urlString

Returns The URL associated with this Webhook.

Returns:

  • (String)

    The URL associated with this Webhook.



365
366
367
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 365

def webhook_url
    @properties['webhook_url']
end