Class: BusinessCentral::PurchaseInvoiceLine

Inherits:
Base
  • Object
show all
Defined in:
lib/business_central/purchase_invoice_line.rb

Constant Summary collapse

API_OBJECT_PARENT =
"purchaseInvoices"
API_OBJECT =
"purchaseInvoiceLines"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#build_url, #initialize, #process

Methods included from ApiMethods

#get_child, #method_missing, #query, #query_child

Constructor Details

This class inherits a constructor from BusinessCentral::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BusinessCentral::ApiMethods

Instance Method Details

#create(purchase_invoice_id, data) ⇒ Object


14
15
16
17
18
19
20
21
22
# File 'lib/business_central/purchase_invoice_line.rb', line 14

def create(purchase_invoice_id, data)
  url = build_url(purchase_invoice_id, nil)

  response = @client.post(url, data)
  handle_error(response)
  results = process(response)

  return results.first
end

#delete(purchase_invoice_id, purchase_invoice_line_id, etag) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/business_central/purchase_invoice_line.rb', line 34

def delete(purchase_invoice_id, purchase_invoice_line_id, etag)
  url = build_url(purchase_invoice_id, purchase_invoice_line_id)

  response = @client.delete(url, etag)
  handle_error(response)

  return response.code
end

#get(purchase_invoice_id, purchase_invoice_line_id = nil) ⇒ Object


10
11
12
# File 'lib/business_central/purchase_invoice_line.rb', line 10

def get(purchase_invoice_id, purchase_invoice_line_id = nil)
  get_child(purchase_invoice_id, purchase_invoice_line_id)
end

#update(purchase_invoice_id, purchase_invoice_line_id, etag, data) ⇒ Object


24
25
26
27
28
29
30
31
32
# File 'lib/business_central/purchase_invoice_line.rb', line 24

def update(purchase_invoice_id, purchase_invoice_line_id, etag, data)
  url = build_url(purchase_invoice_id, purchase_invoice_line_id)

  response = @client.patch(url, etag, data)
  handle_error(repsonse)
  results = process(response)

  return results.first
end