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 SID of the [Account](www.twilio.com/docs/api/rest/account) that created this Queue resource.

  • sid (String) (defaults to: nil)

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



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 278

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 SID of the Account that created this resource.

Returns:

  • (String)

    The SID of the Account that created this resource



312
313
314
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 312

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



318
319
320
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 318

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:



303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 303

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

#current_sizeString

Returns The number of calls currently in the queue.

Returns:

  • (String)

    The number of calls currently in the queue.



324
325
326
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 324

def current_size
  @properties['current_size']
end

#date_createdTime

Returns The RFC 2822 date and time in GMT that this resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that this resource was created



330
331
332
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 330

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that this resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that this resource was last updated



336
337
338
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 336

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the QueueInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#fetchQueueInstance

Fetch a QueueInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns A string that you assigned to describe this resource.

Returns:

  • (String)

    A string that you assigned to describe this resource



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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



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

def max_size
  @properties['max_size']
end

#membersmembers

Access the members

Returns:



392
393
394
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 392

def members
  context.members
end

#sidString

Returns The unique string that identifies this resource.

Returns:

  • (String)

    The unique string that identifies this resource



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



398
399
400
401
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 398

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 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 100. The maximum is 5000.

Returns:



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

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

#uriString

Returns The URI of this resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of this resource, relative to ‘api.twilio.com`



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

def uri
  @properties['uri']
end