Class: Twilio::REST::Authy::V1::ServiceContext::EntityContext::FactorContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb,
lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb

Overview

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 [email protected].

Defined Under Namespace

Classes: ChallengeContext, ChallengeInstance, ChallengeList, ChallengePage

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, identity, sid) ⇒ FactorContext

Initialize the FactorContext



200
201
202
203
204
205
206
207
208
209
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 200

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]}/Factors/#{@solution[:sid]}"

  # Dependents
  @challenges = nil
end

Instance Method Details

#challenges(sid = :unset) ⇒ ChallengeList, ChallengeContext

Access the challenges

Raises:

  • (ArgumentError)


266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 266

def challenges(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return ChallengeContext.new(
        @version,
        @solution[:service_sid],
        @solution[:identity],
        @solution[:sid],
        sid,
    )
  end

  unless @challenges
    @challenges = ChallengeList.new(
        @version,
        service_sid: @solution[:service_sid],
        identity: @solution[:identity],
        factor_sid: @solution[:sid],
    )
  end

  @challenges
end

#deleteBoolean

Deletes the FactorInstance



214
215
216
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 214

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

#fetchFactorInstance

Fetch a FactorInstance



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 221

def fetch
  params = Twilio::Values.of({})

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

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

#inspectObject

Provide a detailed, user friendly representation



300
301
302
303
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 300

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

#to_sObject

Provide a user friendly representation



293
294
295
296
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 293

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

#update(auth_payload: :unset) ⇒ FactorInstance

Update the FactorInstance



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 244

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

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

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