Sha256: 4ed69c2f261b66255502a974630ec1a9eefb33b67cf0087676bd83ded20557fb

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

module Veeqo
  class Allocation < Base
    include Veeqo::Actions::Delete

    def create(order_id:, warehouse_id:, line_items:)
      @order_id = order_id
      create_resource(
        warehouse_id: warehouse_id,
        line_items_attributes: line_items,
      )
    end

    def update(allocation_id, order_id:, line_items:, **attributes)
      @order_id = order_id
      update_resource(
        allocation_id,
        attributes.merge(line_items_attributes: line_items),
      )
    end

    def delete(order_id, allocation_id)
      @order_id = order_id
      super(allocation_id)
    end

    private

    def end_point
      ["orders", @order_id, "allocations"].compact.join("/")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veeqo-0.1.1 lib/veeqo/allocation.rb
veeqo-0.1.0 lib/veeqo/allocation.rb