Class: Trav3::Pagination

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

Instance Method Summary collapse

Constructor Details

#initialize(travis, result) ⇒ Pagination


5
6
7
8
# File 'lib/trav3/pagination.rb', line 5

def initialize(travis, result)
  @travis = travis
  @result = result
end

Instance Method Details

#dig(opt) ⇒ Object


10
11
12
# File 'lib/trav3/pagination.rb', line 10

def dig(opt)
  @result.dig(opt)
end

#firstObject


18
19
20
# File 'lib/trav3/pagination.rb', line 18

def first
  get("#{API_ROOT}#{dig('@pagination').dig('first').dig('@href')}")
end

#lastObject


22
23
24
# File 'lib/trav3/pagination.rb', line 22

def last
  get("#{API_ROOT}#{dig('@pagination').dig('last').dig('@href')}")
end

#nextObject


14
15
16
# File 'lib/trav3/pagination.rb', line 14

def next
  get("#{API_ROOT}#{dig('@pagination').dig('next').dig('@href')}")
end