business-central 1.0.1 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +58 -15
  3. data/lib/business_central.rb +47 -2
  4. data/lib/business_central/client.rb +82 -39
  5. data/lib/business_central/exceptions.rb +30 -10
  6. data/lib/business_central/object/account.rb +4 -12
  7. data/lib/business_central/object/aged_account_payable.rb +4 -12
  8. data/lib/business_central/object/aged_account_receivable.rb +4 -12
  9. data/lib/business_central/object/argument_helper.rb +22 -0
  10. data/lib/business_central/object/attachment.rb +30 -0
  11. data/lib/business_central/object/balance_sheet.rb +4 -12
  12. data/lib/business_central/object/base.rb +100 -49
  13. data/lib/business_central/object/cash_flow_statement.rb +4 -12
  14. data/lib/business_central/object/company.rb +9 -2
  15. data/lib/business_central/object/company_information.rb +7 -15
  16. data/lib/business_central/object/country_region.rb +26 -0
  17. data/lib/business_central/object/currency.rb +29 -0
  18. data/lib/business_central/object/customer.rb +34 -0
  19. data/lib/business_central/object/customer_financial_detail.rb +13 -0
  20. data/lib/business_central/object/customer_payment.rb +43 -0
  21. data/lib/business_central/object/customer_payment_journal.rb +25 -0
  22. data/lib/business_central/object/customer_sale.rb +13 -0
  23. data/lib/business_central/object/default_dimension.rb +51 -0
  24. data/lib/business_central/object/dimension.rb +20 -0
  25. data/lib/business_central/object/dimension_line.rb +37 -0
  26. data/lib/business_central/object/dimension_value.rb +28 -0
  27. data/lib/business_central/object/employee.rb +21 -0
  28. data/lib/business_central/object/filter_query.rb +18 -0
  29. data/lib/business_central/object/general_ledger_entry.rb +13 -0
  30. data/lib/business_central/object/income_statement.rb +13 -0
  31. data/lib/business_central/object/irs1099_code.rb +16 -0
  32. data/lib/business_central/object/item.rb +16 -19
  33. data/lib/business_central/object/item_category.rb +16 -0
  34. data/lib/business_central/object/journal.rb +29 -0
  35. data/lib/business_central/object/journal_line.rb +48 -0
  36. data/lib/business_central/object/object_helper.rb +49 -0
  37. data/lib/business_central/object/payment_method.rb +16 -0
  38. data/lib/business_central/object/payment_term.rb +16 -0
  39. data/lib/business_central/object/picture.rb +53 -0
  40. data/lib/business_central/object/purchase_invoice.rb +8 -16
  41. data/lib/business_central/object/purchase_invoice_line.rb +14 -18
  42. data/lib/business_central/object/request.rb +61 -50
  43. data/lib/business_central/object/response.rb +31 -23
  44. data/lib/business_central/object/retained_earning_statement.rb +13 -0
  45. data/lib/business_central/object/sales_credit_memo.rb +20 -0
  46. data/lib/business_central/object/sales_credit_memo_line.rb +30 -0
  47. data/lib/business_central/object/sales_invoice.rb +62 -0
  48. data/lib/business_central/object/sales_invoice_line.rb +30 -0
  49. data/lib/business_central/object/sales_order.rb +20 -0
  50. data/lib/business_central/object/sales_order_line.rb +30 -0
  51. data/lib/business_central/object/sales_quote.rb +20 -0
  52. data/lib/business_central/object/sales_quote_line.rb +30 -0
  53. data/lib/business_central/object/shipment_method.rb +16 -0
  54. data/lib/business_central/object/subscription.rb +16 -0
  55. data/lib/business_central/object/tax_area.rb +16 -0
  56. data/lib/business_central/object/tax_group.rb +16 -0
  57. data/lib/business_central/object/time_registration_entry.rb +16 -0
  58. data/lib/business_central/object/trial_balance.rb +13 -0
  59. data/lib/business_central/object/units_of_measure.rb +16 -0
  60. data/lib/business_central/object/url_builder.rb +59 -0
  61. data/lib/business_central/object/url_helper.rb +44 -0
  62. data/lib/business_central/object/validation.rb +10 -7
  63. data/lib/business_central/object/vendor.rb +12 -15
  64. data/lib/business_central/object/vendor_purchase.rb +13 -0
  65. data/lib/business_central/version.rb +4 -2
  66. data/lib/business_central/web_service.rb +78 -0
  67. data/lib/core_ext/string.rb +18 -12
  68. data/test/business_central/client_test.rb +49 -7
  69. data/test/business_central/object/account_test.rb +6 -5
  70. data/test/business_central/object/aged_account_payable_test.rb +6 -5
  71. data/test/business_central/object/aged_account_receivable_test.rb +6 -5
  72. data/test/business_central/object/attachment_test.rb +117 -0
  73. data/test/business_central/object/balance_sheet_test.rb +6 -5
  74. data/test/business_central/object/base_test.rb +41 -0
  75. data/test/business_central/object/cash_flow_statement_test.rb +6 -5
  76. data/test/business_central/object/company_information_test.rb +9 -10
  77. data/test/business_central/object/company_test.rb +6 -5
  78. data/test/business_central/object/country_region_test.rb +129 -0
  79. data/test/business_central/object/currency_test.rb +150 -0
  80. data/test/business_central/object/customer_financial_detail_test.rb +68 -0
  81. data/test/business_central/object/customer_payment_journal_test.rb +134 -0
  82. data/test/business_central/object/customer_payment_test.rb +141 -0
  83. data/test/business_central/object/customer_sale_test.rb +72 -0
  84. data/test/business_central/object/customer_test.rb +168 -0
  85. data/test/business_central/object/default_dimension_test.rb +170 -0
  86. data/test/business_central/object/dimension_line_test.rb +165 -0
  87. data/test/business_central/object/dimension_test.rb +65 -0
  88. data/test/business_central/object/dimension_value_test.rb +68 -0
  89. data/test/business_central/object/employee_test.rb +141 -0
  90. data/test/business_central/object/filter_query_test.rb +36 -0
  91. data/test/business_central/object/general_ledger_entry_test.rb +82 -0
  92. data/test/business_central/object/income_statement_test.rb +82 -0
  93. data/test/business_central/object/irs1099_code_test.rb +124 -0
  94. data/test/business_central/object/item_category_test.rb +122 -0
  95. data/test/business_central/object/item_test.rb +16 -17
  96. data/test/business_central/object/journal_line_test.rb +152 -0
  97. data/test/business_central/object/journal_test.rb +144 -0
  98. data/test/business_central/object/payment_method_test.rb +134 -0
  99. data/test/business_central/object/payment_term_test.rb +134 -0
  100. data/test/business_central/object/picture_test.rb +74 -0
  101. data/test/business_central/object/purchase_invoice_line_test.rb +15 -15
  102. data/test/business_central/object/purchase_invoice_test.rb +15 -15
  103. data/test/business_central/object/request_test.rb +75 -12
  104. data/test/business_central/object/response_test.rb +34 -9
  105. data/test/business_central/object/retained_earning_statement_test.rb +52 -0
  106. data/test/business_central/object/sales_credit_memo_line_test.rb +134 -0
  107. data/test/business_central/object/sales_credit_memo_test.rb +146 -0
  108. data/test/business_central/object/sales_invoice_line_test.rb +164 -0
  109. data/test/business_central/object/sales_invoice_test.rb +156 -0
  110. data/test/business_central/object/sales_order_line_test.rb +134 -0
  111. data/test/business_central/object/sales_order_test.rb +146 -0
  112. data/test/business_central/object/sales_quote_line_test.rb +134 -0
  113. data/test/business_central/object/sales_quote_test.rb +146 -0
  114. data/test/business_central/object/shipment_method_test.rb +133 -0
  115. data/test/business_central/object/subscription_test.rb +126 -0
  116. data/test/business_central/object/tax_area_test.rb +126 -0
  117. data/test/business_central/object/tax_group_test.rb +126 -0
  118. data/test/business_central/object/time_registration_entry_test.rb +126 -0
  119. data/test/business_central/object/trial_balance_test.rb +82 -0
  120. data/test/business_central/object/units_of_measure_test.rb +126 -0
  121. data/test/business_central/object/validation_test.rb +5 -4
  122. data/test/business_central/object/vendor_purchase_test.rb +82 -0
  123. data/test/business_central/object/vendor_test.rb +16 -16
  124. data/test/business_central/web_service_test.rb +100 -0
  125. data/test/business_central_test.rb +3 -1
  126. data/test/test_helper.rb +16 -6
  127. metadata +188 -37
  128. data/lib/business_central/object/helper.rb +0 -15
