Class: JSOM::Pagination::Links

Inherits:
Object
  • Object
show all
Defined in:
lib/jsom/pagination/links.rb

Constant Summary collapse

DEFAULT_PAGE_SIZE =
20

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nextObject (readonly)

Returns the value of attribute next.



28
29
30
# File 'lib/jsom/pagination/links.rb', line 28

def next
  @next
end

#prevObject (readonly)

Returns the value of attribute prev.



28
29
30
# File 'lib/jsom/pagination/links.rb', line 28

def prev
  @prev
end

#selfObject (readonly)

Returns the value of attribute self.



28
29
30
# File 'lib/jsom/pagination/links.rb', line 28

def self
  @self
end

Instance Method Details

#firstObject



20
21
22
# File 'lib/jsom/pagination/links.rb', line 20

def first
  @first || generate_url(1)
end

#lastObject



24
25
26
# File 'lib/jsom/pagination/links.rb', line 24

def last
  @last || generate_url(total_pages)
end

#to_hObject



10
11
12
13
14
15
16
17
18
# File 'lib/jsom/pagination/links.rb', line 10

def to_h
  {
    first: @first,
    prev: @prev,
    self: @self,
    next: @next,
    last: @last
  }.reject { |_key, value| value.nil? }
end