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.



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 371

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_sidString

Returns Account sid.

Returns:

  • (String)

    Account sid



438
439
440
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 438

def 
    @properties['account_sid']
end

#codeString

Returns Twilio error code.

Returns:

  • (String)

    Twilio error code



414
415
416
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 414

def code
    @properties['code']
end

#configurationHash

Returns:

  • (Hash)


468
469
470
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 468

def configuration
    @properties['configuration']
end

#contextTypeContext

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

Returns:



399
400
401
402
403
404
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 399

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

#date_createdTime

Returns:

  • (Time)


456
457
458
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 456

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


462
463
464
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 462

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the TypeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



475
476
477
478
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 475

def delete

    context.delete
end

#descriptionString

Returns The description.

Returns:

  • (String)

    The description



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

def description
    @properties['description']
end

#fetchTypeInstance

Fetch the TypeInstance

Returns:



483
484
485
486
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 483

def fetch

    context.fetch
end

#idString

Returns Configuration Identifier.

Returns:

  • (String)

    Configuration Identifier



432
433
434
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 432

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



509
510
511
512
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 509

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

#messageString

Returns Error message.

Returns:

  • (String)

    Error message



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

def message
    @properties['message']
end

#more_infoString

Returns More information about the error.

Returns:

  • (String)

    More information about the error



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

def more_info
    @properties['more_info']
end

#statusString

Returns status code.

Returns:

  • (String)

    status code



420
421
422
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 420

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



502
503
504
505
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 502

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

#unique_nameString

Returns The unique name.

Returns:

  • (String)

    The unique name



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

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:



492
493
494
495
496
497
498
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 492

def update(voice_v2_configuration_request: :unset
)

    context.update(
        voice_v2_configuration_request: voice_v2_configuration_request, 
    )
end