Class: Twilio::REST::Api::V2010::AccountContext::QueueContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/queue.rb,
lib/twilio-ruby/rest/api/v2010/account/queue/member.rb

Defined Under Namespace

Classes: MemberContext, MemberInstance, MemberInstanceMetadata, MemberList, MemberListResponse, MemberPage, MemberPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ QueueContext

Initialize the QueueContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Queue resource to update.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Queue resource to update



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 226

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

    # Path Solution
    @solution = { account_sid: , sid: sid,  }
    @uri = "/Accounts/#{@solution[:account_sid]}/Queues/#{@solution[:sid]}.json"

    # Dependents
    @members = nil
end

Instance Method Details

#deleteBoolean

Delete the QueueInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 240

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the QueueInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 253

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      queue_instance = QueueInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, queue_instance, response.headers, response.status_code)
end

#fetchQueueInstance

Fetch the QueueInstance

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 272

def fetch

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

#fetch_with_metadataQueueInstance

Fetch the QueueInstanceMetadata

Returns:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 292

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    queue_instance = QueueInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        queue_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



410
411
412
413
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 410

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

#members(call_sid = :unset) ⇒ MemberList, MemberContext

Access the members

Returns:

Raises:

  • (ArgumentError)


385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 385

def members(call_sid=:unset)

    raise ArgumentError, 'call_sid cannot be nil' if call_sid.nil?

    if call_sid != :unset
        return MemberContext.new(@version, @solution[:account_sid], @solution[:sid],call_sid )
    end

    unless @members
        @members = MemberList.new(
            @version, account_sid: @solution[:account_sid], queue_sid: @solution[:sid], )
    end

 @members
end

#to_sObject

Provide a user friendly representation



403
404
405
406
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 403

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

#update(friendly_name: :unset, max_size: :unset) ⇒ QueueInstance

Update the QueueInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you created to describe this resource. It can be up to 64 characters long.

  • max_size (String) (defaults to: :unset)

    The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.

Returns:



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 320

def update(
    friendly_name: :unset, 
    max_size: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'MaxSize' => max_size,
    })

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

#update_with_metadata(friendly_name: :unset, max_size: :unset) ⇒ QueueInstance

Update the QueueInstanceMetadata

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you created to describe this resource. It can be up to 64 characters long.

  • max_size (String) (defaults to: :unset)

    The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.

Returns:



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 350

def (
  friendly_name: :unset, 
  max_size: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'MaxSize' => max_size,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    queue_instance = QueueInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        queue_instance,
        response.headers,
        response.status_code
    )
end