Method: Discogs::Wrapper#edit_order

Defined in:
lib/discogs/wrapper.rb

#edit_order(order_id, data = {}) ⇒ Hash

Note:

Authentication as the owner is required.

Edit the data associated with an order.

The conditions under which an order is permitted to transition from one status to another are best summarized by a state diagram.

Rather than implementing this logic in your application, the response contains a next_status key – an array of valid next statuses for this order, which you can display to the user in (for example) a dropdown control. This also renders your application more resilient to any future changes in the order status logic.

Changing the order status using this resource will always message the buyer with:

Seller changed status from Old Status to New Status

and does not provide a facility for including a custom message along with the change. For more fine-grained control, use the Add a new message resource, which allows you to simultaneously add a message and change the order status.

If the order status is neither cancelled, Payment Received, nor Shipped, you can change the shipping. Doing so will send an invoice to the buyer and set the order status to Invoice Sent. (For that reason, you cannot set the shipping and the order status in the same request.)

Parameters:

  • order_id (Integer)

    order id

  • data (Hash) (defaults to: {})

    order parameters

Options Hash (data):

  • :status (String (Optional))

    The new status of the order. Must EXACTLY match one of:

    • New Order

    • Buyer Contacted

    • Invoice Sent

    • Payment Pending

    • Payment Received

    • Shipped

    • Cancelled (Non-Paying Buyer)

    • Cancelled (Item Unavailable)

    • Cancelled (Per Buyer’s Request)

    • the order’s current status

      • Furthermore, the new status must be present in the order’s next_status list. For more information about order statuses, see #edit_order.

  • :shipping (Float (Optional))

    The order shipping amount.

    As a side-effect of setting this value, the buyer is invoiced and the order status is set to Invoice Sent. For more information, see #edit_order.

Returns:

  • (Hash)

    order information



580
581
582
583
584
# File 'lib/discogs/wrapper.rb', line 580

def edit_order(order_id, data={})
  authenticated? do
    query_and_build "marketplace/orders/#{order_id}", {}, :post, data
  end
end