class Twilio::REST::Autopilot::V1::AssistantContext::WebhookContext
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 WebhookContext
@param [Version] version Version
that contains the resource @param [String] assistant_sid The SID of the
{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the parent of the resource to fetch.
@param [String] sid The Twilio-provided string that uniquely identifies the
Webhook resource to fetch.
@return [WebhookContext] WebhookContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 187 def initialize(version, assistant_sid, sid) 188 super(version) 189 190 # Path Solution 191 @solution = {assistant_sid: assistant_sid, sid: sid, } 192 @uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks/#{@solution[:sid]}" 193 end
Public Instance Methods
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 242 def delete 243 @version.delete('DELETE', @uri) 244 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 198 def fetch 199 payload = @version.fetch('GET', @uri) 200 201 WebhookInstance.new( 202 @version, 203 payload, 204 assistant_sid: @solution[:assistant_sid], 205 sid: @solution[:sid], 206 ) 207 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 255 def inspect 256 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 257 "#<Twilio.Autopilot.V1.WebhookContext #{context}>" 258 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb 248 def to_s 249 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 250 "#<Twilio.Autopilot.V1.WebhookContext #{context}>" 251 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 221 def update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset) 222 data = Twilio::Values.of({ 223 'UniqueName' => unique_name, 224 'Events' => events, 225 'WebhookUrl' => webhook_url, 226 'WebhookMethod' => webhook_method, 227 }) 228 229 payload = @version.update('POST', @uri, data: data) 230 231 WebhookInstance.new( 232 @version, 233 payload, 234 assistant_sid: @solution[:assistant_sid], 235 sid: @solution[:sid], 236 ) 237 end