class Aws::PageableResponse


decorates all responses with a {PageableResponse}.
directly. The {Plugins::ResponsePaging} plugin automatically
@note Normally you should not need to construct a {PageableResponse}
page = page.next_page until page.last_page?
page = PageableResponse.new(response, pager)
Or using {#next_page} and {#last_page?}:
end
# yields once per page
page.each do |page|
page = PageableResponse.new(response, pager)
You can enumerate all response pages with a block
#=> raises PageableResponse::LastPageError
page.next_page
#=> true
page.last_page?
page = page.next_page
# sends a request to receive the next response page
#=> false
page.last_page?
page = PageableResponse.new(response, pager)
Decorates a {Seahorse::Client::Response} with paging methods:

def count

Other tags:
    Api: - private
def count
  if respond_to?(:count)
    data.count
  else
    raise NotImplementedError
  end
end

def each(&block)

Returns:
  • (Enumerable, nil) - Returns a new Enumerable if no block is given.

Other tags:
    Yieldparam: response -
def each(&block)
  return enum_for(:each_page) unless block_given?
  response = self
  yield(response)
  until response.last_page?
    response = response.next_page
    yield(response)
  end
end

def initialize(response, pager)

Parameters:
  • pager (Paging::Pager) --
  • response (Seahorse::Client::Response) --
def initialize(response, pager)
  @pager = pager
  super(context:response.context, data:response.data, error:response.error)
end

def last_page?

Returns:
  • (Boolean) -
def last_page?
  @last_page = !@pager.truncated?(self)
  @last_page
end

def next_page(params = {})

Returns:
  • (Seahorse::Client::Response) -
def next_page(params = {})
  if last_page?
    raise LastPageError.new(self)
  else
    PageableResponse.new(next_response(params), pager)
  end
end

def next_page?

Returns:
  • (Boolean) -
def next_page?
  !last_page?
end

def next_page_params(params)

Returns:
  • (Hash) - Returns the hash of request parameters for the

Parameters:
  • params (Hash) -- A hash of additional request params to
def next_page_params(params)
  context[:original_params].merge(@pager.next_tokens(self).merge(params))
end

def next_response(params)

Returns:
  • (Seahorse::Client::Response) - Returns the next page of

Parameters:
  • params (Hash) -- A hash of additional request params to
def next_response(params)
  params = next_page_params(params)
  request = context.client.build_request(context.operation_name, params)
  request.send_request
end

def respond_to?(method_name, *args)

Other tags:
    Api: - private
def respond_to?(method_name, *args)
  if method_name == :count
    data.respond_to?(:count)
  else
    super
  end
end