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 that created this Queue resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 570

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_sid ⇒ String

Returns The SID of the Account that created this Queue resource.

Returns:

  • (String) —

    The SID of the Account that created this Queue resource.



629
630
631
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 629

def 
    @properties['account_sid']
end

#average_wait_time ⇒ String

Returns The average wait time in seconds of the members in this queue. This is calculated at the time of the request.

Returns:

  • (String) —

    The average wait time in seconds of the members in this queue. This is calculated at the time of the request.



635
636
637
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 635

def average_wait_time
    @properties['average_wait_time']
end

#context ⇒ QueueContext

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

Returns:



596
597
598
599
600
601
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 596

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

#current_size ⇒ String

Returns The number of calls currently in the queue.

Returns:

  • (String) —

    The number of calls currently in the queue.



611
612
613
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 611

def current_size
    @properties['current_size']
end

#date_created ⇒ Time

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

Returns:

  • (Time) —

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



647
648
649
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 647

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

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

Returns:

  • (Time) —

    The date and time in GMT that this resource was last updated, specified in RFC 2822 format.



605
606
607
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 605

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the QueueInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



660
661
662
663
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 660

def delete

    context.delete
end

#fetch ⇒ QueueInstance

Fetch the QueueInstance

Returns:



668
669
670
671
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 668

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns A string that you assigned to describe this resource.

Returns:

  • (String) —

    A string that you assigned to describe this resource.



617
618
619
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 617

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



705
706
707
708
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 705

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

#max_size ⇒ String

Returns The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000.

Returns:

  • (String) —

    The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000.



653
654
655
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 653

def max_size
    @properties['max_size']
end

#members ⇒ members

Access the members

Returns:



692
693
694
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 692

def members
    context.members
end

#sid ⇒ String

Returns The unique string that that we created to identify this Queue resource.

Returns:

  • (String) —

    The unique string that that we created to identify this Queue resource.



641
642
643
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 641

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



698
699
700
701
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 698

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

Returns:



678
679
680
681
682
683
684
685
686
687
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 678

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

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

#uri ⇒ String

Returns The URI of this resource, relative to https://api.twilio.com.

Returns:

  • (String) —

    The URI of this resource, relative to https://api.twilio.com.



623
624
625
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 623

def uri
    @properties['uri']
end