Sha256: 0d727e959dbb3913cd671e53d6f24728540b0ece1952099dd9af6f5a5500fa78
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
# 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 # # => <ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @offset=10 />] /> 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 # # => <ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @limit=5 />] /> def limit(limit) self.limit_clause = [limit, MAX_LIMIT].min self end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
erp_integration-0.19.0 | lib/erp_integration/fulfil/pagination_methods.rb |
erp_integration-0.18.0 | lib/erp_integration/fulfil/pagination_methods.rb |