Class: Twilio::REST::Numbers::V2::CallerIdInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, caller_id_sid: nil) ⇒ CallerIdInstance

Initialize the CallerIdInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 415

def initialize(version, payload , caller_id_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'phone_number' => payload['phone_number'],
        'friendly_name' => payload['friendly_name'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

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

Instance Method Details

#account_sidString

Returns The Account SID that owns this Caller ID.

Returns:

  • (String)

    The Account SID that owns this Caller ID.



453
454
455
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 453

def 
    @properties['account_sid']
end

#contextCallerIdContext

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

Returns:



438
439
440
441
442
443
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 438

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

#date_createdTime

Returns The date this resource was created.

Returns:

  • (Time)

    The date this resource was created.



471
472
473
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 471

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date this resource was last updated.

Returns:

  • (Time)

    The date this resource was last updated.



477
478
479
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 477

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the CallerIdInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



484
485
486
487
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 484

def delete

    context.delete
end

#friendly_nameString

Returns A human-readable name for this caller ID.

Returns:

  • (String)

    A human-readable name for this caller ID.



465
466
467
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 465

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



506
507
508
509
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 506

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

#phone_numberString

Returns The phone number in E.164 format.

Returns:

  • (String)

    The phone number in E.164 format.



459
460
461
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 459

def phone_number
    @properties['phone_number']
end

#sidString

Returns The unique SID of this Caller ID resource.

Returns:

  • (String)

    The unique SID of this Caller ID resource.



447
448
449
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 447

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



499
500
501
502
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 499

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

#updateCallerIdInstance

Update the CallerIdInstance

Returns:



492
493
494
495
# File 'lib/twilio-ruby/rest/numbers/v2/caller_id.rb', line 492

def update

    context.update
end