class Twilio::REST::Voice::V1::ConnectionPolicyContext::ConnectionPolicyTargetInstance

Public Class Methods

new(version, payload, connection_policy_sid: nil, sid: nil) click to toggle source

Initialize the ConnectionPolicyTargetInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] connection_policy_sid The SID of the Connection Policy that owns

the Target.

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

resource to fetch.

@return [ConnectionPolicyTargetInstance] ConnectionPolicyTargetInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
280 def initialize(version, payload, connection_policy_sid: nil, sid: nil)
281   super(version)
282 
283   # Marshaled Properties
284   @properties = {
285       'account_sid' => payload['account_sid'],
286       'connection_policy_sid' => payload['connection_policy_sid'],
287       'sid' => payload['sid'],
288       'friendly_name' => payload['friendly_name'],
289       'target' => payload['target'],
290       'priority' => payload['priority'].to_i,
291       'weight' => payload['weight'].to_i,
292       'enabled' => payload['enabled'],
293       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
294       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
295       'url' => payload['url'],
296   }
297 
298   # Context
299   @instance_context = nil
300   @params = {'connection_policy_sid' => connection_policy_sid, 'sid' => sid || @properties['sid'], }
301 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
320 def account_sid
321   @properties['account_sid']
322 end
connection_policy_sid() click to toggle source

@return [String] The SID of the Connection Policy that owns the Target

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
326 def connection_policy_sid
327   @properties['connection_policy_sid']
328 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ConnectionPolicyTargetContext] ConnectionPolicyTargetContext for this ConnectionPolicyTargetInstance

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
307 def context
308   unless @instance_context
309     @instance_context = ConnectionPolicyTargetContext.new(
310         @version,
311         @params['connection_policy_sid'],
312         @params['sid'],
313     )
314   end
315   @instance_context
316 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
368 def date_created
369   @properties['date_created']
370 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
374 def date_updated
375   @properties['date_updated']
376 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
419 def delete
420   context.delete
421 end
enabled() click to toggle source

@return [Boolean] Whether the target is enabled

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
362 def enabled
363   @properties['enabled']
364 end
fetch() click to toggle source

Fetch the ConnectionPolicyTargetInstance @return [ConnectionPolicyTargetInstance] Fetched ConnectionPolicyTargetInstance

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
387 def fetch
388   context.fetch
389 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
338 def friendly_name
339   @properties['friendly_name']
340 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
432 def inspect
433   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
434   "<Twilio.Voice.V1.ConnectionPolicyTargetInstance #{values}>"
435 end
priority() click to toggle source

@return [String] The relative importance of the target

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
350 def priority
351   @properties['priority']
352 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
332 def sid
333   @properties['sid']
334 end
target() click to toggle source

@return [String] The SIP address you want Twilio to route your calls to

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
344 def target
345   @properties['target']
346 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
425 def to_s
426   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
427   "<Twilio.Voice.V1.ConnectionPolicyTargetInstance #{values}>"
428 end
update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset) click to toggle source

Update the ConnectionPolicyTargetInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It is not unique and can be up to 255 characters long.

@param [String] target The SIP address you want Twilio to route your calls to.

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

@param [String] priority The relative importance of the target. Can be an

integer from 0 to 65535, inclusive. The lowest number represents the most
important target.

@param [String] weight The value that determines the relative share of the load

the Target should receive compared to other Targets with the same priority. Can
be an integer from 1 to 65535, inclusive. Targets with higher values receive
more load than those with lower ones with the same priority.

@param [Boolean] enabled Whether the Target is enabled. @return [ConnectionPolicyTargetInstance] Updated ConnectionPolicyTargetInstance

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
406 def update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset)
407   context.update(
408       friendly_name: friendly_name,
409       target: target,
410       priority: priority,
411       weight: weight,
412       enabled: enabled,
413   )
414 end
url() click to toggle source

@return [String] The absolute URL of the resource

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
380 def url
381   @properties['url']
382 end
weight() click to toggle source

@return [String] The value that determines the relative load the Target should receive compared to others with the same priority

    # File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
356 def weight
357   @properties['weight']
358 end