Class: Twilio::REST::Verify::V2::ServiceContext::WebhookContext

Inherits:
InstanceContext
  • Object
show all
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

Constructor Details

#initialize(version, service_sid, sid) ⇒ WebhookContext

Initialize the WebhookContext



182
183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 182

def initialize(version, service_sid, sid)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, sid: sid, }
  @uri = "/Services/#{@solution[:service_sid]}/Webhooks/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the WebhookInstance



217
218
219
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 217

def delete
   @version.delete('DELETE', @uri)
end

#fetchWebhookInstance

Fetch the WebhookInstance



224
225
226
227
228
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 224

def fetch
  payload = @version.fetch('GET', @uri)

  WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



239
240
241
242
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 239

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Verify.V2.WebhookContext #{context}>"
end

#to_sObject

Provide a user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 232

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Verify.V2.WebhookContext #{context}>"
end

#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset) ⇒ WebhookInstance

Update the WebhookInstance



201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 201

def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
      'WebhookUrl' => webhook_url,
      'Status' => status,
  })

  payload = @version.update('POST', @uri, data: data)

  WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end