Sha256: f18cfd5841173b03472f76a89275db0db931a2d745feaf485f7cbd01082b6398

Contents?: true

Size: 1.61 KB

Versions: 4

Compression:

Stored size: 1.61 KB

Contents

module Spree
  module API
    class Client
      module Orders
        def orders(options={})
          get('orders', options)['orders']
        end

        def order(order_number, options={})
          get("orders/#{order_number}", options)
        end

        def order_completed?(order_number, options={})
          get("orders/#{order_number}/completed", options)
        end

        def create_order(options={})
          post("orders", options)
        end

        def cancel_order(order_number, options={})
          put("orders/#{order_number}/cancel", options)
        end

        def update_order(order_number, options={})
          put("orders/#{order_number}", options)
        end

        def prepare_order_for_checkout(order_number, options={})
          post("orders/#{order_number}/prepare_order", options)
        end

        def set_order_owner(order_number, options={})
          put("orders/#{order_number}/owner", options)
        end

        def prepare_order_for_checkout(order_number, options={})
          post("orders/#{order_number}/prepare_order", options)
        end

        def update_order_address(order_number, options={})
          put("orders/#{order_number}/address", options)
        end

        def set_order_shipping_method(order_number, shipping_method_id, options={})
          order_options = (options[:order] || {}).merge(:shipping_method_id => shipping_method_id)
          put("orders/#{order_number}", options.merge(order: order_options))
        end

        def empty_order(order_number, options={})
          put("orders/#{order_number}/empty", options)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cq-spree-api-client-0.0.10 lib/spree-api-client/orders.rb
cq-spree-api-client-0.0.9 lib/spree-api-client/orders.rb
cq-spree-api-client-0.0.6 lib/spree-api-client/orders.rb
cq-spree-api-client-0.0.5 lib/spree-api-client/orders.rb