Sha256: 901c6553fd3ffdfa403322cbe3bf26e210b9b173255caaf61a80a02b29865726

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true
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

1 entries across 1 versions & 1 rubygems

Version Path
trav3-0.1.1 lib/trav3/pagination.rb