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

Instance Method Summary collapse

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



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

def elements
  @elements
end

#limitObject

Returns the value of attribute limit.



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

def limit
  @limit
end

#offsetObject

Returns the value of attribute offset.



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

def offset
  @offset
end

#total_elementsObject

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

Returns:

  • (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_offsetObject



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

def next_offset
  @offset + @limit if more_elements?
end