Class: Nfe::ListPage
- Inherits:
-
Data
- Object
- Data
- Nfe::ListPage
- Defined in:
- lib/nfe/pagination.rb,
sig/nfe/pagination.rbs
Overview
Pagination metadata for a list response. NFE.io endpoints paginate in one of two shapes; each resource populates only the half relevant to it:
- page-style —
page_index/page_count(cursor fields nil) - cursor-style —
starting_after/ending_before(+page_index+ nil)
total is optional and may be present in either shape.
Instance Attribute Summary collapse
-
#ending_before ⇒ Object
readonly
Returns the value of attribute ending_before.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#page_index ⇒ Object
readonly
Returns the value of attribute page_index.
-
#starting_after ⇒ Object
readonly
Returns the value of attribute starting_after.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Class Method Summary collapse
-
.from_cursor(starting_after: nil, ending_before: nil, total: nil) ⇒ Nfe::ListPage
A cursor-style page with +page_index+/+page_count+ nil.
-
.from_page(page_index: nil, page_count: nil, total: nil) ⇒ Nfe::ListPage
A page-style page with cursor fields left nil.
- .new ⇒ instance
Instance Method Summary collapse
-
#initialize(page_index: nil, page_count: nil, starting_after: nil, ending_before: nil, total: nil) ⇒ ListPage
constructor
A new instance of ListPage.
Constructor Details
#initialize(page_index: nil, page_count: nil, starting_after: nil, ending_before: nil, total: nil) ⇒ ListPage
Returns a new instance of ListPage.
24 25 26 27 |
# File 'lib/nfe/pagination.rb', line 24 def initialize(page_index: nil, page_count: nil, starting_after: nil, ending_before: nil, total: nil) super end |
Instance Attribute Details
#ending_before ⇒ Object (readonly)
Returns the value of attribute ending_before.
6 7 8 |
# File 'sig/nfe/pagination.rbs', line 6 def ending_before @ending_before end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
4 5 6 |
# File 'sig/nfe/pagination.rbs', line 4 def page_count @page_count end |
#page_index ⇒ Object (readonly)
Returns the value of attribute page_index.
3 4 5 |
# File 'sig/nfe/pagination.rbs', line 3 def page_index @page_index end |
#starting_after ⇒ Object (readonly)
Returns the value of attribute starting_after.
5 6 7 |
# File 'sig/nfe/pagination.rbs', line 5 def starting_after @starting_after end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
7 8 9 |
# File 'sig/nfe/pagination.rbs', line 7 def total @total end |
Class Method Details
.from_cursor(starting_after: nil, ending_before: nil, total: nil) ⇒ Nfe::ListPage
Returns a cursor-style page with +page_index+/+page_count+ nil.
19 20 21 22 |
# File 'lib/nfe/pagination.rb', line 19 def self.from_cursor(starting_after: nil, ending_before: nil, total: nil) new(page_index: nil, page_count: nil, starting_after: starting_after, ending_before: ending_before, total: total) end |
.from_page(page_index: nil, page_count: nil, total: nil) ⇒ Nfe::ListPage
Returns a page-style page with cursor fields left nil.
13 14 15 16 |
# File 'lib/nfe/pagination.rb', line 13 def self.from_page(page_index: nil, page_count: nil, total: nil) new(page_index: page_index, page_count: page_count, starting_after: nil, ending_before: nil, total: total) end |
.new ⇒ instance
9 |
# File 'sig/nfe/pagination.rbs', line 9
def self.new: (?page_index: untyped, ?page_count: untyped, ?starting_after: untyped, ?ending_before: untyped, ?total: untyped) -> instance
|