business_central 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1c2da60c298b7c45a07e61a5dc450b9af0f090f8e8c1c74b02e33303f60c145
4
- data.tar.gz: 841af48401c962d3085885761dcdf59d31b7c4bbfbc43b3e4b8927d2a82c055b
3
+ metadata.gz: c64c8b89e135e0b6c62847a7a9078a1d6e03ed9a7f4f0c42fbe6055c7682fb9d
4
+ data.tar.gz: bd582004159946b732c2299c0fb9f117b561046841fda4d1ca969b765a8e3000
5
5
  SHA512:
6
- metadata.gz: eef84d9b0c8a197a6f6e4442c4df48b9ed08ece84123b238939fcff0c29a153959f21df4ca3f9b7ba4808974422176e81762911963ce4ae03314c4993417af5d
7
- data.tar.gz: 780c4c80de20557384227aa5ba5f2c8a29701f1d62823cbdf86785bc503a78acd1eeb3ccb725f31ca91b3a36a498ffb697064fb5eeffd7b3338c1aa4532aeac3
6
+ metadata.gz: 1dbbccbe53b6ea89e9412bb70c920c422df23034ad1f4e95c41fbc8c9136dfedae9545b42f9c8d9af7184db58ccff3136b378d30b68adad970adf7c2a0ff0aea
7
+ data.tar.gz: 52cd76e4fd06945006f8149f0c0900f6e9ff2c13c765ac450252b7bc9a04e803b69f5346787d3a5f198555ad9351cd4827bbbacf98f820124f0883b1365585bb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # business-central
2
2
 
3
- [![Build Status](https://dev.azure.com/fivesenses/business-central/_apis/build/status/fivesenses.business-central)](https://dev.azure.com/fivesenses/business-central/_build/latest?definitionId=2)
3
+ [![Build Status](https://dev.azure.com/fivesenses/business-central/_apis/build/status/fivesenses.business_central?branchName=master)](https://dev.azure.com/fivesenses/business-central/_build/latest?definitionId=3&branchName=master)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/f6fbe96abdd5ea3e9406/maintainability)](https://codeclimate.com/github/fivesenses/business-central/maintainability)
5
5
 
6
6
  A Ruby library that provides access to the Microsoft Dynamics365 Business Central REST API.
@@ -31,7 +31,7 @@ The gem will automatically look for the following ENV variables, but these can
31
31
  be over-ridden in the options Hash:
32
32
 
33
33
  ```
34
- BC_TENANT, BC_COMPANY_ID, BC_USERNAME, BC_PASSWORD
34
+ BC_TENANT, BC_COMPANY_ID, BC_USERNAME, BC_PASSWORD, BC_HOST
35
35
  ```
36
36
 
37
37
  ```
@@ -41,9 +41,17 @@ client = BusinessCentral::Client.new({
41
41
  api_password: ENV[BC_PASSWORD],
42
42
  api_version: ENV[BC_API_VERSION],
43
43
  api_path: ENV[BC_API_PATH],
44
- api_company_id: ENV[BC_COMPANY_ID]
44
+ api_company_id: ENV[BC_COMPANY_ID],
45
+ api_host: ENV[BC_HOST]
45
46
  })
46
47
 
48
+ # These options are used to build the URL to access the Business Central API as
49
+ # follows:
50
+
51
+ "https://#{@api_host}#{@api_version}/#{@api_tenant}#{@api_path}/companies(#{@api_company_id})"
52
+
53
+ "https://api.businesscentral.dynamics.com/v1.0/cronus.com/api/v1.0/companies(UUID)"
54
+
47
55
  # Returns an array of Customers
48
56
  customers = BusinessCentral::Customer.new(client).get()
49
57
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["dev@fivesenses.com.au"]
11
11
  spec.summary = %q{Interact with the Microsoft Dynamics365 Business Central API}
12
12
  spec.description = %q{Interact with the Microsoft Dynamics365 Business Central API}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/fivesenses/business_central"
14
14
  spec.license = "Mozilla"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -92,6 +92,12 @@ module BusinessCentral
92
92
  process(response)
93
93
  end
94
94
 
95
+ def query_child(parent_id, query)
96
+ response = @client.get("/#{api_object_parent}(#{parent_id})/#{api_object}?$filter=#{query}")
97
+ handle_error(response)
98
+ process(response)
99
+ end
100
+
95
101
  # Performs the POST operation on the supplied args
96
102
  #
97
103
  # @param args [Array]]
@@ -1,3 +1,3 @@
1
1
  module BusinessCentral
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
@@ -26,6 +26,17 @@ class BusinessCentral::SalesInvoiceLineTest < Test::Unit::TestCase
26
26
  assert_equal "LONDON Swivel Chair, blue", invoiceLines.first.description
27
27
  end
28
28
 
29
+ test "should return filtered invoice lines for a given salesInvoice" do
30
+ stub_get("salesInvoices(1234)/salesInvoiceLines?$filter=lineType%20eq%20'Item'").
31
+ with(headers: stub_headers).
32
+ to_return(status: 200, body: fixture("get_salesInvoiceLines_200.json"))
33
+
34
+ invoiceLines = BusinessCentral::SalesInvoiceLine.new(bc_client).
35
+ query_child("1234", "lineType eq 'Item'")
36
+
37
+ assert invoiceLines.is_a?(Array)
38
+ end
39
+
29
40
  test "should return salesInvoiceLines when only one line exists" do
30
41
  stub_get("salesInvoices(1234)/salesInvoiceLines").
31
42
  with(headers: stub_headers).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business_central
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Five Senses Coffee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-01 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -293,7 +293,7 @@ files:
293
293
  - test/fixtures/post_salesInvoice_200.json
294
294
  - test/fixtures/post_subscription_200.json
295
295
  - test/test_helper.rb
296
- homepage: ''
296
+ homepage: https://github.com/fivesenses/business_central
297
297
  licenses:
298
298
  - Mozilla
299
299
  metadata: {}