class Gapic::PagedEnumerable::Page

@return [::GRPC::ActiveCall::Operation] the RPC operation for the page.
@attribute [r] operation
@return [Object] the response object for the page.
@attribute [r] response
resource elements.
A class to represent a page in a PagedEnumerable. This also implements Enumerable, so it can iterate over the
#

def each

Other tags:
    Yield: - Gives the resource objects in the page.
def each
  return enum_for :each unless block_given?
  return if @response.nil?
  # We trust that the field exists and is an Enumerable
  @response[@resource_field].each do |resource|
    resource = @format_resource.call resource if @format_resource
    yield resource
  end
end

def initialize response, resource_field, operation, format_resource: nil

Parameters:
  • format_resource (Proc) -- A Proc object to format the resource object. The Proc should accept response as an
  • operation (::GRPC::ActiveCall::Operation) -- the RPC operation for the page.
  • resource_field (String) -- The name of the field in response which holds the resources.
  • response (Object) -- The response object for the page.

Other tags:
    Private: -
def initialize response, resource_field, operation, format_resource: nil
  @response = response
  @resource_field = resource_field
  @operation = operation
  @format_resource = format_resource
end

def next_page_token

Returns:
  • (String) -
def next_page_token
  return if @response.nil?
  @response.next_page_token
end

def next_page_token?

Returns:
  • (Boolean) -
def next_page_token?
  return if @response.nil? # rubocop:disable Style/ReturnNilInPredicateMethodDefinition
  !@response.next_page_token.empty?
end