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

Instance Method Summary collapse

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



8
9
10
# File 'lib/tikkie/api/responses/pagination.rb', line 8

def elements
  @elements
end

#limitObject

Returns the value of attribute limit.



8
9
10
# File 'lib/tikkie/api/responses/pagination.rb', line 8

def limit
  @limit
end

#offsetObject

Returns the value of attribute offset.



8
9
10
# File 'lib/tikkie/api/responses/pagination.rb', line 8

def offset
  @offset
end

#total_elementsObject

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

Returns:

  • (Boolean)


10
11
12
# File 'lib/tikkie/api/responses/pagination.rb', line 10

def more_elements?
  @total_elements && @total_elements > @offset + @elements
end

#next_offsetObject



14
15
16
# File 'lib/tikkie/api/responses/pagination.rb', line 14

def next_offset
  @offset + @limit if more_elements?
end