class Twilio::REST::Verify::V2::ServiceContext::EntityContext::FactorContext
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the FactorContext
@param [Version] version Version
that contains the resource @param [String] service_sid The unique SID identifier of the Service. @param [String] identity Customer unique identity for the Entity owner of the
Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
@param [String] sid A 34 character string that uniquely identifies this Factor. @return [FactorContext] FactorContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 171 def initialize(version, service_sid, identity, sid) 172 super(version) 173 174 # Path Solution 175 @solution = {service_sid: service_sid, identity: identity, sid: sid, } 176 @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors/#{@solution[:sid]}" 177 end
Public Instance Methods
Delete the FactorInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 182 def delete 183 @version.delete('DELETE', @uri) 184 end
Fetch the FactorInstance
@return [FactorInstance] Fetched FactorInstance
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 189 def fetch 190 payload = @version.fetch('GET', @uri) 191 192 FactorInstance.new( 193 @version, 194 payload, 195 service_sid: @solution[:service_sid], 196 identity: @solution[:identity], 197 sid: @solution[:sid], 198 ) 199 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 255 def inspect 256 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 257 "#<Twilio.Verify.V2.FactorContext #{context}>" 258 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 248 def to_s 249 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 250 "#<Twilio.Verify.V2.FactorContext #{context}>" 251 end
Update the FactorInstance
@param [String] auth_payload The optional payload needed to verify the Factor
for the first time. E.g. for a TOTP, the numeric code.
@param [String] friendly_name The new friendly name of this Factor. It can be up
to 64 characters.
@param [String] config_notification_token For APN, the device token. For FCM the
registration token. It used to send the push notifications. Required when `factor_type` is `push`. If specified, this value must be between 32 and 255 characters long.
@param [String] config_sdk_version The Verify
Push SDK version used to configure
the factor
@param [String] config_time_step Defines how often, in seconds, are TOTP codes
generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive
@param [String] config_skew The number of time-steps, past and future, that are
valid for validation of TOTP codes. Must be between 0 and 2, inclusive
@param [String] config_code_length Number of digits for generated TOTP codes.
Must be between 3 and 8, inclusive
@param [factor.TotpAlgorithms] config_alg The algorithm used to derive the TOTP
codes. Can be `sha1`, `sha256` or `sha512`
@return [FactorInstance] Updated FactorInstance
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 223 def update(auth_payload: :unset, friendly_name: :unset, config_notification_token: :unset, config_sdk_version: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset) 224 data = Twilio::Values.of({ 225 'AuthPayload' => auth_payload, 226 'FriendlyName' => friendly_name, 227 'Config.NotificationToken' => config_notification_token, 228 'Config.SdkVersion' => config_sdk_version, 229 'Config.TimeStep' => config_time_step, 230 'Config.Skew' => config_skew, 231 'Config.CodeLength' => config_code_length, 232 'Config.Alg' => config_alg, 233 }) 234 235 payload = @version.update('POST', @uri, data: data) 236 237 FactorInstance.new( 238 @version, 239 payload, 240 service_sid: @solution[:service_sid], 241 identity: @solution[:identity], 242 sid: @solution[:sid], 243 ) 244 end