lib/twilio-ruby/rest/api/v2010/account/queue.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/api/v2010/account/queue.rb in twilio-ruby-5.4.3
- old
+ new
@@ -17,13 +17,11 @@
# @return [QueueList] QueueList
def initialize(version, account_sid: nil)
super(version)
# Path Solution
- @solution = {
- account_sid: account_sid
- }
+ @solution = {account_sid: account_sid}
@uri = "/Accounts/#{@solution[:account_sid]}/Queues.json"
end
##
# Lists QueueInstance records from the API as a list.
@@ -35,14 +33,11 @@
# not set will use the default value of 50 records. If no page_size is defined
# but a limit is defined, stream() will attempt to read the limit with the most
# efficient page size, i.e. min(limit, 1000)
# @return [Array] Array of up to limit results
def list(limit: nil, page_size: nil)
- self.stream(
- limit: limit,
- page_size: page_size
- ).entries
+ self.stream(limit: limit, page_size: page_size).entries
end
##
# Streams QueueInstance records from the API as an Enumerable.
# This operation lazily loads records as efficiently as possible until the limit
@@ -55,13 +50,11 @@
# efficient page size, i.e. min(limit, 1000)
# @return [Enumerable] Enumerable that will yield up to limit results
def stream(limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
- page = self.page(
- page_size: limits[:page_size],
- )
+ page = self.page(page_size: limits[:page_size],)
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end
##
@@ -69,13 +62,11 @@
# This operation lazily loads records as efficiently as possible until the limit
# is reached.
def each
limits = @version.read_limits
- page = self.page(
- page_size: limits[:page_size],
- )
+ page = self.page(page_size: limits[:page_size],)
@version.stream(page,
limit: limits[:limit],
page_limit: limits[:page_limit]).each {|x| yield x}
end
@@ -120,26 +111,19 @@
# @param [String] friendly_name A user-provided string that identifies this queue.
# @param [String] max_size The upper limit of calls allowed to be in the queue.
# The default is 100. The maximum is 1000.
# @return [QueueInstance] Newly created QueueInstance
def create(friendly_name: nil, max_size: :unset)
- data = Twilio::Values.of({
- 'FriendlyName' => friendly_name,
- 'MaxSize' => max_size,
- })
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, 'MaxSize' => max_size,})
payload = @version.create(
'POST',
@uri,
data: data
)
- QueueInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- )
+ QueueInstance.new(@version, payload, account_sid: @solution[:account_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -164,15 +148,11 @@
##
# Build an instance of QueueInstance
# @param [Hash] payload Payload response from the API
# @return [QueueInstance] QueueInstance
def get_instance(payload)
- QueueInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- )
+ QueueInstance.new(@version, payload, account_sid: @solution[:account_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -189,14 +169,11 @@
# @return [QueueContext] QueueContext
def initialize(version, account_sid, sid)
super(version)
# Path Solution
- @solution = {
- account_sid: account_sid,
- sid: sid,
- }
+ @solution = {account_sid: account_sid, sid: sid,}
@uri = "/Accounts/#{@solution[:account_sid]}/Queues/#{@solution[:sid]}.json"
# Dependents
@members = nil
end
@@ -211,42 +188,29 @@
'GET',
@uri,
params,
)
- QueueInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- sid: @solution[:sid],
- )
+ QueueInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid],)
end
##
# Update the QueueInstance
# @param [String] friendly_name A human readable description of the queue
# @param [String] max_size The maximum number of members that can be in the queue
# at a time
# @return [QueueInstance] Updated QueueInstance
def update(friendly_name: :unset, max_size: :unset)
- data = Twilio::Values.of({
- 'FriendlyName' => friendly_name,
- 'MaxSize' => max_size,
- })
+ 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],
- )
+ QueueInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid],)
end
##
# Deletes the QueueInstance
# @return [Boolean] true if delete succeeds, true otherwise
@@ -260,24 +224,15 @@
# @return [MemberContext] if call_sid was passed.
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,
- )
+ 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],
- )
+ @members = MemberList.new(@version, account_sid: @solution[:account_sid], queue_sid: @solution[:sid],)
end
@members
end
@@ -313,27 +268,20 @@
'uri' => payload['uri'],
}
# Context
@instance_context = nil
- @params = {
- 'account_sid' => account_sid,
- 'sid' => sid || @properties['sid'],
- }
+ @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'],}
end
##
# Generate an instance context for the instance, the context is capable of
# performing various actions. All instance actions are proxied to the context
# @return [QueueContext] QueueContext for this QueueInstance
def context
unless @instance_context
- @instance_context = QueueContext.new(
- @version,
- @params['account_sid'],
- @params['sid'],
- )
+ @instance_context = QueueContext.new(@version, @params['account_sid'], @params['sid'],)
end
@instance_context
end
##
@@ -402,13 +350,10 @@
# @param [String] friendly_name A human readable description of the queue
# @param [String] max_size The maximum number of members that can be in the queue
# at a time
# @return [QueueInstance] Updated QueueInstance
def update(friendly_name: :unset, max_size: :unset)
- context.update(
- friendly_name: friendly_name,
- max_size: max_size,
- )
+ context.update(friendly_name: friendly_name, max_size: max_size,)
end
##
# Deletes the QueueInstance
# @return [Boolean] true if delete succeeds, true otherwise
\ No newline at end of file