lib/twilio-ruby/rest/api/v2010/account/queue.rb in twilio-ruby-5.0.0.rc9 vs lib/twilio-ruby/rest/api/v2010/account/queue.rb in twilio-ruby-5.0.0.rc10

- old
+ new

@@ -12,11 +12,10 @@ class QueueList < ListResource ## # Initialize the QueueList # @param [Version] version Version that contains the resource # @param [String] account_sid The account_sid - # @return [QueueList] QueueList def initialize(version, account_sid: nil) super(version) # Path Solution @@ -34,11 +33,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when 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 @@ -53,11 +51,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when 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 [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( @@ -93,11 +90,10 @@ # Retrieve a single page of QueueInstance records from the API. # Request is executed immediately. # @param [String] page_token PageToken provided by the API # @param [Integer] page_number Page Number, this value is simply for client state # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of QueueInstance def page(page_token: nil, page_number: nil, page_size: nil) params = { 'PageToken' => page_token, 'Page' => page_number, @@ -115,11 +111,10 @@ # Retrieve a single page of QueueInstance records from the API. # Request is executed immediately. # @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: nil) data = { 'FriendlyName' => friendly_name, 'MaxSize' => max_size, @@ -132,11 +127,11 @@ ) return QueueInstance.new( @version, payload, - account_sid: @solution['account_sid'], + account_sid: @solution[:account_sid], ) end ## # Provide a user friendly representation @@ -150,11 +145,10 @@ # Initialize the QueuePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @param [String] account_sid The account_sid - # @return [QueuePage] QueuePage def initialize(version, response, solution) super(version, response) # Path Solution @@ -162,17 +156,16 @@ end ## # Build an instance of QueueInstance # @param [Hash] payload Payload response from the API - # @return [QueueInstance] QueueInstance def get_instance(payload) return QueueInstance.new( @version, payload, - account_sid: @solution['account_sid'], + account_sid: @solution[:account_sid], ) end ## # Provide a user friendly representation @@ -185,11 +178,10 @@ ## # Initialize the QueueContext # @param [Version] version Version that contains the resource # @param [String] account_sid The account_sid # @param [String] sid The queue Sid that uniquely identifies this resource - # @return [QueueContext] QueueContext def initialize(version, account_sid, sid) super(version) # Path Solution @@ -216,21 +208,20 @@ ) return QueueInstance.new( @version, payload, - account_sid: @solution['account_sid'], - sid: @solution['sid'], + 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: nil, max_size: nil) data = { 'FriendlyName' => friendly_name, 'MaxSize' => max_size, @@ -243,12 +234,12 @@ ) return QueueInstance.new( @version, payload, - account_sid: @solution['account_sid'], - sid: @solution['sid'], + account_sid: @solution[:account_sid], + sid: @solution[:sid], ) end ## # Deletes the QueueInstance @@ -294,11 +285,10 @@ # Initialize the QueueInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The account_sid # @param [String] sid The queue Sid that uniquely identifies this resource - # @return [QueueInstance] QueueInstance def initialize(version, payload, account_sid: nil, sid: nil) super(version) # Marshaled Properties @@ -324,11 +314,10 @@ ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @param [Version] version Version that contains the resource - # @return [QueueContext] QueueContext for this QueueInstance def context unless @instance_context @instance_context = QueueContext.new( @version, @@ -377,44 +366,44 @@ ## # Fetch a QueueInstance # @return [QueueInstance] Fetched QueueInstance def fetch - @context.fetch() + context.fetch 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: nil, max_size: nil) - @context.update( + context.update( + friendly_name: friendly_name, max_size: max_size, ) end ## # Deletes the QueueInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - @context.delete() + context.delete end ## # Access the members # @return [members] members def members - @context.members + context.members end ## # Provide a user friendly representation def to_s - context = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Api.V2010.QueueInstance #{context}>" + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Api.V2010.QueueInstance #{values}>" end end end end end \ No newline at end of file