class HornOfPlenty::Repository

Attributes

client[RW]

Public Class Methods

fetch(**attrs) click to toggle source
# File lib/horn_of_plenty/repository.rb, line 23
def self.fetch(**attrs)
  client = attrs.delete(:client)

  new(client: client).fetch(attrs)
end
new(client: nil) click to toggle source
# File lib/horn_of_plenty/repository.rb, line 8
def initialize(client: nil)
  self.client = client
end

Public Instance Methods

fetch(**attrs) click to toggle source
# File lib/horn_of_plenty/repository.rb, line 12
def fetch(**attrs)
  pagination = attrs[:pagination] || {}
  request    = fetch_class(attrs).new(**attrs)

  Paginator.new(client:         client,
                request:        request,
                items_per_page: pagination[:page_size],
                current_page:   pagination[:page_number],
                autopage:       pagination.fetch(:autopage, true))
end