Class: Qismo::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/qismo/collection.rb

Overview

Class to handle paginated response from API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, prev_page: nil, next_page: nil) ⇒ Collection

Collection object

Parameters:

  • data (Array)
  • prev_page (String, Integer) (defaults to: nil)
  • next_page (String, Integer) (defaults to: nil)
  • pagination_type (String)


11
12
13
14
15
16
# File 'lib/qismo/collection.rb', line 11

def initialize(data, prev_page: nil, next_page: nil)
  super(data)

  @prev_page = prev_page
  @next_page = next_page
end

Instance Attribute Details

#next_pageObject (readonly)

Returns the value of attribute next_page.



18
19
20
# File 'lib/qismo/collection.rb', line 18

def next_page
  @next_page
end

#prev_pageObject (readonly)

Returns the value of attribute prev_page.



19
20
21
# File 'lib/qismo/collection.rb', line 19

def prev_page
  @prev_page
end