Class: Twilio::REST::Verify::V2::ServiceContext::EntityContext::ChallengeContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/entity/challenge.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, identity, sid) ⇒ ChallengeContext

Initialize the ChallengeContext



216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 216

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

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

Instance Method Details

#fetchChallengeInstance

Fetch the ChallengeInstance



227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 227

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

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

#inspectObject

Provide a detailed, user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 267

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

#to_sObject

Provide a user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 260

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

#update(auth_payload: :unset) ⇒ ChallengeInstance

Update the ChallengeInstance



244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb', line 244

def update(auth_payload: :unset)
  data = Twilio::Values.of({'AuthPayload' => auth_payload, })

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

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