Class: Twilio::REST::Autopilot::V1::AssistantContext::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Autopilot::V1::AssistantContext::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Webhook resource.
-
#assistant_sid ⇒ String
The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#events ⇒ String
The list of space-separated events that this Webhook is subscribed to.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#initialize(version, payload, assistant_sid: nil, sid: nil) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#sid ⇒ String
The unique string that we created to identify the Webhook resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unique_name ⇒ String
An application-defined string that uniquely identifies the resource.
-
#update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
The absolute URL of the Webhook resource.
-
#webhook_method ⇒ String
The method used when calling the webhook’s URL.
-
#webhook_url ⇒ String
The URL associated with this Webhook.
Constructor Details
#initialize(version, payload, assistant_sid: nil, sid: nil) ⇒ WebhookInstance
Initialize the WebhookInstance
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 281 def initialize(version, payload , assistant_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'url' => payload['url'], 'account_sid' => payload['account_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'assistant_sid' => payload['assistant_sid'], 'sid' => payload['sid'], 'unique_name' => payload['unique_name'], 'events' => payload['events'], 'webhook_url' => payload['webhook_url'], 'webhook_method' => payload['webhook_method'], } # Context @instance_context = nil @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Webhook resource.
322 323 324 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 322 def account_sid @properties['account_sid'] end |
#assistant_sid ⇒ String
Returns The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.
340 341 342 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 340 def assistant_sid @properties['assistant_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
307 308 309 310 311 312 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 307 def context unless @instance_context @instance_context = WebhookContext.new(@version , @params['assistant_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
328 329 330 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 328 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
334 335 336 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 334 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the WebhookInstance
377 378 379 380 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 377 def delete context.delete end |
#events ⇒ String
Returns The list of space-separated events that this Webhook is subscribed to.
358 359 360 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 358 def events @properties['events'] end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
385 386 387 388 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 385 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
421 422 423 424 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 421 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Autopilot.V1.WebhookInstance #{values}>" end |
#sid ⇒ String
Returns The unique string that we created to identify the Webhook resource.
346 347 348 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 346 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
414 415 416 417 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 414 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Autopilot.V1.WebhookInstance #{values}>" end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the resource. It can be used in place of the resource’s ‘sid` in the URL to address the resource.
352 353 354 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 352 def unique_name @properties['unique_name'] end |
#update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset) ⇒ WebhookInstance
Update the WebhookInstance
397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 397 def update( unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset ) context.update( unique_name: unique_name, events: events, webhook_url: webhook_url, webhook_method: webhook_method, ) end |
#url ⇒ String
Returns The absolute URL of the Webhook resource.
316 317 318 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 316 def url @properties['url'] end |
#webhook_method ⇒ String
Returns The method used when calling the webhook’s URL.
370 371 372 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 370 def webhook_method @properties['webhook_method'] end |
#webhook_url ⇒ String
Returns The URL associated with this Webhook.
364 365 366 |
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 364 def webhook_url @properties['webhook_url'] end |