Sha256: 9a89d709620731e99e7a807b90ffc6c7dcb439b516a2e85c44d0f59e97222dcb
Contents?: true
Size: 1.98 KB
Versions: 5
Compression:
Stored size: 1.98 KB
Contents
module ShipCompliant # == ShipCompliant::SearchSalesOrders # # Search orders in the ShipCompliant database on a number of different # criteria such as date ranges, order number range, order list, status, etc... # # Summary details, including tracking numbers, of Sales Orders and # Shipments are returned for the first 100 orders that meet the search criteria. # # Use this method to get tracking numbers for a collection of orders, # check shipping status, check compliance status, or check fulfillment status. # # Results are paged, and only the first 100 results are returned with this method. # Use the ShipCompliant::SearchSalesOrdersResult#remaining_orders_length method in # conjunction with this method to page through the result set. # # _You must specify at least one of the date range options or an invoice number range in this request._ # # orders = ShipCompliant::SearchSalesOrders.find_by({ # purchase_date_min: DateTime.new(2014, 3, 10), # purchase_date_max: DateTime.new(2014, 3, 12) # }) class SearchSalesOrders # +query+ must be a Hash with the keys relating to each search criteria. # # To see a list of available keys take a look at OrderSearch::KEYS # # # find orders place within date # orders = ShipCompliant::SearchSalesOrders.find_by({ # purchase_date_min: DateTime.new(2014, 3, 10), # purchase_date_max: DateTime.new(2014, 3, 12) # }) # # # find orders by compliance_status # orders = ShipCompliant::SearchSalesOrders.find_by({ # compliance_status: 'NotCompliant' # possible values are "Compliant", "NotCompliant", or "Any". Any is default. # }) def self.find_by(query) order_query = OrderSearch.new(query).to_h sales = search_sales(order_query) SearchSalesOrdersResult.new(sales.to_hash) end private def self.search_sales(order_query) ShipCompliant.client.call(:search_sales_orders, order_query) end end end
Version data entries
5 entries across 5 versions & 1 rubygems