# frozen_string_literal: true module ErpIntegration module Fulfil module PaginationMethods DEFAULT_OFFSET = 0 MAX_LIMIT = 500 # Max limit set by FF attr_accessor :offset_clause, :limit_clause # Fulfil by default is returning us the first 500 records on every query that we made. # The `offset` method, as the name sais, will allow us to move the offset of the results. # @example # $ ErpIntegration::SalesOrder.offset(10).all # # => ] /> def offset(offset) self.offset_clause = offset self end # Fulfil by default is returning us the first 500 records on every query that we made. # The `limit` method will allow us to modify the amount of records that we want to receive. # @example # $ ErpIntegration::SalesOrder.limit(5).all # # => ] /> def limit(limit) self.limit_clause = [limit, MAX_LIMIT].min self end end end end