app/controllers/spree/api/retailops/orders_controller.rb
# This function handles fetching order data for RetailOps.  In the spirit of
# pushing as much maintainance burden as possible onto RetailOps and not
# requiring different versions per client, we return data in a fairly raw
# state.  This also needs to be relatively fast.  Since we cannot guarantee
# that the other side will receive and correctly process the data we return
# (there might be a badly timed network dropout, or *gasp* a bug), we don't
# mark orders as exported here - that's handled in export below.
This function handles fetching order data for RetailOps.  In the spirit of
pushing as much maintainance burden as possible onto RetailOps and not
requiring different versions per client, we return data in a fairly raw
state.  This also needs to be relatively fast.  Since we cannot guarantee
that the other side will receive and correctly process the data we return
(there might be a badly timed network dropout, or *gasp* a bug), we don't
mark orders as exported here - that's handled in export below.
This function handles fetching order data for RetailOps . In the spirit of pushing as much maintainance burden as possible onto RetailOps and not requiring different versions per client we return data in a fairly raw state . This also needs to be relatively fast . Since we cannot guarantee that the other side will receive and correctly process the data we return ( there might be a badly timed network dropout or * gasp * a bug ) we don ' t mark orders as exported here - that ' s handled in export below .
def export
          authorize! :manage, Order
          ids = params["ids"]
          raise "ids must be a list of numbers" unless ids.is_a?(Array) && ids.all? { |i| i.is_a? Fixnum }
          missing_ids = ids - Order.where(id: ids, retailops_import: ['done', 'yes']).pluck(:id)
          raise "order IDs could not be matched or marked nonimportable: " + missing_ids.join(', ') if missing_ids.any?
          Order.where(retailops_import: 'yes', id: ids).update_all(retailops_import: 'done')
          render text: {}.to_json
        end
def export authorize! :manage , Order ids = params [ "ids" ] raise "ids must be a list of numbers" unless ids . is_a? ( Array ) && ids . all? { | i | i . is_a? Fixnum } missing_ids = ids - Order . where ( id : ids , retailops_import : [ 'done' , 'yes' ] ) . pluck ( :id ) raise "order IDs could not be matched or marked nonimportable: " + missing_ids . join ( ', ' ) if missing_ids . any? Order . where ( retailops_import : 'yes' , id : ids ) . update_all ( retailops_import : 'done' ) render text : { } . to_json end
This function handles fetching order data for RetailOps.
This function handles fetching order data for RetailOps .