Sha256: b7f0b5c21b01e9a92c36f3f1fe064bdcf072adb3c62ddec0abfe6319520917d6

Contents?: true

Size: 528 Bytes

Versions: 4

Compression:

Stored size: 528 Bytes

Contents

require 'trav3/get'

module Trav3
  class Pagination
    def initialize(result)
      @result = result
    end

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

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

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

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

    def get(x)
      Trav3::GET.(x)
    end
    private :get
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trav3-0.1.0 lib/trav3/pagination.rb
trav3-0.0.5 lib/trav3/pagination.rb
trav3-0.0.4 lib/trav3/pagination.rb
trav3-0.0.3 lib/trav3/pagination.rb