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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rules) ⇒ 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.



5
6
7
8
9
10
11
12
# File 'lib/aws-sdk-core/pager.rb', line 5

def initialize(rules)
  @more_results = rules['more_results']
  @more_results = underscore(@more_results) if @more_results
  if rules['limit_key']
    @limit_key = underscore(rules['limit_key']).to_sym
  end
  map_tokens(rules)
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)


15
16
17
# File 'lib/aws-sdk-core/pager.rb', line 15

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)


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

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.



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

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)


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

def truncated?(response)
  if @more_results
    JMESPath.search(@more_results, response.data)
  else
    next_tokens = self.next_tokens(response)
    prev_tokens = self.prev_tokens(response)
    !(next_tokens.empty? || next_tokens == prev_tokens)
  end
end