Class: Twilio::REST::Voice::V1::ConnectionPolicyContext::ConnectionPolicyTargetInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Voice::V1::ConnectionPolicyContext::ConnectionPolicyTargetInstance
- Defined in:
- lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Target resource.
-
#connection_policy_sid ⇒ String
The SID of the Connection Policy that owns the Target.
-
#context ⇒ ConnectionPolicyTargetContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#delete ⇒ Boolean
Delete the ConnectionPolicyTargetInstance.
-
#enabled ⇒ Boolean
Whether the target is enabled.
-
#fetch ⇒ ConnectionPolicyTargetInstance
Fetch the ConnectionPolicyTargetInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the resource.
-
#initialize(version, payload, connection_policy_sid: nil, sid: nil) ⇒ ConnectionPolicyTargetInstance
constructor
Initialize the ConnectionPolicyTargetInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#priority ⇒ String
The relative importance of the target.
-
#sid ⇒ String
The unique string that we created to identify the Target resource.
-
#target ⇒ String
The SIP address you want Twilio to route your calls to.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset) ⇒ ConnectionPolicyTargetInstance
Update the ConnectionPolicyTargetInstance.
-
#url ⇒ String
The absolute URL of the resource.
-
#weight ⇒ String
The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority.
Constructor Details
#initialize(version, payload, connection_policy_sid: nil, sid: nil) ⇒ ConnectionPolicyTargetInstance
Initialize the ConnectionPolicyTargetInstance
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/voice/v1/connection_policy/connection_policy_target.rb', line 311 def initialize(version, payload , connection_policy_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'connection_policy_sid' => payload['connection_policy_sid'], 'sid' => payload['sid'], 'friendly_name' => payload['friendly_name'], 'target' => payload['target'], 'priority' => payload['priority'] == nil ? payload['priority'] : payload['priority'].to_i, 'weight' => payload['weight'] == nil ? payload['weight'] : payload['weight'].to_i, 'enabled' => payload['enabled'], '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 = { 'connection_policy_sid' => connection_policy_sid || @properties['connection_policy_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Target resource.
347 348 349 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 347 def account_sid @properties['account_sid'] end |
#connection_policy_sid ⇒ String
Returns The SID of the Connection Policy that owns the Target.
353 354 355 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 353 def connection_policy_sid @properties['connection_policy_sid'] end |
#context ⇒ ConnectionPolicyTargetContext
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/voice/v1/connection_policy/connection_policy_target.rb', line 338 def context unless @instance_context @instance_context = ConnectionPolicyTargetContext.new(@version , @params['connection_policy_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
395 396 397 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 395 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
401 402 403 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 401 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the ConnectionPolicyTargetInstance
414 415 416 417 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 414 def delete context.delete end |
#enabled ⇒ Boolean
Returns Whether the target is enabled. The default is ‘true`.
389 390 391 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 389 def enabled @properties['enabled'] end |
#fetch ⇒ ConnectionPolicyTargetInstance
Fetch the ConnectionPolicyTargetInstance
422 423 424 425 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 422 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the resource.
365 366 367 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 365 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
461 462 463 464 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 461 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Voice.V1.ConnectionPolicyTargetInstance #{values}>" end |
#priority ⇒ String
Returns The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target.
377 378 379 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 377 def priority @properties['priority'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Target resource.
359 360 361 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 359 def sid @properties['sid'] end |
#target ⇒ String
Returns The SIP address you want Twilio to route your calls to. This must be a ‘sip:` schema. `sips` is NOT supported.
371 372 373 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 371 def target @properties['target'] end |
#to_s ⇒ Object
Provide a user friendly representation
454 455 456 457 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 454 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Voice.V1.ConnectionPolicyTargetInstance #{values}>" end |
#update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset) ⇒ ConnectionPolicyTargetInstance
Update the ConnectionPolicyTargetInstance
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 435 def update( friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset ) context.update( friendly_name: friendly_name, target: target, priority: priority, weight: weight, enabled: enabled, ) end |
#url ⇒ String
Returns The absolute URL of the resource.
407 408 409 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 407 def url @properties['url'] end |
#weight ⇒ String
Returns 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, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority.
383 384 385 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 383 def weight @properties['weight'] end |