Sha256: 1e41ae8270078e3125033465a7f58aee4f982289d8d7dbe1a838017ffc46bd3f

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true
module Trav3
  class Pagination
    def initialize(travis, result)
      @travis = travis
      @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.(travis, x)
    end
    private :get

    attr_reader :travis
    private :travis
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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