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



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 313

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

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

Instance Method Details

#account_sidString



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

def 
    @properties['account_sid']
end

#average_wait_timeString



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

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



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

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

#current_sizeString



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

def current_size
    @properties['current_size']
end

#date_createdTime



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

def date_created
    @properties['date_created']
end

#date_updatedTime



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the QueueInstance



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

def delete

    context.delete
end

#fetchQueueInstance

Fetch the QueueInstance



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

def fetch

    context.fetch
end

#friendly_nameString



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



447
448
449
450
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 447

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

#max_sizeString



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

def max_size
    @properties['max_size']
end

#membersmembers

Access the members



434
435
436
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 434

def members
    context.members
end

#sidString



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



440
441
442
443
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 440

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



420
421
422
423
424
425
426
427
428
429
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 420

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

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

#uriString



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

def uri
    @properties['uri']
end