Module: Tikkie::Api::Responses::Pagination
- Included in:
- PaymentRequests
- Defined in:
- lib/tikkie/api/responses/pagination.rb
Overview
Helper for paginated responses.
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#total_elements ⇒ Object
Returns the value of attribute total_elements.
Instance Method Summary collapse
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
8 9 10 |
# File 'lib/tikkie/api/responses/pagination.rb', line 8 def elements @elements end |
#limit ⇒ Object
Returns the value of attribute limit.
8 9 10 |
# File 'lib/tikkie/api/responses/pagination.rb', line 8 def limit @limit end |
#offset ⇒ Object
Returns the value of attribute offset.
8 9 10 |
# File 'lib/tikkie/api/responses/pagination.rb', line 8 def offset @offset end |
#total_elements ⇒ Object
Returns the value of attribute total_elements.
8 9 10 |
# File 'lib/tikkie/api/responses/pagination.rb', line 8 def total_elements @total_elements end |
Instance Method Details
#more_elements? ⇒ Boolean
10 11 12 |
# File 'lib/tikkie/api/responses/pagination.rb', line 10 def more_elements? @total_elements && @total_elements > @offset + @elements end |
#next_offset ⇒ Object
14 15 16 |
# File 'lib/tikkie/api/responses/pagination.rb', line 14 def next_offset @offset + @limit if more_elements? end |