class Twilio::REST::Autopilot::V1::AssistantContext::WebhookInstance
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
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] assistant_sid
The SID of the
{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the parent of the resource.
@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/autopilot/v1/assistant/webhook.rb 274 def initialize(version, payload, assistant_sid: nil, sid: nil) 275 super(version) 276 277 # Marshaled Properties 278 @properties = { 279 'url' => payload['url'], 280 'account_sid' => payload['account_sid'], 281 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 282 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 283 'assistant_sid' => payload['assistant_sid'], 284 'sid' => payload['sid'], 285 'unique_name' => payload['unique_name'], 286 'events' => payload['events'], 287 'webhook_url' => payload['webhook_url'], 288 'webhook_method' => payload['webhook_method'], 289 } 290 291 # Context 292 @instance_context = nil 293 @params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], } 294 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 315 def account_sid 316 @properties['account_sid'] 317 end
@return [String] The SID of the Assistant that is the parent of the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 333 def assistant_sid 334 @properties['assistant_sid'] 335 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/autopilot/v1/assistant/webhook.rb 300 def context 301 unless @instance_context 302 @instance_context = WebhookContext.new(@version, @params['assistant_sid'], @params['sid'], ) 303 end 304 @instance_context 305 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 321 def date_created 322 @properties['date_created'] 323 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 327 def date_updated 328 @properties['date_updated'] 329 end
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 398 def delete 399 context.delete 400 end
@return [String] The list of space-separated events that this Webhook is subscribed to.
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 351 def events 352 @properties['events'] 353 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 370 def fetch 371 context.fetch 372 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 411 def inspect 412 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 413 "<Twilio.Autopilot.V1.WebhookInstance #{values}>" 414 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 339 def sid 340 @properties['sid'] 341 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 404 def to_s 405 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 406 "<Twilio.Autopilot.V1.WebhookInstance #{values}>" 407 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 345 def unique_name 346 @properties['unique_name'] 347 end
Update the WebhookInstance
@param [String] unique_name
An application-defined string that uniquely
identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
@param [String] events The list of space-separated events that this Webhook will
subscribe to.
@param [String] webhook_url
The URL associated with this Webhook. @param [String] webhook_method
The method to be used when calling the webhook's
URL.
@return [WebhookInstance] Updated WebhookInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 386 def update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset) 387 context.update( 388 unique_name: unique_name, 389 events: events, 390 webhook_url: webhook_url, 391 webhook_method: webhook_method, 392 ) 393 end
@return [String] The absolute URL of the Webhook resource
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 309 def url 310 @properties['url'] 311 end
@return [String] The method used when calling the webhook's URL.
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 363 def webhook_method 364 @properties['webhook_method'] 365 end
@return [String] The URL associated with this Webhook.
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 357 def webhook_url 358 @properties['webhook_url'] 359 end