Class: Twilio::REST::Voice::V1::SourceIpMappingInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ SourceIpMappingInstance

Initialize the SourceIpMappingInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 527

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

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

Instance Method Details

#contextSourceIpMappingContext

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

Returns:



550
551
552
553
554
555
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 550

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

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



577
578
579
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 577

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



583
584
585
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 583

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the SourceIpMappingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



596
597
598
599
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 596

def delete

    context.delete
end

#fetchSourceIpMappingInstance

Fetch the SourceIpMappingInstance

Returns:



604
605
606
607
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 604

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



631
632
633
634
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 631

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

#ip_record_sidString

Returns The Twilio-provided string that uniquely identifies the IP Record resource to map from.

Returns:

  • (String)

    The Twilio-provided string that uniquely identifies the IP Record resource to map from.



565
566
567
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 565

def ip_record_sid
    @properties['ip_record_sid']
end

#sidString

Returns The unique string that we created to identify the IP Record resource.

Returns:

  • (String)

    The unique string that we created to identify the IP Record resource.



559
560
561
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 559

def sid
    @properties['sid']
end

#sip_domain_sidString

Returns The SID of the SIP Domain that the IP Record is mapped to.

Returns:

  • (String)

    The SID of the SIP Domain that the IP Record is mapped to.



571
572
573
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 571

def sip_domain_sid
    @properties['sip_domain_sid']
end

#to_sObject

Provide a user friendly representation



624
625
626
627
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 624

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

#update(sip_domain_sid: nil) ⇒ SourceIpMappingInstance

Update the SourceIpMappingInstance

Parameters:

  • sip_domain_sid (String) (defaults to: nil)

    The SID of the SIP Domain that the IP Record should be mapped to.

Returns:



613
614
615
616
617
618
619
620
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 613

def update(
    sip_domain_sid: nil
)

    context.update(
        sip_domain_sid: sip_domain_sid, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



589
590
591
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 589

def url
    @properties['url']
end