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, MemberList, MemberPage

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 that created the Queue resource to fetch.

  • sid (String)

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


171
172
173
174
175
176
177
178
179
180
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 171

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


209
210
211
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 209

def delete
   @version.delete('DELETE', @uri)
end

#fetchQueueInstance

Fetch the QueueInstance

Returns:


185
186
187
188
189
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 185

def fetch
  payload = @version.fetch('GET', @uri)

  QueueInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


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

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)

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 217

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


237
238
239
240
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 237

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

Returns:


198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 198

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

  payload = @version.update('POST', @uri, data: data)

  QueueInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
end