class Twilio::REST::Trunking::V1::TrunkContext::OriginationUrlContext

Public Class Methods

new(version, trunk_sid, sid) click to toggle source

Initialize the OriginationUrlContext @param [Version] version Version that contains the resource @param [String] trunk_sid The SID of the Trunk from which to fetch the

OriginationUrl.

@param [String] sid The unique string that we created to identify the

OriginationUrl resource to fetch.

@return [OriginationUrlContext] OriginationUrlContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
182 def initialize(version, trunk_sid, sid)
183   super(version)
184 
185   # Path Solution
186   @solution = {trunk_sid: trunk_sid, sid: sid, }
187   @uri = "/Trunks/#{@solution[:trunk_sid]}/OriginationUrls/#{@solution[:sid]}"
188 end

Public Instance Methods

delete() click to toggle source

Delete the OriginationUrlInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
207 def delete
208    @version.delete('DELETE', @uri)
209 end
fetch() click to toggle source

Fetch the OriginationUrlInstance @return [OriginationUrlInstance] Fetched OriginationUrlInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
193 def fetch
194   payload = @version.fetch('GET', @uri)
195 
196   OriginationUrlInstance.new(
197       @version,
198       payload,
199       trunk_sid: @solution[:trunk_sid],
200       sid: @solution[:sid],
201   )
202 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
254 def inspect
255   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
256   "#<Twilio.Trunking.V1.OriginationUrlContext #{context}>"
257 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
247 def to_s
248   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
249   "#<Twilio.Trunking.V1.OriginationUrlContext #{context}>"
250 end
update(weight: :unset, priority: :unset, enabled: :unset, friendly_name: :unset, sip_url: :unset) click to toggle source

Update the OriginationUrlInstance @param [String] weight 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.

@param [String] priority 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.

@param [Boolean] enabled Whether the URL is enabled. The default is `true`. @param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to 64 characters long.

@param [String] sip_url The SIP address you want Twilio to route your

Origination calls to. This must be a `sip:` schema. `sips` is NOT supported.

@return [OriginationUrlInstance] Updated OriginationUrlInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb
226 def update(weight: :unset, priority: :unset, enabled: :unset, friendly_name: :unset, sip_url: :unset)
227   data = Twilio::Values.of({
228       'Weight' => weight,
229       'Priority' => priority,
230       'Enabled' => enabled,
231       'FriendlyName' => friendly_name,
232       'SipUrl' => sip_url,
233   })
234 
235   payload = @version.update('POST', @uri, data: data)
236 
237   OriginationUrlInstance.new(
238       @version,
239       payload,
240       trunk_sid: @solution[:trunk_sid],
241       sid: @solution[:sid],
242   )
243 end