Class: Tradenity::Page

Inherits:
Array
  • Object
show all
Defined in:
lib/tradenity/resources/paging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content = [], total_pages, total_elements, number, size, number_of_elements) ⇒ Page

Returns a new instance of Page.



15
16
17
18
19
20
21
22
# File 'lib/tradenity/resources/paging.rb', line 15

def initialize(content=[], total_pages, total_elements, number, size, number_of_elements)
  concat(content)
  @total_pages = total_pages
  @total_elements = total_elements
  @number = number
  @size = size
  @number_of_elements = number_of_elements
end

Instance Attribute Details

#numberObject

Returns the value of attribute number.



9
10
11
# File 'lib/tradenity/resources/paging.rb', line 9

def number
  @number
end

#number_of_elementsObject

Returns the value of attribute number_of_elements.



13
14
15
# File 'lib/tradenity/resources/paging.rb', line 13

def number_of_elements
  @number_of_elements
end

#sizeObject

Returns the value of attribute size.



11
12
13
# File 'lib/tradenity/resources/paging.rb', line 11

def size
  @size
end

#total_elementsObject

Returns the value of attribute total_elements.



7
8
9
# File 'lib/tradenity/resources/paging.rb', line 7

def total_elements
  @total_elements
end

#total_pagesObject

Returns the value of attribute total_pages.



5
6
7
# File 'lib/tradenity/resources/paging.rb', line 5

def total_pages
  @total_pages
end

Instance Method Details

#is_empty?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/tradenity/resources/paging.rb', line 24

def is_empty?
  @size <= 0
end