Module: Tikkie::Api::V1::Responses::Pagination
- Included in:
- PaymentRequests
- Defined in:
- lib/tikkie/api/v1/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.
9 10 11 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 9 def elements @elements end |
#limit ⇒ Object
Returns the value of attribute limit.
9 10 11 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 9 def limit @limit end |
#offset ⇒ Object
Returns the value of attribute offset.
9 10 11 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 9 def offset @offset end |
#total_elements ⇒ Object
Returns the value of attribute total_elements.
9 10 11 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 9 def total_elements @total_elements end |
Instance Method Details
#more_elements? ⇒ Boolean
11 12 13 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 11 def more_elements? @total_elements && @total_elements > @offset + @elements end |
#next_offset ⇒ Object
15 16 17 |
# File 'lib/tikkie/api/v1/responses/pagination.rb', line 15 def next_offset @offset + @limit if more_elements? end |