Class: Twilio::REST::Trunking::V1::TrunkContext::OriginationUrlInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, trunk_sid: nil, sid: nil) ⇒ OriginationUrlInstance

Initialize the OriginationUrlInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 578

def initialize(version, payload , trunk_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'sid' => payload['sid'],
        'trunk_sid' => payload['trunk_sid'],
        'weight' => payload['weight'] == nil ? payload['weight'] : payload['weight'].to_i,
        'enabled' => payload['enabled'],
        'sip_url' => payload['sip_url'],
        'friendly_name' => payload['friendly_name'],
        'priority' => payload['priority'] == nil ? payload['priority'] : payload['priority'].to_i,
        '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 = { 'trunk_sid' => trunk_sid  || @properties['trunk_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource.

Returns:



615
616
617
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 615

def 
    @properties['account_sid']
end

#contextOriginationUrlContext

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

Returns:



606
607
608
609
610
611
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 606

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

#date_createdTime

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

Returns:



663
664
665
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 663

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:



669
670
671
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 669

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the OriginationUrlInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



682
683
684
685
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 682

def delete

    context.delete
end

#enabledBoolean

Returns Whether the URL is enabled. The default is true.

Returns:

  • (Boolean)

    Whether the URL is enabled. The default is true.



639
640
641
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 639

def enabled
    @properties['enabled']
end

#fetchOriginationUrlInstance

Fetch the OriginationUrlInstance

Returns:



690
691
692
693
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 690

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource.



651
652
653
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 651

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



729
730
731
732
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 729

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

#priorityString

Returns The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI.

Returns:

  • (String)

    The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI.



657
658
659
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 657

def priority
    @properties['priority']
end

#sidString

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

Returns:

  • (String)

    The unique string that we created to identify the OriginationUrl resource.



621
622
623
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 621

def sid
    @properties['sid']
end

#sip_urlString

Returns The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema.

Returns:

  • (String)

    The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema.



645
646
647
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 645

def sip_url
    @properties['sip_url']
end

#to_sObject

Provide a user friendly representation



722
723
724
725
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 722

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

#trunk_sidString

Returns The SID of the Trunk that owns the Origination URL.

Returns:

  • (String)

    The SID of the Trunk that owns the Origination URL.



627
628
629
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 627

def trunk_sid
    @properties['trunk_sid']
end

#update(weight: :unset, priority: :unset, enabled: :unset, friendly_name: :unset, sip_url: :unset) ⇒ OriginationUrlInstance

Update the OriginationUrlInstance

Parameters:

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

    The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority.

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

    The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI.

  • enabled (Boolean) (defaults to: :unset)

    Whether the URL is enabled. The default is true.

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

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

    The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema. sips is NOT supported.

Returns:



703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 703

def update(
    weight: :unset, 
    priority: :unset, 
    enabled: :unset, 
    friendly_name: :unset, 
    sip_url: :unset
)

    context.update(
        weight: weight, 
        priority: priority, 
        enabled: enabled, 
        friendly_name: friendly_name, 
        sip_url: sip_url, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



675
676
677
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 675

def url
    @properties['url']
end

#weightString

Returns The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority.

Returns:

  • (String)

    The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority.



633
634
635
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 633

def weight
    @properties['weight']
end