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

  • trunk_sid (String) (defaults to: nil)

    The unique ID of the Trunk that owns this Origination URL.

  • sid (String) (defaults to: nil)

    The sid



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 278

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'].to_i,
      'enabled' => payload['enabled'],
      'sip_url' => payload['sip_url'],
      'friendly_name' => payload['friendly_name'],
      '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, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The unique ID of the Account that owns this Origination URL.

Returns:

  • (String)

    The unique ID of the Account that owns this Origination URL.



314
315
316
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 314

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:



305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 305

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

#date_createdTime

Returns The date this Activity was created.

Returns:

  • (Time)

    The date this Activity was created.



362
363
364
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 362

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Activity was updated.

Returns:

  • (Time)

    The date this Activity was updated.



368
369
370
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 368

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the OriginationUrlInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



388
389
390
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 388

def delete
  context.delete
end

#enabledBoolean

Returns A boolean value indicating whether the URL is enabled or disabled.

Returns:

  • (Boolean)

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



338
339
340
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 338

def enabled
  @properties['enabled']
end

#fetchOriginationUrlInstance

Fetch a OriginationUrlInstance

Returns:



381
382
383
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 381

def fetch
  context.fetch
end

#friendly_nameString

Returns A human readable descriptive text, up to 64 characters long.

Returns:

  • (String)

    A human readable descriptive text, up to 64 characters long.



350
351
352
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 350

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 426

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

#priorityString

Returns Priority ranks the importance of the URI.

Returns:

  • (String)

    Priority ranks the importance of the URI.



356
357
358
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 356

def priority
  @properties['priority']
end

#sidString

Returns A 34 character string that uniquely identifies the Origination URL in this Twilio Trunk.

Returns:

  • (String)

    A 34 character string that uniquely identifies the Origination URL in this Twilio Trunk.



320
321
322
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 320

def sid
  @properties['sid']
end

#sip_urlString

Returns The SIP address you want Twilio to route your Origination calls to.

Returns:

  • (String)

    The SIP address you want Twilio to route your Origination calls to.



344
345
346
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 344

def sip_url
  @properties['sip_url']
end

#to_sObject

Provide a user friendly representation



419
420
421
422
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 419

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

#trunk_sidString

Returns The unique ID of the Trunk that owns this Origination URL.

Returns:

  • (String)

    The unique ID of the Trunk that owns this Origination URL.



326
327
328
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 326

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)

    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:



407
408
409
410
411
412
413
414
415
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 407

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 URL for this resource, relative to trunking.

Returns:

  • (String)

    The URL for this resource, relative to trunking.



374
375
376
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 374

def url
  @properties['url']
end

#weightString

Returns Weight is used to determine the share of load when more than one URI has the same priority.

Returns:

  • (String)

    Weight is used to determine the share of load when more than one URI has the same priority.



332
333
334
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 332

def weight
  @properties['weight']
end