Class: Tripletexer::Endpoints::Order

Inherits:
AbstractEndpoint show all
Defined in:
lib/tripletexer/endpoints/order.rb

Defined Under Namespace

Classes: Orderline

Instance Method Summary collapse

Methods inherited from AbstractEndpoint

#initialize

Constructor Details

This class inherits a constructor from Tripletexer::Endpoints::AbstractEndpoint

Instance Method Details

#create(body) ⇒ Object



16
17
18
# File 'lib/tripletexer/endpoints/order.rb', line 16

def create(body)
  create_entity('/v2/order', body)
end

#create_invoice(id, invoice_date, send_to_customer = true) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/tripletexer/endpoints/order.rb', line 31

def create_invoice(id, invoice_date, send_to_customer = true)
  final_params = params.merge(
    'invoiceDate' => ::Tripletexer::FormatHelpers.format_date(invoice_date),
    'sendToCustomer' => send_to_customer.to_s
  )
  api_client.put("/v2/order/#{id}", final_params)
end

#find(id, params = {}) ⇒ Object



21
22
23
# File 'lib/tripletexer/endpoints/order.rb', line 21

def find(id, params = {})
  find_entity("/v2/order/#{id}", params)
end

#orderlineObject



39
40
41
# File 'lib/tripletexer/endpoints/order.rb', line 39

def orderline
  ::Tripletexer::Endpoints::Order::Orderline.new(api_client)
end

#search(date_from, date_to, params = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/tripletexer/endpoints/order.rb', line 7

def search(date_from, date_to, params = {})
  final_params = params.merge(
    'orderDateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
    'orderDateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
  )
  find_entities('/v2/order', final_params)
end

#update(id, body) ⇒ Object



26
27
28
# File 'lib/tripletexer/endpoints/order.rb', line 26

def update(id, body)
  update_entity("/v2/order/#{id}", body)
end