class Twilio::REST::Verify::V2::ServiceContext::WebhookContext
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the WebhookContext
@param [Version] version Version
that contains the resource @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 [WebhookContext] WebhookContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 186 def initialize(version, service_sid, sid) 187 super(version) 188 189 # Path Solution 190 @solution = {service_sid: service_sid, sid: sid, } 191 @uri = "/Services/#{@solution[:service_sid]}/Webhooks/#{@solution[:sid]}" 192 end
Public Instance Methods
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 225 def delete 226 @version.delete('DELETE', @uri) 227 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 232 def fetch 233 payload = @version.fetch('GET', @uri) 234 235 WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 236 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 247 def inspect 248 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 249 "#<Twilio.Verify.V2.WebhookContext #{context}>" 250 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/webhook.rb 240 def to_s 241 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 242 "#<Twilio.Verify.V2.WebhookContext #{context}>" 243 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 208 def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) 209 data = Twilio::Values.of({ 210 'FriendlyName' => friendly_name, 211 'EventTypes' => Twilio.serialize_list(event_types) { |e| e }, 212 'WebhookUrl' => webhook_url, 213 'Status' => status, 214 'Version' => version, 215 }) 216 217 payload = @version.update('POST', @uri, data: data) 218 219 WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 220 end