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



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 311

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



347
348
349
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 347

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



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

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

#date_createdTime



395
396
397
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 395

def date_created
    @properties['date_created']
end

#date_updatedTime



401
402
403
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 401

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the OriginationUrlInstance



414
415
416
417
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 414

def delete

    context.delete
end

#enabledBoolean



371
372
373
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 371

def enabled
    @properties['enabled']
end

#fetchOriginationUrlInstance

Fetch the OriginationUrlInstance



422
423
424
425
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 422

def fetch

    context.fetch
end

#friendly_nameString



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



461
462
463
464
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 461

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

#priorityString



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

def priority
    @properties['priority']
end

#sidString



353
354
355
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 353

def sid
    @properties['sid']
end

#sip_urlString



377
378
379
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 377

def sip_url
    @properties['sip_url']
end

#to_sObject

Provide a user friendly representation



454
455
456
457
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 454

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

#trunk_sidString



359
360
361
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 359

def trunk_sid
    @properties['trunk_sid']
end

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

Update the OriginationUrlInstance



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 435

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



407
408
409
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 407

def url
    @properties['url']
end

#weightString



365
366
367
# File 'lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb', line 365

def weight
    @properties['weight']
end