Class: Aws::Pager Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/pager.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: NullPager

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Pager

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Pager.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :tokens (required, Hash<JMESPath,JMESPath>)
  • :limit_key (String<JMESPath>)
  • :more_results (String<JMESPath>)


10
11
12
13
14
# File 'lib/aws-sdk-core/pager.rb', line 10

def initialize(options)
  @tokens = options.fetch(:tokens)
  @limit_key = options.fetch(:limit_key, nil)
  @more_results = options.fetch(:more_results, nil)
end

Instance Attribute Details

#limit_keySymbol? (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Symbol, nil)


17
18
19
# File 'lib/aws-sdk-core/pager.rb', line 17

def limit_key
  @limit_key
end

Instance Method Details

#next_tokens(response) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

  • (Hash)


21
22
23
24
25
26
# File 'lib/aws-sdk-core/pager.rb', line 21

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

#prev_tokens(response) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
# File 'lib/aws-sdk-core/pager.rb', line 29

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

#truncated?(response) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
# File 'lib/aws-sdk-core/pager.rb', line 38

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