Class: Twilio::REST::Trunking::V1::TrunkContext::OriginationUrlContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, trunk_sid, sid) ⇒ OriginationUrlContext

Initialize the OriginationUrlContext

Parameters:

  • version (Version)

    Version that contains the resource

  • trunk_sid (String)

    The trunk_sid

  • sid (String)

    The sid



188
189
190
191
192
193
194
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 188

def initialize(version, trunk_sid, sid)
  super(version)

  # Path Solution
  @solution = {trunk_sid: trunk_sid, sid: sid, }
  @uri = "/Trunks/#{@solution[:trunk_sid]}/OriginationUrls/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Deletes the OriginationUrlInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



219
220
221
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 219

def delete
  @version.delete('delete', @uri)
end

#fetchOriginationUrlInstance

Fetch a OriginationUrlInstance

Returns:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 199

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  OriginationUrlInstance.new(
      @version,
      payload,
      trunk_sid: @solution[:trunk_sid],
      sid: @solution[:sid],
  )
end

#to_sObject

Provide a user friendly representation



263
264
265
266
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 263

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Trunking.V1.OriginationUrlContext #{context}>"
end

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

Update the OriginationUrlInstance

Parameters:

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

    Weight is used to determine the share of load when more than one URI has the same priority. Its values range from 1 to 65535. The higher the value, the more load a URI is given. Defaults to 10.

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

    Priority ranks the importance of the URI. Values range from 0 to 65535, where the lowest number represents the highest importance. Defaults to 10.

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

    A boolean value indicating whether the URL is enabled or disabled. Defaults to true.

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

    A human readable descriptive text, 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:



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 238

def update(weight: :unset, priority: :unset, enabled: :unset, friendly_name: :unset, sip_url: :unset)
  data = Twilio::Values.of({
      'Weight' => weight,
      'Priority' => priority,
      'Enabled' => enabled,
      'FriendlyName' => friendly_name,
      'SipUrl' => sip_url,
  })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  OriginationUrlInstance.new(
      @version,
      payload,
      trunk_sid: @solution[:trunk_sid],
      sid: @solution[:sid],
  )
end