business-central 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/business_central.rb +35 -2
- data/lib/business_central/client.rb +65 -38
- data/lib/business_central/exceptions.rb +19 -9
- data/lib/business_central/object/account.rb +4 -2
- data/lib/business_central/object/aged_account_payable.rb +4 -2
- data/lib/business_central/object/aged_account_receivable.rb +4 -2
- data/lib/business_central/object/argument_helper.rb +22 -0
- data/lib/business_central/object/balance_sheet.rb +4 -2
- data/lib/business_central/object/base.rb +90 -56
- data/lib/business_central/object/cash_flow_statement.rb +4 -2
- data/lib/business_central/object/company.rb +5 -3
- data/lib/business_central/object/company_information.rb +7 -5
- data/lib/business_central/object/country_region.rb +8 -6
- data/lib/business_central/object/currency.rb +8 -6
- data/lib/business_central/object/customer.rb +15 -9
- data/lib/business_central/object/customer_financial_detail.rb +3 -1
- data/lib/business_central/object/customer_payment.rb +8 -6
- data/lib/business_central/object/customer_payment_journal.rb +8 -6
- data/lib/business_central/object/customer_sale.rb +3 -1
- data/lib/business_central/object/default_dimension.rb +17 -20
- data/lib/business_central/object/dimension.rb +20 -0
- data/lib/business_central/object/dimension_line.rb +37 -0
- data/lib/business_central/object/dimension_value.rb +28 -0
- data/lib/business_central/object/employee.rb +21 -0
- data/lib/business_central/object/filter_query.rb +18 -0
- data/lib/business_central/object/item.rb +17 -10
- data/lib/business_central/object/item_category.rb +16 -0
- data/lib/business_central/object/journal.rb +29 -0
- data/lib/business_central/object/journal_line.rb +48 -0
- data/lib/business_central/object/{helper.rb → object_helper.rb} +18 -10
- data/lib/business_central/object/payment_method.rb +16 -0
- data/lib/business_central/object/payment_term.rb +16 -0
- data/lib/business_central/object/picture.rb +53 -0
- data/lib/business_central/object/purchase_invoice.rb +8 -6
- data/lib/business_central/object/purchase_invoice_line.rb +10 -8
- data/lib/business_central/object/request.rb +60 -49
- data/lib/business_central/object/response.rb +28 -22
- data/lib/business_central/object/retained_earning_statement.rb +13 -0
- data/lib/business_central/object/sales_credit_memo.rb +20 -0
- data/lib/business_central/object/sales_credit_memo_line.rb +30 -0
- data/lib/business_central/object/sales_invoice.rb +62 -0
- data/lib/business_central/object/sales_invoice_line.rb +30 -0
- data/lib/business_central/object/sales_order.rb +20 -0
- data/lib/business_central/object/sales_order_line.rb +30 -0
- data/lib/business_central/object/sales_quote.rb +20 -0
- data/lib/business_central/object/sales_quote_line.rb +30 -0
- data/lib/business_central/object/shipment_method.rb +16 -0
- data/lib/business_central/object/subscription.rb +16 -0
- data/lib/business_central/object/tax_area.rb +16 -0
- data/lib/business_central/object/tax_group.rb +16 -0
- data/lib/business_central/object/time_registration_entry.rb +16 -0
- data/lib/business_central/object/trial_balance.rb +13 -0
- data/lib/business_central/object/units_of_measure.rb +16 -0
- data/lib/business_central/object/url_builder.rb +59 -0
- data/lib/business_central/object/url_helper.rb +32 -0
- data/lib/business_central/object/validation.rb +10 -7
- data/lib/business_central/object/vendor.rb +10 -7
- data/lib/business_central/object/vendor_purchase.rb +13 -0
- data/lib/business_central/version.rb +4 -2
- data/lib/business_central/web_service.rb +78 -0
- data/lib/core_ext/string.rb +18 -12
- data/test/business_central/client_test.rb +18 -11
- data/test/business_central/object/account_test.rb +6 -5
- data/test/business_central/object/aged_account_payable_test.rb +6 -5
- data/test/business_central/object/aged_account_receivable_test.rb +6 -5
- data/test/business_central/object/balance_sheet_test.rb +6 -5
- data/test/business_central/object/base_test.rb +4 -2
- data/test/business_central/object/cash_flow_statement_test.rb +6 -5
- data/test/business_central/object/company_information_test.rb +9 -10
- data/test/business_central/object/company_test.rb +6 -5
- data/test/business_central/object/country_region_test.rb +16 -17
- data/test/business_central/object/currency_test.rb +17 -18
- data/test/business_central/object/customer_financial_detail_test.rb +8 -6
- data/test/business_central/object/customer_payment_journal_test.rb +14 -15
- data/test/business_central/object/customer_payment_test.rb +15 -16
- data/test/business_central/object/customer_sale_test.rb +8 -6
- data/test/business_central/object/customer_test.rb +15 -16
- data/test/business_central/object/default_dimension_test.rb +15 -16
- data/test/business_central/object/dimension_line_test.rb +165 -0
- data/test/business_central/object/dimension_test.rb +65 -0
- data/test/business_central/object/dimension_value_test.rb +68 -0
- data/test/business_central/object/employee_test.rb +141 -0
- data/test/business_central/object/filter_query_test.rb +36 -0
- data/test/business_central/object/item_category_test.rb +122 -0
- data/test/business_central/object/item_test.rb +16 -17
- data/test/business_central/object/journal_line_test.rb +152 -0
- data/test/business_central/object/journal_test.rb +124 -0
- data/test/business_central/object/payment_method_test.rb +134 -0
- data/test/business_central/object/payment_term_test.rb +134 -0
- data/test/business_central/object/picture_test.rb +74 -0
- data/test/business_central/object/purchase_invoice_line_test.rb +15 -15
- data/test/business_central/object/purchase_invoice_test.rb +15 -15
- data/test/business_central/object/request_test.rb +17 -9
- data/test/business_central/object/response_test.rb +9 -7
- data/test/business_central/object/retained_earning_statement_test.rb +52 -0
- data/test/business_central/object/sales_credit_memo_line_test.rb +134 -0
- data/test/business_central/object/sales_credit_memo_test.rb +146 -0
- data/test/business_central/object/sales_invoice_line_test.rb +164 -0
- data/test/business_central/object/sales_invoice_test.rb +134 -0
- data/test/business_central/object/sales_order_line_test.rb +134 -0
- data/test/business_central/object/sales_order_test.rb +146 -0
- data/test/business_central/object/sales_quote_line_test.rb +134 -0
- data/test/business_central/object/sales_quote_test.rb +146 -0
- data/test/business_central/object/shipment_method_test.rb +133 -0
- data/test/business_central/object/subscription_test.rb +126 -0
- data/test/business_central/object/tax_area_test.rb +126 -0
- data/test/business_central/object/tax_group_test.rb +126 -0
- data/test/business_central/object/time_registration_entry_test.rb +126 -0
- data/test/business_central/object/trial_balance_test.rb +82 -0
- data/test/business_central/object/units_of_measure_test.rb +126 -0
- data/test/business_central/object/validation_test.rb +5 -4
- data/test/business_central/object/vendor_purchase_test.rb +82 -0
- data/test/business_central/object/vendor_test.rb +16 -16
- data/test/business_central/web_service_test.rb +95 -0
- data/test/business_central_test.rb +3 -1
- data/test/test_helper.rb +12 -6
- metadata +132 -33
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/base_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::BaseTest < Minitest::Test
|
@@ -36,4 +38,4 @@ class BusinessCentral::Object::BaseTest < Minitest::Test
|
|
36
38
|
def set_object_method(base, value)
|
37
39
|
base.class.const_set('OBJECT_METHODS', value) if !base.class.const_defined?('OBJECT_METHODS')
|
38
40
|
end
|
39
|
-
end
|
41
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/cash_flow_statement_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CashFlowStatementTest < Minitest::Test
|
@@ -11,7 +13,7 @@ class BusinessCentral::Object::CashFlowStatementTest < Minitest::Test
|
|
11
13
|
def test_find_all
|
12
14
|
stub_request(:get, /cashFlowStatement/)
|
13
15
|
.to_return(
|
14
|
-
status: 200,
|
16
|
+
status: 200,
|
15
17
|
body: {
|
16
18
|
'value': [
|
17
19
|
{
|
@@ -21,7 +23,6 @@ class BusinessCentral::Object::CashFlowStatementTest < Minitest::Test
|
|
21
23
|
}.to_json
|
22
24
|
)
|
23
25
|
|
24
|
-
|
25
26
|
response = @cash_flow_statement.find_all
|
26
27
|
assert_equal response.first[:display], 'assets 1'
|
27
28
|
end
|
@@ -30,7 +31,7 @@ class BusinessCentral::Object::CashFlowStatementTest < Minitest::Test
|
|
30
31
|
test_id = '123'
|
31
32
|
stub_request(:get, /cashFlowStatement\(#{test_id}\)/)
|
32
33
|
.to_return(
|
33
|
-
status: 200,
|
34
|
+
status: 200,
|
34
35
|
body: {
|
35
36
|
display: 'assets 2'
|
36
37
|
}.to_json
|
@@ -57,4 +58,4 @@ class BusinessCentral::Object::CashFlowStatementTest < Minitest::Test
|
|
57
58
|
@cash_flow_statement.destroy('123')
|
58
59
|
end
|
59
60
|
end
|
60
|
-
end
|
61
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/company_information_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
@@ -11,7 +13,7 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
11
13
|
def test_find_all
|
12
14
|
stub_request(:get, /companyInformation/)
|
13
15
|
.to_return(
|
14
|
-
status: 200,
|
16
|
+
status: 200,
|
15
17
|
body: {
|
16
18
|
'value': [
|
17
19
|
{
|
@@ -21,7 +23,6 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
21
23
|
}.to_json
|
22
24
|
)
|
23
25
|
|
24
|
-
|
25
26
|
response = @company_information.find_all
|
26
27
|
assert_equal response.first[:display_name], 'business1'
|
27
28
|
end
|
@@ -30,7 +31,7 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
30
31
|
test_company_id = '123'
|
31
32
|
stub_request(:get, /companyInformation\(#{test_company_id}\)/)
|
32
33
|
.to_return(
|
33
|
-
status: 200,
|
34
|
+
status: 200,
|
34
35
|
body: {
|
35
36
|
displayName: 'business2'
|
36
37
|
}.to_json
|
@@ -50,7 +51,7 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
50
51
|
test_company_id = '123'
|
51
52
|
stub_request(:get, /companyInformation\(#{test_company_id}\)/)
|
52
53
|
.to_return(
|
53
|
-
status: 200,
|
54
|
+
status: 200,
|
54
55
|
body: {
|
55
56
|
etag: '112',
|
56
57
|
displayName: 'business3'
|
@@ -59,7 +60,7 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
59
60
|
|
60
61
|
stub_request(:patch, /companyInformation\(#{test_company_id}\)/)
|
61
62
|
.to_return(
|
62
|
-
status: 200,
|
63
|
+
status: 200,
|
63
64
|
body: {
|
64
65
|
displayName: 'business4'
|
65
66
|
}.to_json
|
@@ -67,9 +68,7 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
67
68
|
|
68
69
|
response = @company_information.update(
|
69
70
|
test_company_id,
|
70
|
-
|
71
|
-
display_name: 'business4'
|
72
|
-
}
|
71
|
+
display_name: 'business4'
|
73
72
|
)
|
74
73
|
assert_equal response[:display_name], 'business4'
|
75
74
|
end
|
@@ -79,4 +78,4 @@ class BusinessCentral::Object::CompanyInformationTest < Minitest::Test
|
|
79
78
|
@company_information.destroy('123')
|
80
79
|
end
|
81
80
|
end
|
82
|
-
end
|
81
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/company_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CompanyTest < Minitest::Test
|
@@ -10,7 +12,7 @@ class BusinessCentral::Object::CompanyTest < Minitest::Test
|
|
10
12
|
def test_find_all
|
11
13
|
stub_request(:get, /companies/)
|
12
14
|
.to_return(
|
13
|
-
status: 200,
|
15
|
+
status: 200,
|
14
16
|
body: {
|
15
17
|
'value': [
|
16
18
|
{
|
@@ -20,7 +22,6 @@ class BusinessCentral::Object::CompanyTest < Minitest::Test
|
|
20
22
|
}.to_json
|
21
23
|
)
|
22
24
|
|
23
|
-
|
24
25
|
response = @company.find_all
|
25
26
|
assert_equal response.first[:display_name], 'business1'
|
26
27
|
end
|
@@ -29,7 +30,7 @@ class BusinessCentral::Object::CompanyTest < Minitest::Test
|
|
29
30
|
test_company_id = '123'
|
30
31
|
stub_request(:get, /companies\(#{test_company_id}\)/)
|
31
32
|
.to_return(
|
32
|
-
status: 200,
|
33
|
+
status: 200,
|
33
34
|
body: {
|
34
35
|
displayName: 'business2'
|
35
36
|
}.to_json
|
@@ -56,4 +57,4 @@ class BusinessCentral::Object::CompanyTest < Minitest::Test
|
|
56
57
|
@company.destroy('123')
|
57
58
|
end
|
58
59
|
end
|
59
|
-
end
|
60
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/country_region_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
@@ -11,7 +13,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
11
13
|
def test_find_all
|
12
14
|
stub_request(:get, /countriesRegions/)
|
13
15
|
.to_return(
|
14
|
-
status: 200,
|
16
|
+
status: 200,
|
15
17
|
body: {
|
16
18
|
'value': [
|
17
19
|
{
|
@@ -20,7 +22,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
20
22
|
displayName: 'country1'
|
21
23
|
}
|
22
24
|
]
|
23
|
-
}.to_json
|
25
|
+
}.to_json
|
24
26
|
)
|
25
27
|
|
26
28
|
response = @country_region.find_all
|
@@ -31,7 +33,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
31
33
|
test_id = '1111'
|
32
34
|
stub_request(:get, /countriesRegions\(#{test_id}\)/)
|
33
35
|
.to_return(
|
34
|
-
status: 200,
|
36
|
+
status: 200,
|
35
37
|
body: {
|
36
38
|
id: 2,
|
37
39
|
code: 'C2',
|
@@ -47,7 +49,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
47
49
|
test_filter = "displayName eq 'country3'"
|
48
50
|
stub_request(:get, /countriesRegions\?\$filter=#{test_filter}/)
|
49
51
|
.to_return(
|
50
|
-
status: 200,
|
52
|
+
status: 200,
|
51
53
|
body: {
|
52
54
|
'value': [
|
53
55
|
{
|
@@ -64,25 +66,24 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
64
66
|
def test_create
|
65
67
|
stub_request(:post, /countriesRegions/)
|
66
68
|
.to_return(
|
67
|
-
status: 200,
|
69
|
+
status: 200,
|
68
70
|
body: {
|
69
71
|
displayName: 'country4'
|
70
72
|
}.to_json
|
71
73
|
)
|
72
74
|
|
73
|
-
response = @country_region.create(
|
75
|
+
response = @country_region.create(
|
74
76
|
code: 'C4',
|
75
77
|
display_name: 'country4'
|
76
|
-
|
78
|
+
)
|
77
79
|
assert_equal response[:display_name], 'country4'
|
78
80
|
end
|
79
81
|
|
80
|
-
|
81
82
|
def test_update
|
82
83
|
test_id = '22222'
|
83
84
|
stub_request(:get, /countriesRegions\(#{test_id}\)/)
|
84
85
|
.to_return(
|
85
|
-
status: 200,
|
86
|
+
status: 200,
|
86
87
|
body: {
|
87
88
|
etag: '2222',
|
88
89
|
code: 'C5',
|
@@ -92,7 +93,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
92
93
|
|
93
94
|
stub_request(:patch, /countriesRegions\(#{test_id}\)/)
|
94
95
|
.to_return(
|
95
|
-
status: 200,
|
96
|
+
status: 200,
|
96
97
|
body: {
|
97
98
|
etag: '2222',
|
98
99
|
code: 'C6',
|
@@ -102,10 +103,8 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
102
103
|
|
103
104
|
response = @country_region.update(
|
104
105
|
test_id,
|
105
|
-
|
106
|
-
|
107
|
-
display_name: 'country6'
|
108
|
-
}
|
106
|
+
code: 'C6',
|
107
|
+
display_name: 'country6'
|
109
108
|
)
|
110
109
|
assert_equal response[:display_name], 'country6'
|
111
110
|
end
|
@@ -114,7 +113,7 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
114
113
|
test_id = '33333'
|
115
114
|
stub_request(:get, /countriesRegions\(#{test_id}\)/)
|
116
115
|
.to_return(
|
117
|
-
status: 200,
|
116
|
+
status: 200,
|
118
117
|
body: {
|
119
118
|
etag: '3333',
|
120
119
|
code: 'C7',
|
@@ -127,4 +126,4 @@ class BusinessCentral::Object::CountryRegionTest < Minitest::Test
|
|
127
126
|
|
128
127
|
assert @country_region.destroy(test_id)
|
129
128
|
end
|
130
|
-
end
|
129
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/currency_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
@@ -11,7 +13,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
11
13
|
def test_find_all
|
12
14
|
stub_request(:get, /currencies/)
|
13
15
|
.to_return(
|
14
|
-
status: 200,
|
16
|
+
status: 200,
|
15
17
|
body: {
|
16
18
|
'value': [
|
17
19
|
{
|
@@ -23,7 +25,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
23
25
|
amountRoundingPrecision: 0.01
|
24
26
|
}
|
25
27
|
]
|
26
|
-
}.to_json
|
28
|
+
}.to_json
|
27
29
|
)
|
28
30
|
|
29
31
|
response = @currency.find_all
|
@@ -34,7 +36,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
34
36
|
test_id = '2'
|
35
37
|
stub_request(:get, /currencies\(#{test_id}\)/)
|
36
38
|
.to_return(
|
37
|
-
status: 200,
|
39
|
+
status: 200,
|
38
40
|
body: {
|
39
41
|
id: test_id,
|
40
42
|
code: 'C2',
|
@@ -53,7 +55,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
53
55
|
test_filter = "displayName eq 'country3'"
|
54
56
|
stub_request(:get, /currencies\?\$filter=#{test_filter}/)
|
55
57
|
.to_return(
|
56
|
-
status: 200,
|
58
|
+
status: 200,
|
57
59
|
body: {
|
58
60
|
'value': [
|
59
61
|
{
|
@@ -75,7 +77,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
75
77
|
def test_create
|
76
78
|
stub_request(:post, /currencies/)
|
77
79
|
.to_return(
|
78
|
-
status: 200,
|
80
|
+
status: 200,
|
79
81
|
body: {
|
80
82
|
code: 'C4',
|
81
83
|
displayName: 'currency4',
|
@@ -83,20 +85,19 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
83
85
|
}.to_json
|
84
86
|
)
|
85
87
|
|
86
|
-
response = @currency.create(
|
88
|
+
response = @currency.create(
|
87
89
|
code: 'C4',
|
88
90
|
display_name: 'currency4',
|
89
91
|
symbol: '$'
|
90
|
-
|
92
|
+
)
|
91
93
|
assert_equal response[:display_name], 'currency4'
|
92
94
|
end
|
93
95
|
|
94
|
-
|
95
96
|
def test_update
|
96
97
|
test_id = '2'
|
97
98
|
stub_request(:get, /currencies\(#{test_id}\)/)
|
98
99
|
.to_return(
|
99
|
-
status: 200,
|
100
|
+
status: 200,
|
100
101
|
body: {
|
101
102
|
etag: '3333',
|
102
103
|
id: test_id,
|
@@ -110,7 +111,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
110
111
|
|
111
112
|
stub_request(:patch, /currencies\(#{test_id}\)/)
|
112
113
|
.to_return(
|
113
|
-
status: 200,
|
114
|
+
status: 200,
|
114
115
|
body: {
|
115
116
|
etag: '4444',
|
116
117
|
code: 'C6',
|
@@ -121,11 +122,9 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
121
122
|
|
122
123
|
response = @currency.update(
|
123
124
|
test_id,
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
symbol: '$'
|
128
|
-
}
|
125
|
+
code: 'C6',
|
126
|
+
display_name: 'currency6',
|
127
|
+
symbol: '$'
|
129
128
|
)
|
130
129
|
assert_equal response[:display_name], 'currency6'
|
131
130
|
end
|
@@ -134,7 +133,7 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
134
133
|
test_id = '33333'
|
135
134
|
stub_request(:get, /currencies\(#{test_id}\)/)
|
136
135
|
.to_return(
|
137
|
-
status: 200,
|
136
|
+
status: 200,
|
138
137
|
body: {
|
139
138
|
etag: '5555',
|
140
139
|
code: 'C7',
|
@@ -148,4 +147,4 @@ class BusinessCentral::Object::CurrencyTest < Minitest::Test
|
|
148
147
|
|
149
148
|
assert @currency.destroy(test_id)
|
150
149
|
end
|
151
|
-
end
|
150
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/customer_financial_detail_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
@@ -13,7 +15,7 @@ class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
|
13
15
|
def test_find_all
|
14
16
|
stub_request(:get, /customerFinancialDetails/)
|
15
17
|
.to_return(
|
16
|
-
status: 200,
|
18
|
+
status: 200,
|
17
19
|
body: {
|
18
20
|
'value': [
|
19
21
|
{
|
@@ -22,7 +24,7 @@ class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
|
22
24
|
balance: 0
|
23
25
|
}
|
24
26
|
]
|
25
|
-
}.to_json
|
27
|
+
}.to_json
|
26
28
|
)
|
27
29
|
|
28
30
|
response = @customer_financial_detail.find_all
|
@@ -33,7 +35,7 @@ class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
|
33
35
|
test_id = '2'
|
34
36
|
stub_request(:get, /customerFinancialDetails\(#{test_id}\)/)
|
35
37
|
.to_return(
|
36
|
-
status: 200,
|
38
|
+
status: 200,
|
37
39
|
body: {
|
38
40
|
id: test_id,
|
39
41
|
number: 'N2',
|
@@ -49,7 +51,7 @@ class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
|
49
51
|
test_filter = "number eq 'N3'"
|
50
52
|
stub_request(:get, /customerFinancialDetails\?\$filter=#{test_filter}/)
|
51
53
|
.to_return(
|
52
|
-
status: 200,
|
54
|
+
status: 200,
|
53
55
|
body: {
|
54
56
|
'value': [
|
55
57
|
{
|
@@ -63,4 +65,4 @@ class BusinessCentral::Object::CustomerFinancialDetailTest < Minitest::Test
|
|
63
65
|
response = @customer_financial_detail.where(test_filter)
|
64
66
|
assert_equal response.first[:number], 'N3'
|
65
67
|
end
|
66
|
-
end
|
68
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
# rake test TEST=test/business_central/object/customer_payment_journal_test.rb
|
3
5
|
|
4
6
|
class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
@@ -11,7 +13,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
11
13
|
def test_find_all
|
12
14
|
stub_request(:get, /customerPaymentJournals/)
|
13
15
|
.to_return(
|
14
|
-
status: 200,
|
16
|
+
status: 200,
|
15
17
|
body: {
|
16
18
|
'value': [
|
17
19
|
{
|
@@ -20,7 +22,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
20
22
|
displayName: 'GENERAL 1'
|
21
23
|
}
|
22
24
|
]
|
23
|
-
}.to_json
|
25
|
+
}.to_json
|
24
26
|
)
|
25
27
|
|
26
28
|
response = @customer_payment_journal.find_all
|
@@ -31,7 +33,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
31
33
|
test_id = 2
|
32
34
|
stub_request(:get, /customerPaymentJournals\(#{test_id}\)/)
|
33
35
|
.to_return(
|
34
|
-
status: 200,
|
36
|
+
status: 200,
|
35
37
|
body: {
|
36
38
|
id: test_id,
|
37
39
|
code: 'GENERAL',
|
@@ -66,7 +68,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
66
68
|
def test_create
|
67
69
|
stub_request(:post, /customerPaymentJournals/)
|
68
70
|
.to_return(
|
69
|
-
status: 200,
|
71
|
+
status: 200,
|
70
72
|
body: {
|
71
73
|
id: 1,
|
72
74
|
code: 'GENERAL',
|
@@ -74,18 +76,17 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
74
76
|
}.to_json
|
75
77
|
)
|
76
78
|
|
77
|
-
response = @customer_payment_journal.create(
|
79
|
+
response = @customer_payment_journal.create(
|
78
80
|
display_name: 'GENERAL 4'
|
79
|
-
|
81
|
+
)
|
80
82
|
assert_equal response[:display_name], 'GENERAL 4'
|
81
83
|
end
|
82
84
|
|
83
|
-
|
84
85
|
def test_update
|
85
86
|
test_id = 2
|
86
87
|
stub_request(:get, /customerPaymentJournals\(#{test_id}\)/)
|
87
88
|
.to_return(
|
88
|
-
status: 200,
|
89
|
+
status: 200,
|
89
90
|
body: {
|
90
91
|
etag: '3333',
|
91
92
|
id: test_id,
|
@@ -96,7 +97,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
96
97
|
|
97
98
|
stub_request(:patch, /customerPaymentJournals\(#{test_id}\)/)
|
98
99
|
.to_return(
|
99
|
-
status: 200,
|
100
|
+
status: 200,
|
100
101
|
body: {
|
101
102
|
etag: '4444',
|
102
103
|
id: test_id,
|
@@ -107,9 +108,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
107
108
|
|
108
109
|
response = @customer_payment_journal.update(
|
109
110
|
test_id,
|
110
|
-
|
111
|
-
display_name: 'GENERAL 5'
|
112
|
-
}
|
111
|
+
display_name: 'GENERAL 5'
|
113
112
|
)
|
114
113
|
assert_equal response[:display_name], 'GENERAL 5'
|
115
114
|
end
|
@@ -118,7 +117,7 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
118
117
|
test_id = '33333'
|
119
118
|
stub_request(:get, /customerPaymentJournals\(#{test_id}\)/)
|
120
119
|
.to_return(
|
121
|
-
status: 200,
|
120
|
+
status: 200,
|
122
121
|
body: {
|
123
122
|
etag: '5555',
|
124
123
|
id: test_id,
|
@@ -132,4 +131,4 @@ class BusinessCentral::Object::CustomerPaymentJournalTest < Minitest::Test
|
|
132
131
|
|
133
132
|
assert @customer_payment_journal.destroy(test_id)
|
134
133
|
end
|
135
|
-
end
|
134
|
+
end
|