Class: Twilio::REST::Preview::AccSecurity::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/acc_security/service.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].

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.



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 294

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'name' => payload['name'],
      'code_length' => payload['code_length'].to_i,
      '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.



338
339
340
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 338

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



350
351
352
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 350

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:



320
321
322
323
324
325
326
327
328
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 320

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



356
357
358
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 356

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Service was updated.

Returns:

  • (Time)

    The date this Service was updated



362
363
364
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 362

def date_updated
  @properties['date_updated']
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



381
382
383
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 381

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



421
422
423
424
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 421

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

Returns The links.

Returns:

  • (String)

    The links



374
375
376
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 374

def links
  @properties['links']
end

#nameString

Returns Friendly name of the service.

Returns:

  • (String)

    Friendly name of the service



344
345
346
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 344

def name
  @properties['name']
end

#sidString

Returns A string that uniquely identifies this Service.

Returns:

  • (String)

    A string that uniquely identifies this Service.



332
333
334
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 332

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



414
415
416
417
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 414

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

#update(name: :unset, code_length: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • 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

Returns:



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

def update(name: :unset, code_length: :unset)
  context.update(
      name: name,
      code_length: code_length,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



368
369
370
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 368

def url
  @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:



408
409
410
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 408

def verification_checks
  context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:



401
402
403
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 401

def verifications
  context.verifications
end