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.



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 259

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.



298
299
300
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 298

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



310
311
312
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 310

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:



283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 283

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



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Service was updated.

Returns:

  • (Time)

    The date this Service was updated



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

def date_updated
  @properties['date_updated']
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



341
342
343
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 341

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



378
379
380
381
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 378

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#nameString

Returns Friendly name of the service.

Returns:

  • (String)

    Friendly name of the service



304
305
306
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 304

def name
  @properties['name']
end

#sidString

Returns A string that uniquely identifies this Service.

Returns:

  • (String)

    A string that uniquely identifies this Service.



292
293
294
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 292

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



371
372
373
374
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 371

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:



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:



365
366
367
# File 'lib/twilio-ruby/rest/preview/acc_security/service.rb', line 365

def verification_checks
  context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:



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

def verifications
  context.verifications
end