Class: Twilio::REST::Api::V2010::AccountContext::SipList::IpAccessControlListContext::IpAddressInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, ip_access_control_list_sid: nil, sid: nil) ⇒ IpAddressInstance

Initialize the IpAddressInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 563

def initialize(version, payload , account_sid: nil, ip_access_control_list_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'ip_address' => payload['ip_address'],
        'cidr_prefix_length' => payload['cidr_prefix_length'] == nil ? payload['cidr_prefix_length'] : payload['cidr_prefix_length'].to_i,
        'ip_access_control_list_sid' => payload['ip_access_control_list_sid'],
        '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' =>   ,'ip_access_control_list_sid' => ip_access_control_list_sid  || @properties['ip_access_control_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.



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

def 
    @properties['account_sid']
end

#cidr_prefix_lengthString

Returns An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used.

Returns:

  • (String)

    An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used.



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

def cidr_prefix_length
    @properties['cidr_prefix_length']
end

#contextIpAddressContext

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

Returns:



589
590
591
592
593
594
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 589

def context
    unless @instance_context
        @instance_context = IpAddressContext.new(@version , @params['account_sid'], @params['ip_access_control_list_sid'], @params['sid'])
    end
    @instance_context
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:



634
635
636
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 634

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:



640
641
642
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 640

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the IpAddressInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



653
654
655
656
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 653

def delete

    context.delete
end

#fetchIpAddressInstance

Fetch the IpAddressInstance

Returns:



661
662
663
664
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 661

def fetch

    context.fetch
end

#friendly_nameString

Returns A human readable descriptive text for this resource, up to 255 characters long.

Returns:

  • (String)

    A human readable descriptive text for this resource, up to 255 characters long.



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



694
695
696
697
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 694

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

#ip_access_control_list_sidString

Returns The unique id of the IpAccessControlList resource that includes this resource.

Returns:

  • (String)

    The unique id of the IpAccessControlList resource that includes this resource.



628
629
630
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 628

def ip_access_control_list_sid
    @properties['ip_access_control_list_sid']
end

#ip_addressString

Returns An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today.

Returns:

  • (String)

    An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today.



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

def ip_address
    @properties['ip_address']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



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

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



687
688
689
690
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 687

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

#update(ip_address: :unset, friendly_name: :unset, cidr_prefix_length: :unset) ⇒ IpAddressInstance

Update the IpAddressInstance

Parameters:

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

    An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today.

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

    A human readable descriptive text for this resource, up to 255 characters long.

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

    An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used.

Returns:



672
673
674
675
676
677
678
679
680
681
682
683
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 672

def update(
    ip_address: :unset, 
    friendly_name: :unset, 
    cidr_prefix_length: :unset
)

    context.update(
        ip_address: ip_address, 
        friendly_name: friendly_name, 
        cidr_prefix_length: cidr_prefix_length, 
    )
end

#uriString

Returns The URI for this resource, relative to https://api.twilio.com.

Returns:

  • (String)

    The URI for this resource, relative to https://api.twilio.com



646
647
648
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb', line 646

def uri
    @properties['uri']
end