class Twilio::REST::Verify::V2::ServiceContext::WebhookInstance
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the WebhookInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] service_sid
The unique SID identifier of the Service. @param [String] sid The Twilio-provided string that uniquely identifies the
Webhook resource to fetch.
@return [WebhookInstance] WebhookInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 264 def initialize(version, payload, service_sid: nil, sid: nil) 265 super(version) 266 267 # Marshaled Properties 268 @properties = { 269 'sid' => payload['sid'], 270 'service_sid' => payload['service_sid'], 271 'account_sid' => payload['account_sid'], 272 'friendly_name' => payload['friendly_name'], 273 'event_types' => payload['event_types'], 274 'status' => payload['status'], 275 'version' => payload['version'], 276 'webhook_url' => payload['webhook_url'], 277 'webhook_method' => payload['webhook_method'], 278 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 279 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 280 'url' => payload['url'], 281 } 282 283 # Context 284 @instance_context = nil 285 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 286 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 313 def account_sid 314 @properties['account_sid'] 315 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WebhookContext] WebhookContext
for this WebhookInstance
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 292 def context 293 unless @instance_context 294 @instance_context = WebhookContext.new(@version, @params['service_sid'], @params['sid'], ) 295 end 296 @instance_context 297 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 355 def date_created 356 @properties['date_created'] 357 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 361 def date_updated 362 @properties['date_updated'] 363 end
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 398 def delete 399 context.delete 400 end
@return [Array] The array of events that this Webhook is subscribed to.
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 325 def event_types 326 @properties['event_types'] 327 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 405 def fetch 406 context.fetch 407 end
@return [String] The string that you assigned to describe the webhook
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 319 def friendly_name 320 @properties['friendly_name'] 321 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 418 def inspect 419 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 420 "<Twilio.Verify.V2.WebhookInstance #{values}>" 421 end
@return [String] Service Sid.
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 307 def service_sid 308 @properties['service_sid'] 309 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 301 def sid 302 @properties['sid'] 303 end
@return [webhook.Status] The webhook status
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 331 def status 332 @properties['status'] 333 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 411 def to_s 412 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 413 "<Twilio.Verify.V2.WebhookInstance #{values}>" 414 end
Update the WebhookInstance
@param [String] friendly_name
The string that you assigned to describe the
webhook. **This value should not contain PII.**
@param [Array] event_types
The array of events that this Webhook is
subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`
@param [String] webhook_url
The URL associated with this Webhook. @param [webhook.Status] status The webhook status. Default value is `enabled`.
One of: `enabled` or `disabled`
@param [webhook.Version] version The webhook version. Default value is `v2`
which includes all the latest fields. Version `v1` is legacy and may be removed in the future.
@return [WebhookInstance] Updated WebhookInstance
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 385 def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) 386 context.update( 387 friendly_name: friendly_name, 388 event_types: event_types, 389 webhook_url: webhook_url, 390 status: status, 391 version: version, 392 ) 393 end
@return [String] The absolute URL of the Webhook resource
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 367 def url 368 @properties['url'] 369 end
@return [webhook.Version] The webhook version
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 337 def version 338 @properties['version'] 339 end
@return [webhook.Methods] The method used when calling the webhook's URL.
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 349 def webhook_method 350 @properties['webhook_method'] 351 end
@return [String] The URL associated with this Webhook.
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 343 def webhook_url 344 @properties['webhook_url'] 345 end