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

  • service_sid (String) (defaults to: nil)

    The SID of the Service the resource is associated with.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Verification resource to fetch.



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 216

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, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



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

def 
  @properties['account_sid']
end

#amountString

Returns The amount of the associated PSD2 compliant transaction.

Returns:

  • (String)

    The amount of the associated PSD2 compliant transaction.



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

def amount
  @properties['amount']
end

#channelverification.Channel

Returns The verification method used.

Returns:

  • (verification.Channel)

    The verification method used.



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

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:



247
248
249
250
251
252
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 247

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

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated



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

def date_updated
  @properties['date_updated']
end

#fetchVerificationInstance

Fetch the VerificationInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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



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

def lookup
  @properties['lookup']
end

#payeeString

Returns The payee of the associated PSD2 compliant transaction.

Returns:

  • (String)

    The payee of the associated PSD2 compliant transaction



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

def payee
  @properties['payee']
end

#send_code_attemptsArray[Hash]

Returns An array of verification attempt objects.

Returns:

  • (Array[Hash])

    An array of verification attempt objects.



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

def send_code_attempts
  @properties['send_code_attempts']
end

#service_sidString

Returns The SID of the Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Service that the resource is associated with



262
263
264
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 262

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



256
257
258
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 256

def sid
  @properties['sid']
end

#snaHash

Returns The set of fields used for a silent network auth (‘sna`) verification.

Returns:

  • (Hash)

    The set of fields used for a silent network auth (‘sna`) verification



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

def sna
  @properties['sna']
end

#statusString

Returns The status of the verification resource.

Returns:

  • (String)

    The status of the verification resource



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

def status
  @properties['status']
end

#toString

Returns The phone number or email being verified.

Returns:

  • (String)

    The phone number or email being verified



274
275
276
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 274

def to
  @properties['to']
end

#to_sObject

Provide a user friendly representation



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

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 (verification.Status) (defaults to: nil)

    The new status of the resource. Can be: ‘canceled` or `approved`.

Returns:



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

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



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

def url
  @properties['url']
end

#validBoolean

Returns Whether the verification was successful.

Returns:

  • (Boolean)

    Whether the verification was successful



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

def valid
  @properties['valid']
end