class Aws::Pager
@api private
Attributes
@return [Symbol, nil]
@return [Hash, nil]
Public Class Methods
Source
# File lib/aws-sdk-core/pager.rb, line 12 def initialize(options) @tokens = options.fetch(:tokens) @limit_key = options.fetch(:limit_key, nil) @more_results = options.fetch(:more_results, nil) end
@option options [required, Hash<JMESPath,JMESPath>] :tokens @option options [String<JMESPath>] :limit_key @option options [String<JMESPath>] :more_results
Public Instance Methods
Source
# File lib/aws-sdk-core/pager.rb, line 26 def next_tokens(response) @tokens.each.with_object({}) do |(source, target), next_tokens| value = JMESPath.search(source, response.data) next_tokens[target.to_sym] = value unless empty_value?(value) end end
@param [Seahorse::Client::Response] response @return [Hash]
Source
# File lib/aws-sdk-core/pager.rb, line 34 def prev_tokens(response) @tokens.each.with_object({}) do |(_, target), tokens| value = JMESPath.search(target, response.context.params) tokens[target.to_sym] = value unless empty_value?(value) end end
@api private
Source
# File lib/aws-sdk-core/pager.rb, line 43 def truncated?(response) if @more_results JMESPath.search(@more_results, response.data) else next_t = next_tokens(response) prev_t = prev_tokens(response) !(next_t.empty? || next_t == prev_t) end end
@param [Seahorse::Client::Response] response @return [Boolean]
Private Instance Methods
Source
# File lib/aws-sdk-core/pager.rb, line 55 def empty_value?(value) value.nil? || value == '' || value == [] || value == {} end