@@ -0,0 +1,152 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+ # rake test TEST=test/business_central/object/journal_line_test.rb
5
+
6
+ class BusinessCentral::Object::JournalLineTest < Minitest::Test
7
+ def setup
8
+ @company_id = '123456'
9
+ @client = BusinessCentral::Client.new
10
+ @journal_line = @client.journal_line(
11
+ company_id: @company_id,
12
+ parent: 'journals',
13
+ parent_id: '123'
14
+ )
15
+ end
16
+
17
+ def test_invalid_journal_line_parent
18
+ assert_raises(BusinessCentral::InvalidArgumentException) do
19
+ @client.journal_line(
20
+ company_id: @company_id,
21
+ parent: 'something that doesnt exist',
22
+ parent_id: '1'
23
+ )
24
+ end
25
+ end
26
+
27
+ def test_find_all
28
+ stub_request(:get, %r{journals\(\d+\)\/journalLines})
29
+ .to_return(
30
+ status: 200,
31
+ body: {
32
+ 'value': [
33
+ {
34
+ journalDisplayName: 'journal1',
35
+ lineNumber: 1000,
36
+ description: 'journalLine1'
37
+ }
38
+ ]
39
+ }.to_json
40
+ )
41
+
42
+ response = @journal_line.find_all
43
+ assert_equal response.first[:description], 'journalLine1'
44
+ end
45
+
46
+ def test_find_by_id
47
+ test_id = '2'
48
+ stub_request(:get, %r{journals\(\d+\)\/journalLines\(#{test_id}\)})
49
+ .to_return(
50
+ status: 200,
51
+ body: {
52
+ id: test_id,
53
+ journalDisplayName: 'journal1',
54
+ lineNumber: 2000,
55
+ description: 'journalLine2'
56
+ }.to_json
57
+ )
58
+
59
+ response = @journal_line.find_by_id(test_id)
60
+ assert_equal response[:description], 'journalLine2'
61
+ end
62
+
63
+ def test_where
64
+ test_filter = "description eq 'journalLine3'"
65
+ stub_request(:get, %r{journals\(\d+\)\/journalLines\?\$filter=#{test_filter}})
66
+ .to_return(
67
+ status: 200,
68
+ body: {
69
+ 'value': [
70
+ {
71
+ id: 3,
72
+ journalDisplayName: 'journal1',
73
+ lineNumber: 3000,
74
+ description: 'journalLine3'
75
+ }
76
+ ]
77
+ }.to_json
78
+ )
79
+
80
+ response = @journal_line.where(test_filter)
81
+ assert_equal response.first[:description], 'journalLine3'
82
+ end
83
+
84
+ def test_create
85
+ stub_request(:post, %r{journals\(\d+\)\/journalLines})
86
+ .to_return(
87
+ status: 200,
88
+ body: {
89
+ id: 4,
90
+ journalDisplayName: 'journal1',
91
+ lineNumber: 4000,
92
+ description: 'journalLine4'
93
+ }.to_json
94
+ )
95
+
96
+ response = @journal_line.create(
97
+ description: 'journalLine4'
98
+ )
99
+ assert_equal response[:id], 4
100
+ end
101
+
102
+ def test_update
103
+ test_id = '2'
104
+ stub_request(:get, %r{journals\(\d+\)\/journalLines\(#{test_id}\)})
105
+ .to_return(
106
+ status: 200,
107
+ body: {
108
+ etag: '3333',
109
+ id: test_id,
110
+ journalDisplayName: 'journal1',
111
+ lineNumber: 4000,
112
+ description: 'journalLine4'
113
+ }.to_json
114
+ )
115
+
116
+ stub_request(:patch, %r{journals\(\d+\)\/journalLines\(#{test_id}\)})
117
+ .to_return(
118
+ status: 200,
119
+ body: {
120
+ etag: '4444',
121
+ id: test_id,
122
+ lineNumber: 4000,
123
+ description: 'journalLine5'
124
+ }.to_json
125
+ )
126
+
127
+ response = @journal_line.update(
128
+ test_id,
129
+ description: 'journalLine5'
130
+ )
131
+ assert_equal response[:description], 'journalLine5'
132
+ end
133
+
134
+ def test_delete
135
+ test_id = '33333'
136
+ stub_request(:get, %r{journals\(\d+\)\/journalLines\(#{test_id}\)})
137
+ .to_return(
138
+ status: 200,
139
+ body: {
140
+ etag: '5555',
141
+ id: test_id,
142
+ lineNumber: 5000,
143
+ description: 'journalLine5'
144
+ }.to_json
145
+ )
146
+
147
+ stub_request(:delete, %r{journals\(\d+\)\/journalLines\(#{test_id}\)})
148
+ .to_return(status: 204)
149
+
150
+ assert @journal_line.destroy(test_id)
151
+ end
152
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+ # rake test TEST=test/business_central/object/journal_test.rb
5
+
6
+ class BusinessCentral::Object::JournalTest < Minitest::Test
7
+ def setup
8
+ @company_id = '123456'
9
+ @client = BusinessCentral::Client.new
10
+ @journal = @client.journal(company_id: @company_id)
11
+ end
12
+
13
+ def test_find_all
14
+ stub_request(:get, /journals/)
15
+ .to_return(
16
+ status: 200,
17
+ body: {
18
+ 'value': [
19
+ {
20
+ code: '123',
21
+ displayName: 'journal1'
22
+ }
23
+ ]
24
+ }.to_json
25
+ )
26
+
27
+ response = @journal.find_all
28
+ assert_equal response.first[:display_name], 'journal1'
29
+ end
30
+
31
+ def test_find_by_id
32
+ test_journal_id = '09876'
33
+ stub_request(:get, /journals\(#{test_journal_id}\)/)
34
+ .to_return(
35
+ status: 200,
36
+ body: {
37
+ code: '123',
38
+ displayName: 'journal1'
39
+ }.to_json
40
+ )
41
+
42
+ response = @journal.find_by_id(test_journal_id)
43
+ assert_equal response[:display_name], 'journal1'
44
+ end
45
+
46
+ def test_where
47
+ test_filter = "displayName eq 'journal2'"
48
+ stub_request(:get, /journals\?\$filter=#{test_filter}/)
49
+ .to_return(
50
+ status: 200,
51
+ body: {
52
+ 'value': [
53
+ {
54
+ code: '456',
55
+ displayName: 'journal2'
56
+ }
57
+ ]
58
+ }.to_json
59
+ )
60
+
61
+ response = @journal.where(test_filter)
62
+ assert_equal response.first[:display_name], 'journal2'
63
+ end
64
+
65
+ def test_create
66
+ stub_request(:post, /journals/)
67
+ .to_return(
68
+ status: 200,
69
+ body: {
70
+ code: '789',
71
+ displayName: 'journal3'
72
+ }.to_json
73
+ )
74
+
75
+ response = @journal.create(
76
+ code: '789',
77
+ display_name: 'journal3'
78
+ )
79
+ assert_equal response[:display_name], 'journal3'
80
+ end
81
+
82
+ def test_update
83
+ test_journal_id = '011123'
84
+ stub_request(:get, /journals\(#{test_journal_id}\)/)
85
+ .to_return(
86
+ status: 200,
87
+ body: {
88
+ etag: '112',
89
+ displayName: 'journal4'
90
+ }.to_json
91
+ )
92
+
93
+ stub_request(:patch, /journals\(#{test_journal_id}\)/)
94
+ .to_return(
95
+ status: 200,
96
+ body: {
97
+ displayName: 'journal5'
98
+ }.to_json
99
+ )
100
+
101
+ response = @journal.update(
102
+ test_journal_id,
103
+ display_name: 'journal5'
104
+ )
105
+ assert_equal response[:display_name], 'journal5'
106
+ end
107
+
108
+ def test_delete
109
+ test_journal_id = '0111245'
110
+ stub_request(:get, /journals\(#{test_journal_id}\)/)
111
+ .to_return(
112
+ status: 200,
113
+ body: {
114
+ etag: '113',
115
+ displayName: 'journal6'
116
+ }.to_json
117
+ )
118
+
119
+ stub_request(:delete, /journals\(#{test_journal_id}\)/)
120
+ .to_return(status: 204)
121
+
122
+ assert @journal.destroy(test_journal_id)
123
+ end
124
+
125
+ def test_line_navigation
126
+ stub_request(:get, %r{journals\(\d+\)\/journalLines})
127
+ .to_return(
128
+ status: 200,
129
+ body: {
130
+ 'value': [
131
+ {
132
+ journalDisplayName: 'journal1',
133
+ lineNumber: 1000,
134
+ description: 'journalLine1'
135
+ }
136
+ ]
137
+ }.to_json
138
+ )
139
+
140
+ response = @client.journal(company_id: @company_id, id: '123')
141
+ .journal_line.find_all
142
+ assert_equal response.first[:line_number], 1000
143
+ end
144
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+ # rake test TEST=test/business_central/object/payment_method_test.rb
5
+
6
+ class BusinessCentral::Object::PaymentMethodTest < Minitest::Test
7
+ def setup
8
+ @company_id = '123456'
9
+ @client = BusinessCentral::Client.new
10
+ @payment_method = @client.payment_method(company_id: @company_id)
11
+ end
12
+
13
+ def test_find_all
14
+ stub_request(:get, /paymentMethods/)
15
+ .to_return(
16
+ status: 200,
17
+ body: {
18
+ 'value': [
19
+ {
20
+ id: 1,
21
+ code: 'PM1',
22
+ displayName: 'paymentMethod1'
23
+ }
24
+ ]
25
+ }.to_json
26
+ )
27
+
28
+ response = @payment_method.find_all
29
+ assert_equal response.first[:display_name], 'paymentMethod1'
30
+ end
31
+
32
+ def test_find_by_id
33
+ test_id = '09876'
34
+ stub_request(:get, /paymentMethods\(#{test_id}\)/)
35
+ .to_return(
36
+ status: 200,
37
+ body: {
38
+ id: test_id,
39
+ code: 'PM2',
40
+ displayName: 'paymentMethod2'
41
+ }.to_json
42
+ )
43
+
44
+ response = @payment_method.find_by_id(test_id)
45
+ assert_equal response[:display_name], 'paymentMethod2'
46
+ end
47
+
48
+ def test_where
49
+ test_filter = "displayName eq 'paymentMethod3'"
50
+ stub_request(:get, /paymentMethods\?\$filter=#{test_filter}/)
51
+ .to_return(
52
+ status: 200,
53
+ body: {
54
+ 'value': [
55
+ {
56
+ id: 3,
57
+ code: 'PM3',
58
+ displayName: 'paymentMethod3'
59
+ }
60
+ ]
61
+ }.to_json
62
+ )
63
+
64
+ response = @payment_method.where(test_filter)
65
+ assert_equal response.first[:display_name], 'paymentMethod3'
66
+ end
67
+
68
+ def test_create
69
+ stub_request(:post, /paymentMethods/)
70
+ .to_return(
71
+ status: 200,
72
+ body: {
73
+ id: 4,
74
+ code: 'PM4',
75
+ displayName: 'paymentMethod4'
76
+ }.to_json
77
+ )
78
+
79
+ response = @payment_method.create(
80
+ code: 'PM4',
81
+ display_name: 'paymentMethod4'
82
+ )
83
+ assert_equal response[:display_name], 'paymentMethod4'
84
+ end
85
+
86
+ def test_update
87
+ test_id = '011123'
88
+ stub_request(:get, /paymentMethods\(#{test_id}\)/)
89
+ .to_return(
90
+ status: 200,
91
+ body: {
92
+ etag: '112',
93
+ id: test_id,
94
+ code: 'PM5',
95
+ displayName: 'paymentMethod5'
96
+ }.to_json
97
+ )
98
+
99
+ stub_request(:patch, /paymentMethods\(#{test_id}\)/)
100
+ .to_return(
101
+ status: 200,
102
+ body: {
103
+ id: test_id,
104
+ code: 'PM6',
105
+ displayName: 'paymentMethod6'
106
+ }.to_json
107
+ )
108
+
109
+ response = @payment_method.update(
110
+ test_id,
111
+ code: 'PM6',
112
+ display_name: 'paymentMethod6'
113
+ )
114
+ assert_equal response[:display_name], 'paymentMethod6'
115
+ end
116
+
117
+ def test_delete
118
+ test_id = '0111245'
119
+ stub_request(:get, /paymentMethods\(#{test_id}\)/)
120
+ .to_return(
121
+ status: 200,
122
+ body: {
123
+ etag: '113',
124
+ code: 'PM7',
125
+ displayName: 'paymentMethod7'
126
+ }.to_json
127
+ )
128
+
129
+ stub_request(:delete, /paymentMethods\(#{test_id}\)/)
130
+ .to_return(status: 204)
131
+
132
+ assert @payment_method.destroy(test_id)
133
+ end
134
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+ # rake test TEST=test/business_central/object/payment_term_test.rb
5
+
6
+ class BusinessCentral::Object::PaymentTermTest < Minitest::Test
7
+ def setup
8
+ @company_id = '123456'
9
+ @client = BusinessCentral::Client.new
10
+ @payment_term = @client.payment_term(company_id: @company_id)
11
+ end
12
+
13
+ def test_find_all
14
+ stub_request(:get, /paymentTerms/)
15
+ .to_return(
16
+ status: 200,
17
+ body: {
18
+ 'value': [
19
+ {
20
+ id: 1,
21
+ code: 'PM1',
22
+ displayName: 'paymentTerm1'
23
+ }
24
+ ]
25
+ }.to_json
26
+ )
27
+
28
+ response = @payment_term.find_all
29
+ assert_equal response.first[:display_name], 'paymentTerm1'
30
+ end
31
+
32
+ def test_find_by_id
33
+ test_id = '09876'
34
+ stub_request(:get, /paymentTerms\(#{test_id}\)/)
35
+ .to_return(
36
+ status: 200,
37
+ body: {
38
+ id: test_id,
39
+ code: 'PM2',
40
+ displayName: 'paymentTerm2'
41
+ }.to_json
42
+ )
43
+
44
+ response = @payment_term.find_by_id(test_id)
45
+ assert_equal response[:display_name], 'paymentTerm2'
46
+ end
47
+
48
+ def test_where
49
+ test_filter = "displayName eq 'paymentTerm3'"
50
+ stub_request(:get, /paymentTerms\?\$filter=#{test_filter}/)
51
+ .to_return(
52
+ status: 200,
53
+ body: {
54
+ 'value': [
55
+ {
56
+ id: 3,
57
+ code: 'PM3',
58
+ displayName: 'paymentTerm3'
59
+ }
60
+ ]
61
+ }.to_json
62
+ )
63
+
64
+ response = @payment_term.where(test_filter)
65
+ assert_equal response.first[:display_name], 'paymentTerm3'
66
+ end
67
+
68
+ def test_create
69
+ stub_request(:post, /paymentTerms/)
70
+ .to_return(
71
+ status: 200,
72
+ body: {
73
+ id: 4,
74
+ code: 'PM4',
75
+ displayName: 'paymentTerm4'
76
+ }.to_json
77
+ )
78
+
79
+ response = @payment_term.create(
80
+ code: 'PM4',
81
+ display_name: 'paymentTerm4'
82
+ )
83
+ assert_equal response[:display_name], 'paymentTerm4'
84
+ end
85
+
86
+ def test_update
87
+ test_id = '011123'
88
+ stub_request(:get, /paymentTerms\(#{test_id}\)/)
89
+ .to_return(
90
+ status: 200,
91
+ body: {
92
+ etag: '112',
93
+ id: test_id,
94
+ code: 'PM5',
95
+ displayName: 'paymentTerm5'
96
+ }.to_json
97
+ )
98
+
99
+ stub_request(:patch, /paymentTerms\(#{test_id}\)/)
100
+ .to_return(
101
+ status: 200,
102
+ body: {
103
+ id: test_id,
104
+ code: 'PM6',
105
+ displayName: 'paymentTerm6'
106
+ }.to_json
107
+ )
108
+
109
+ response = @payment_term.update(
110
+ test_id,
111
+ code: 'PM6',
112
+ display_name: 'paymentTerm6'
113
+ )
114
+ assert_equal response[:display_name], 'paymentTerm6'
115
+ end
116
+
117
+ def test_delete
118
+ test_id = '0111245'
119
+ stub_request(:get, /paymentTerms\(#{test_id}\)/)
120
+ .to_return(
121
+ status: 200,
122
+ body: {
123
+ etag: '113',
124
+ code: 'PM7',
125
+ displayName: 'paymentTerm6'
126
+ }.to_json
127
+ )
128
+
129
+ stub_request(:delete, /paymentTerms\(#{test_id}\)/)
130
+ .to_return(status: 204)
131
+
132
+ assert @payment_term.destroy(test_id)
133
+ end
134
+ end