Class: Twilio::REST::Verify::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/verify/v1/service.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, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The unique SID identifier of Verification Service Instance.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 282

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'code_length' => payload['code_length'].to_i,
      'lookup_enabled' => payload['lookup_enabled'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.



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

def 
  @properties['account_sid']
end

#code_lengthString

Returns Length of verification code. Valid values are 4-10.

Returns:

  • (String)

    Length of verification code. Valid values are 4-10



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

def code_length
  @properties['code_length']
end

#contextServiceContext

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

Returns:



307
308
309
310
311
312
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 307

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

#date_createdTime

Returns The date this Service was created.

Returns:

  • (Time)

    The date this Service was created



346
347
348
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 346

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Service was updated.

Returns:

  • (Time)

    The date this Service was updated



352
353
354
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 352

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



378
379
380
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 378

def delete
  context.delete
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns Friendly name of the service.

Returns:

  • (String)

    Friendly name of the service



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



422
423
424
425
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 422

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

Returns The links.

Returns:

  • (String)

    The links



364
365
366
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 364

def links
  @properties['links']
end

#lookup_enabledBoolean

Returns Indicates whether or not to perform a lookup with each verification started.

Returns:

  • (Boolean)

    Indicates whether or not to perform a lookup with each verification started



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

def lookup_enabled
  @properties['lookup_enabled']
end

#sidString

Returns A string that uniquely identifies this Service.

Returns:

  • (String)

    A string that uniquely identifies this Service.



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



415
416
417
418
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 415

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

#update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A 1-64 character string with friendly name of service

  • code_length (String) (defaults to: :unset)

    The length of the verification code to be generated. Must be an integer value between 4-10

  • lookup_enabled (Boolean) (defaults to: :unset)

    Boolean value that indicates if a lookup should be performed with each verification started and associated info returned

Returns:



391
392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 391

def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset)
  context.update(
      friendly_name: friendly_name,
      code_length: code_length,
      lookup_enabled: lookup_enabled,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



358
359
360
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 358

def url
  @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:



409
410
411
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 409

def verification_checks
  context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:



402
403
404
# File 'lib/twilio-ruby/rest/verify/v1/service.rb', line 402

def verifications
  context.verifications
end