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 that created the 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 RFC 2822 date and time in GMT when the resource was created.
-
#date_updated ⇒ Time
The RFC 2822 date and time in GMT when the resource was last updated.
-
#delete ⇒ Boolean
Deletes the ConnectionPolicyTargetInstance.
-
#enabled ⇒ Boolean
Whether the target is enabled.
-
#fetch ⇒ ConnectionPolicyTargetInstance
Fetch a 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 identifies the 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 load the Target should receive compared to others with the same priority.
Constructor Details
#initialize(version, payload, connection_policy_sid: nil, sid: nil) ⇒ ConnectionPolicyTargetInstance
Initialize the ConnectionPolicyTargetInstance
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 297 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'].to_i, '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, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
337 338 339 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 337 def account_sid @properties['account_sid'] end |
#connection_policy_sid ⇒ String
Returns The SID of the Connection Policy that owns the Target.
343 344 345 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 343 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
324 325 326 327 328 329 330 331 332 333 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 324 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 RFC 2822 date and time in GMT when the resource was created.
385 386 387 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 385 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The RFC 2822 date and time in GMT when the resource was last updated.
391 392 393 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 391 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the ConnectionPolicyTargetInstance
436 437 438 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 436 def delete context.delete end |
#enabled ⇒ Boolean
Returns Whether the target is enabled.
379 380 381 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 379 def enabled @properties['enabled'] end |
#fetch ⇒ ConnectionPolicyTargetInstance
Fetch a ConnectionPolicyTargetInstance
404 405 406 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 404 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the resource.
355 356 357 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 355 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
449 450 451 452 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 449 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.
367 368 369 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 367 def priority @properties['priority'] end |
#sid ⇒ String
Returns The unique string that identifies the resource.
349 350 351 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 349 def sid @properties['sid'] end |
#target ⇒ String
Returns The SIP address you want Twilio to route your calls to.
361 362 363 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 361 def target @properties['target'] end |
#to_s ⇒ Object
Provide a user friendly representation
442 443 444 445 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 442 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
423 424 425 426 427 428 429 430 431 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 423 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.
397 398 399 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 397 def url @properties['url'] end |
#weight ⇒ String
Returns The value that determines the relative load the Target should receive compared to others with the same priority.
373 374 375 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 373 def weight @properties['weight'] end |