Class: Twilio::REST::Verify::V2::ServiceContext::VerificationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/verification.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ VerificationInstance

Initialize the VerificationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Verification resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 239

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'service_sid' => payload['service_sid'],
        'account_sid' => payload['account_sid'],
        'to' => payload['to'],
        'channel' => payload['channel'],
        'status' => payload['status'],
        'valid' => payload['valid'],
        'lookup' => payload['lookup'],
        'amount' => payload['amount'],
        'payee' => payload['payee'],
        'send_code_attempts' => payload['send_code_attempts'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'sna' => payload['sna'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'service_sid' => service_sid  || @properties['service_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Verification resource.

Returns:



291
292
293
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 291

def 
    @properties['account_sid']
end

#amountString

Returns The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

Returns:

  • (String)

    The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.



327
328
329
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 327

def amount
    @properties['amount']
end

#channelChannel

Returns:

  • (Channel)


303
304
305
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 303

def channel
    @properties['channel']
end

#contextVerificationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



270
271
272
273
274
275
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 270

def context
    unless @instance_context
        @instance_context = VerificationContext.new(@version , @params['service_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



345
346
347
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 345

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



351
352
353
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 351

def date_updated
    @properties['date_updated']
end

#fetchVerificationInstance

Fetch the VerificationInstance

Returns:



370
371
372
373
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 370

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



397
398
399
400
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 397

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Verify.V2.VerificationInstance #{values}>"
end

#lookupHash

Returns Information about the phone number being verified.

Returns:

  • (Hash)

    Information about the phone number being verified.



321
322
323
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 321

def lookup
    @properties['lookup']
end

#payeeString

Returns The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

Returns:

  • (String)

    The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.



333
334
335
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 333

def payee
    @properties['payee']
end

#send_code_attemptsArray<Hash>

Returns An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.

Returns:

  • (Array<Hash>)

    An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.



339
340
341
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 339

def send_code_attempts
    @properties['send_code_attempts']
end

#service_sidString

Returns The SID of the [Service](www.twilio.com/docs/verify/api/service) the resource is associated with.

Returns:



285
286
287
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 285

def service_sid
    @properties['service_sid']
end

#sidString

Returns The unique string that we created to identify the Verification resource.

Returns:

  • (String)

    The unique string that we created to identify the Verification resource.



279
280
281
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 279

def sid
    @properties['sid']
end

#snaHash

Returns The set of fields used for a silent network auth (‘sna`) verification. Contains a single field with the URL to be invoked to verify the phone number.

Returns:

  • (Hash)

    The set of fields used for a silent network auth (‘sna`) verification. Contains a single field with the URL to be invoked to verify the phone number.



357
358
359
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 357

def sna
    @properties['sna']
end

#statusString

Returns The status of the verification. Can be: ‘pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`.

Returns:

  • (String)

    The status of the verification. Can be: ‘pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`.



309
310
311
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 309

def status
    @properties['status']
end

#toString

Returns The phone number or [email](www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](www.twilio.com/docs/glossary/what-e164).

Returns:



297
298
299
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 297

def to
    @properties['to']
end

#to_sObject

Provide a user friendly representation



390
391
392
393
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 390

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Verify.V2.VerificationInstance #{values}>"
end

#update(status: nil) ⇒ VerificationInstance

Update the VerificationInstance

Parameters:

  • status (Status) (defaults to: nil)

Returns:



379
380
381
382
383
384
385
386
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 379

def update(
    status: nil
)

    context.update(
        status: status, 
    )
end

#urlString

Returns The absolute URL of the Verification resource.

Returns:

  • (String)

    The absolute URL of the Verification resource.



363
364
365
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 363

def url
    @properties['url']
end

#validBoolean

Returns Use "status" instead. Legacy property indicating whether the verification was successful.

Returns:

  • (Boolean)

    Use "status" instead. Legacy property indicating whether the verification was successful.



315
316
317
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 315

def valid
    @properties['valid']
end