Class: Twilio::REST::Voice::V1::ConnectionPolicyContext::ConnectionPolicyTargetContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, connection_policy_sid, sid) ⇒ ConnectionPolicyTargetContext

Initialize the ConnectionPolicyTargetContext



177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 177

def initialize(version, connection_policy_sid, sid)
    super(version)

    # Path Solution
    @solution = { connection_policy_sid: connection_policy_sid, sid: sid,  }
    @uri = "/ConnectionPolicies/#{@solution[:connection_policy_sid]}/Targets/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the ConnectionPolicyTargetInstance



189
190
191
192
193
194
195
196
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 189

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchConnectionPolicyTargetInstance

Fetch the ConnectionPolicyTargetInstance



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 201

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ConnectionPolicyTargetInstance.new(
        @version,
        payload,
        connection_policy_sid: @solution[:connection_policy_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 267

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Voice.V1.ConnectionPolicyTargetContext #{context}>"
end

#to_sObject

Provide a user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 260

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Voice.V1.ConnectionPolicyTargetContext #{context}>"
end

#update(friendly_name: :unset, target: :unset, priority: :unset, weight: :unset, enabled: :unset) ⇒ ConnectionPolicyTargetInstance

Update the ConnectionPolicyTargetInstance



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb', line 226

def update(
    friendly_name: :unset, 
    target: :unset, 
    priority: :unset, 
    weight: :unset, 
    enabled: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'Target' => target,
        'Priority' => priority,
        'Weight' => weight,
        'Enabled' => enabled,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ConnectionPolicyTargetInstance.new(
        @version,
        payload,
        connection_policy_sid: @solution[:connection_policy_sid],
        sid: @solution[:sid],
    )
end