Class: Twilio::REST::Verify::V2::ServiceContext::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Verify::V2::ServiceContext::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/webhook.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the resource.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The ISO 8601 date and time in GMT when the resource was created.
-
#date_updated ⇒ Time
The ISO 8601 date and time in GMT when the resource was last updated.
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#event_types ⇒ Array[String]
The array of events that this Webhook is subscribed to.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the webhook.
-
#initialize(version, payload, service_sid: nil, sid: nil) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#service_sid ⇒ String
Service Sid.
-
#sid ⇒ String
The unique string that identifies the resource.
-
#status ⇒ webhook.Status
The webhook status.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
The absolute URL of the Webhook resource.
-
#version ⇒ webhook.Version
The webhook version.
-
#webhook_method ⇒ webhook.Methods
The method used when calling the webhook's URL.
-
#webhook_url ⇒ String
The URL associated with this Webhook.
Constructor Details
#initialize(version, payload, service_sid: nil, sid: nil) ⇒ WebhookInstance
Initialize the WebhookInstance
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 264 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, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
313 314 315 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 313 def account_sid @properties['account_sid'] end |
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
292 293 294 295 296 297 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 292 def context unless @instance_context @instance_context = WebhookContext.new(@version, @params['service_sid'], @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The ISO 8601 date and time in GMT when the resource was created.
355 356 357 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 355 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The ISO 8601 date and time in GMT when the resource was last updated.
361 362 363 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 361 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the WebhookInstance
398 399 400 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 398 def delete context.delete end |
#event_types ⇒ Array[String]
Returns The array of events that this Webhook is subscribed to.
325 326 327 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 325 def event_types @properties['event_types'] end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
405 406 407 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 405 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the webhook.
319 320 321 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 319 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
418 419 420 421 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 418 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Verify.V2.WebhookInstance #{values}>" end |
#service_sid ⇒ String
Returns Service Sid.
307 308 309 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 307 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that identifies the resource.
301 302 303 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 301 def sid @properties['sid'] end |
#status ⇒ webhook.Status
Returns The webhook status.
331 332 333 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 331 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
411 412 413 414 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 411 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
385 386 387 388 389 390 391 392 393 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 385 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 |
#url ⇒ String
Returns The absolute URL of the Webhook resource.
367 368 369 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 367 def url @properties['url'] end |
#version ⇒ webhook.Version
Returns The webhook version.
337 338 339 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 337 def version @properties['version'] end |
#webhook_method ⇒ webhook.Methods
Returns The method used when calling the webhook's URL.
349 350 351 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 349 def webhook_method @properties['webhook_method'] end |
#webhook_url ⇒ String
Returns The URL associated with this Webhook.
343 344 345 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 343 def webhook_url @properties['webhook_url'] end |