Module: BrightpearlApi::Service::Order

Included in:
BrightpearlApi::Service
Defined in:
lib/brightpearl_api/services/order.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/brightpearl_api/services/order.rb', line 4

def self.included(klass)
  klass.class_eval do
    def order_acknowledgement(order_id, reference)
      body = {
        reference: "#{reference}"
      }
      call(:put, "/order-service/order/#{order_id.to_i}/acknowledgement", body)
    end

    def create_order_note(order_id)
      body = {}
      yield(body)
      call(:post, "/order-service/order/#{order_id.to_i}/note", body)
    end

    def get_order_row(order_id, row_id)
      call(:get, "/order-service/order/#{order_id.to_i}/row/#{row_id.to_i}")
    end

    def create_order_row(order_id)
      body = {}
      yield(body)
      call(:post, "/order-service/order/#{order_id.to_i}/row", body)
    end

    def update_order_row(order_id, row_id)
      body = {}
      yield(body)
      call(:put, "/order-service/order/#{order_id.to_i}/row/#{row_id.to_i}", body)
    end

    def update_order_status(order_id)
      body = {}
      yield(body)
      call(:put, "/order-service/order/#{order_id.to_i}/status", body)
    end
  end
end