class Twilio::REST::Voice::V1::ConnectionPolicyContext::ConnectionPolicyTargetContext
Public Class Methods
Initialize the ConnectionPolicyTargetContext
@param [Version] version Version
that contains the resource @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 [ConnectionPolicyTargetContext] ConnectionPolicyTargetContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb 192 def initialize(version, connection_policy_sid, sid) 193 super(version) 194 195 # Path Solution 196 @solution = {connection_policy_sid: connection_policy_sid, sid: sid, } 197 @uri = "/ConnectionPolicies/#{@solution[:connection_policy_sid]}/Targets/#{@solution[:sid]}" 198 end
Public Instance Methods
Delete the ConnectionPolicyTargetInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb 251 def delete 252 @version.delete('DELETE', @uri) 253 end
Fetch the ConnectionPolicyTargetInstance
@return [ConnectionPolicyTargetInstance] Fetched ConnectionPolicyTargetInstance
# File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb 203 def fetch 204 payload = @version.fetch('GET', @uri) 205 206 ConnectionPolicyTargetInstance.new( 207 @version, 208 payload, 209 connection_policy_sid: @solution[:connection_policy_sid], 210 sid: @solution[:sid], 211 ) 212 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb 264 def inspect 265 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 266 "#<Twilio.Voice.V1.ConnectionPolicyTargetContext #{context}>" 267 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb 257 def to_s 258 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 259 "#<Twilio.Voice.V1.ConnectionPolicyTargetContext #{context}>" 260 end
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 229 def update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset) 230 data = Twilio::Values.of({ 231 'FriendlyName' => friendly_name, 232 'Target' => target, 233 'Priority' => priority, 234 'Weight' => weight, 235 'Enabled' => enabled, 236 }) 237 238 payload = @version.update('POST', @uri, data: data) 239 240 ConnectionPolicyTargetInstance.new( 241 @version, 242 payload, 243 connection_policy_sid: @solution[:connection_policy_sid], 244 sid: @solution[:sid], 245 ) 246 end