Class: Twilio::REST::Voice::V2::TypeInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/voice/v2/type.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, type: nil, id_or_unique_name: nil) ⇒ TypeInstance

Initialize the TypeInstance

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 Type resource.

  • sid (String) —

    The SID of the Call resource to fetch.



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 312

def initialize(version, payload , type: nil, id_or_unique_name: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'code' => payload['code'],
        'status' => payload['status'],
        'more_info' => payload['more_info'],
        'id' => payload['id'],
        'account_sid' => payload['account_sid'],
        'unique_name' => payload['unique_name'],
        'description' => payload['description'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'configuration' => payload['configuration'],
    }

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

Instance Method Details

#account_sid ⇒ String

Returns Account sid.

Returns:

  • (String) —

    Account sid



379
380
381
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 379

def 
    @properties['account_sid']
end

#code ⇒ String

Returns Twilio error code.

Returns:

  • (String) —

    Twilio error code



355
356
357
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 355

def code
    @properties['code']
end

#configuration ⇒ Hash

Returns:

  • (Hash)


409
410
411
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 409

def configuration
    @properties['configuration']
end

#context ⇒ TypeContext

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

Returns:



340
341
342
343
344
345
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 340

def context
    unless @instance_context
        @instance_context = TypeContext.new(@version , @params['type'], @params['id_or_unique_name'])
    end
    @instance_context
end

#date_created ⇒ Time

Returns:

  • (Time)


397
398
399
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 397

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns:

  • (Time)


403
404
405
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 403

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the TypeInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



416
417
418
419
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 416

def delete

    context.delete
end

#description ⇒ String

Returns The description.

Returns:

  • (String) —

    The description



391
392
393
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 391

def description
    @properties['description']
end

#fetch ⇒ TypeInstance

Fetch the TypeInstance

Returns:



424
425
426
427
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 424

def fetch

    context.fetch
end

#id ⇒ String

Returns Configuration Identifier.

Returns:

  • (String) —

    Configuration Identifier



373
374
375
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 373

def id
    @properties['id']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



450
451
452
453
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 450

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

#message ⇒ String

Returns Error message.

Returns:

  • (String) —

    Error message



349
350
351
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 349

def message
    @properties['message']
end

#more_info ⇒ String

Returns More information about the error.

Returns:

  • (String) —

    More information about the error



367
368
369
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 367

def more_info
    @properties['more_info']
end

#status ⇒ String

Returns status code.

Returns:

  • (String) —

    status code



361
362
363
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 361

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



443
444
445
446
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 443

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

#unique_name ⇒ String

Returns The unique name.

Returns:

  • (String) —

    The unique name



385
386
387
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 385

def unique_name
    @properties['unique_name']
end

#update(voice_v2_configuration_request: :unset) ⇒ TypeInstance

Update the TypeInstance

Parameters:

  • voice_v2_configuration_request (VoiceV2ConfigurationRequest) (defaults to: :unset)

Returns:



433
434
435
436
437
438
439
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 433

def update(voice_v2_configuration_request: :unset
)

    context.update(
        voice_v2_configuration_request: voice_v2_configuration_request, 
    )
end