Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext::CredentialInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, credential_list_sid: nil, sid: nil) ⇒ CredentialInstance

Initialize the CredentialInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Credential resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 553

def initialize(version, payload , account_sid: nil, credential_list_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'credential_list_sid' => payload['credential_list_sid'],
        'username' => payload['username'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'uri' => payload['uri'],
    }

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

Instance Method Details

#account_sidString

Returns The unique id of the Account that is responsible for this resource.

Returns:

  • (String)

    The unique id of the Account that is responsible for this resource.



592
593
594
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 592

def 
    @properties['account_sid']
end

#contextCredentialContext

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

Returns:



577
578
579
580
581
582
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 577

def context
    unless @instance_context
        @instance_context = CredentialContext.new(@version , @params['account_sid'], @params['credential_list_sid'], @params['sid'])
    end
    @instance_context
end

#credential_list_sidString

Returns The unique id that identifies the credential list that includes this credential.

Returns:

  • (String)

    The unique id that identifies the credential list that includes this credential.



598
599
600
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 598

def credential_list_sid
    @properties['credential_list_sid']
end

#date_createdTime

Returns The date that this resource was created, given as GMT in [RFC 2822](www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.

Returns:



610
611
612
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 610

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated, given as GMT in [RFC 2822](www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.

Returns:



616
617
618
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 616

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the CredentialInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



629
630
631
632
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 629

def delete

    context.delete
end

#fetchCredentialInstance

Fetch the CredentialInstance

Returns:



637
638
639
640
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 637

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



664
665
666
667
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 664

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

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



586
587
588
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 586

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



657
658
659
660
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 657

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

#update(password: :unset) ⇒ CredentialInstance

Update the CredentialInstance

Parameters:

  • password (String) (defaults to: :unset)

    The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg ‘IWasAtSignal2018`)

Returns:



646
647
648
649
650
651
652
653
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 646

def update(
  password: :unset
)

    context.update(
        password: password, 
    )
end

#uriString

Returns The URI for this resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI for this resource, relative to ‘api.twilio.com`



622
623
624
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 622

def uri
    @properties['uri']
end

#usernameString

Returns The username for this credential.

Returns:

  • (String)

    The username for this credential.



604
605
606
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb', line 604

def username
    @properties['username']
end