Class: Twilio::REST::Api::V2010::AccountContext::QueueInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ QueueInstance

Initialize the QueueInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The account_sid

  • sid (String) (defaults to: nil)

    The queue Sid that uniquely identifies this resource



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 300

def initialize(version, payload, account_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'average_wait_time' => payload['average_wait_time'].to_i,
      'current_size' => payload['current_size'].to_i,
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'friendly_name' => payload['friendly_name'],
      'max_size' => payload['max_size'].to_i,
      'sid' => payload['sid'],
      'uri' => payload['uri'],
  }

  # Context
  @instance_context = nil
  @params = {
      'account_sid' => ,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



341
342
343
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 341

def 
  @properties['account_sid']
end

#average_wait_timeString

Returns Average wait time of members in the queue.

Returns:

  • (String)

    Average wait time of members in the queue



347
348
349
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 347

def average_wait_time
  @properties['average_wait_time']
end

#contextQueueContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



328
329
330
331
332
333
334
335
336
337
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 328

def context
  unless @instance_context
    @instance_context = QueueContext.new(
        @version,
        @params['account_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#current_sizeString

Returns The count of calls currently in the queue.

Returns:

  • (String)

    The count of calls currently in the queue.



353
354
355
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 353

def current_size
  @properties['current_size']
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



359
360
361
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 359

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



365
366
367
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 365

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the QueueInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



416
417
418
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 416

def delete
  context.delete
end

#fetchQueueInstance

Fetch a QueueInstance

Returns:



396
397
398
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 396

def fetch
  context.fetch
end

#friendly_nameString

Returns A user-provided string that identifies this queue.

Returns:

  • (String)

    A user-provided string that identifies this queue.



371
372
373
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 371

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



436
437
438
439
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 436

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.QueueInstance #{values}>"
end

#max_sizeString

Returns The max number of calls allowed in the queue.

Returns:

  • (String)

    The max number of calls allowed in the queue



377
378
379
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 377

def max_size
  @properties['max_size']
end

#membersmembers

Access the members

Returns:



423
424
425
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 423

def members
  context.members
end

#sidString

Returns A string that uniquely identifies this queue.

Returns:

  • (String)

    A string that uniquely identifies this queue



383
384
385
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 383

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



429
430
431
432
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 429

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Api.V2010.QueueInstance #{values}>"
end

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

Update the QueueInstance

Parameters:

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

    A human readable description of the queue

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

    The maximum number of members that can be in the queue at a time

Returns:



406
407
408
409
410
411
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 406

def update(friendly_name: :unset, max_size: :unset)
  context.update(
      friendly_name: friendly_name,
      max_size: max_size,
  )
end

#uriString

Returns The uri.

Returns:

  • (String)

    The uri



389
390
391
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 389

def uri
  @properties['uri']
end