Class: Twilio::REST::Routes::V2::TrunkInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/routes/v2/trunk.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sip_trunk_domain: nil) ⇒ TrunkInstance

Initialize the TrunkInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 271

def initialize(version, payload , sip_trunk_domain: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sip_trunk_domain' => payload['sip_trunk_domain'],
        'url' => payload['url'],
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'voice_region' => payload['voice_region'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

    # Context
    @instance_context = nil
    @params = { 'sip_trunk_domain' => sip_trunk_domain  || @properties['sip_trunk_domain']  , }
end

Instance Method Details

#account_sid ⇒ String

Returns The unique SID identifier of the Account.

Returns:

  • (String) —

    The unique SID identifier of the Account.



323
324
325
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 323

def 
    @properties['account_sid']
end

#context ⇒ TrunkContext

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

Returns:



296
297
298
299
300
301
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 296

def context
    unless @instance_context
        @instance_context = TrunkContext.new(@version , @params['sip_trunk_domain'])
    end
    @instance_context
end

#date_created ⇒ Time

Returns The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format.



341
342
343
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 341

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format.



347
348
349
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 347

def date_updated
    @properties['date_updated']
end

#fetch ⇒ TrunkInstance

Fetch the TrunkInstance

Returns:



354
355
356
357
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 354

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters.

Returns:

  • (String) —

    A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters.



329
330
331
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 329

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



384
385
386
387
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 384

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

#sid ⇒ String

Returns A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk.

Returns:

  • (String) —

    A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk.



317
318
319
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 317

def sid
    @properties['sid']
end

#sip_trunk_domain ⇒ String

Returns The absolute URL of the SIP Trunk.

Returns:

  • (String) —

    The absolute URL of the SIP Trunk



305
306
307
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 305

def sip_trunk_domain
    @properties['sip_trunk_domain']
end

#to_s ⇒ Object

Provide a user friendly representation



377
378
379
380
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 377

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

#update(voice_region: :unset, friendly_name: :unset) ⇒ TrunkInstance

Update the TrunkInstance

Parameters:

  • voice_region (String) (defaults to: :unset) —

    The Inbound Processing Region used for this SIP Trunk for voice

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

    A human readable description of this resource, up to 64 characters.

Returns:



364
365
366
367
368
369
370
371
372
373
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 364

def update(
  voice_region: :unset, 
  friendly_name: :unset
)

    context.update(
        voice_region: voice_region, 
        friendly_name: friendly_name, 
    )
end

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource.



311
312
313
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 311

def url
    @properties['url']
end

#voice_region ⇒ String

Returns The Inbound Processing Region used for this SIP Trunk for voice.

Returns:

  • (String) —

    The Inbound Processing Region used for this SIP Trunk for voice.



335
336
337
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 335

def voice_region
    @properties['voice_region']
end