class Google::Cloud::Trace::ResultSet
ResultSet
represents the results of a `list_traces` request. It is an enumerable of the traces found, plus information about the request and a token to get the next page of results.
Attributes
The `end_time` query parameter.
@return [Time, nil]
The `filter` query parameter.
@return [String, nil]
The token to pass to `list_traces` to get the next page, or nil if this is the last page.
@return [String, nil]
The `order_by` query parameter.
@return [String, nil]
The `page_size` query parameter.
@return [Integer, nil]
The page token used to obtain this page of results.
@return [String, nil]
The project ID string.
@return [String]
The trace service client that obtained this result set @private
The `start_time` query parameter.
@return [Time, nil]
The `view` query parameter.
@return [Symbol, nil]
Public Class Methods
Create a new ResultSet
given a Gapic::PagedEnumerable::Page, and all the query parameters.
@private
# File lib/google/cloud/trace/result_set.rb, line 177 def self.from_gapic_page service, project_id, page, start_time, end_time, filter: nil, order_by: nil, view: nil, page_size: nil, page_token: nil next_page_token = page.next_page_token next_page_token = nil unless page.next_page_token? results = page.map do |proto| Google::Cloud::Trace::TraceRecord.from_grpc proto end new service, project_id, results, next_page_token, start_time, end_time, filter: filter, order_by: order_by, view: view, page_size: page_size, page_token: page_token end
Create a new ResultSet
given an enumerable of result Trace
objects, a next page token (or nil if this is the last page), and all the query parameters.
@private
# File lib/google/cloud/trace/result_set.rb, line 34 def initialize service, project, results, next_page_token, start_time, end_time, filter: nil, order_by: nil, view: nil, page_size: nil, page_token: nil @service = service @project = project @results = results @next_page_token = next_page_token @view = view @page_size = page_size @start_time = start_time @end_time = end_time @filter = filter @order_by = order_by @page_token = page_token end
Public Instance Methods
An `each` method that supports the Enumerable module. Iterates over the results and yields each, as a {Google::Cloud::Trace::TraceRecord} object, to the given block. If no block is provided, returns an Enumerator.
# File lib/google/cloud/trace/result_set.rb, line 61 def each &block @results.each(&block) end
Queries the service for the next page of results and returns a new ResultSet
for that page. Returns `nil` if there are no more results.
@return [Google::Cloud::Trace::ResultSet]
# File lib/google/cloud/trace/result_set.rb, line 158 def next_page return nil unless results_pending? service.list_traces \ project, start_time, end_time, filter: filter, order_by: order_by, view: view, page_size: page_size, page_token: next_page_token end
Returns true if at least one more page of results can be retrieved.
@return [Boolean]
# File lib/google/cloud/trace/result_set.rb, line 148 def results_pending? !next_page_token.nil? end
Returns the number of traces in this page of results.
@return [Integer]
# File lib/google/cloud/trace/result_set.rb, line 70 def size @results.size end