business-central 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +58 -15
  3. data/lib/business_central.rb +4 -0
  4. data/lib/business_central/client.rb +5 -3
  5. data/lib/business_central/object/attachment.rb +30 -0
  6. data/lib/business_central/object/customer.rb +1 -0
  7. data/lib/business_central/object/default_dimension.rb +1 -1
  8. data/lib/business_central/object/general_ledger_entry.rb +13 -0
  9. data/lib/business_central/object/income_statement.rb +13 -0
  10. data/lib/business_central/object/irs1099_code.rb +16 -0
  11. data/lib/business_central/object/journal_line.rb +1 -1
  12. data/lib/business_central/object/picture.rb +1 -1
  13. data/lib/business_central/object/sales_credit_memo_line.rb +1 -1
  14. data/lib/business_central/object/sales_invoice_line.rb +1 -1
  15. data/lib/business_central/object/sales_order_line.rb +1 -1
  16. data/lib/business_central/object/sales_quote_line.rb +1 -1
  17. data/lib/business_central/version.rb +1 -1
  18. data/test/business_central/object/attachment_test.rb +117 -0
  19. data/test/business_central/object/customer_test.rb +44 -0
  20. data/test/business_central/object/general_ledger_entry_test.rb +82 -0
  21. data/test/business_central/object/income_statement_test.rb +82 -0
  22. data/test/business_central/object/irs1099_code_test.rb +124 -0
  23. data/test/business_central/object/journal_line_test.rb +8 -8
  24. data/test/business_central/object/journal_test.rb +20 -0
  25. data/test/business_central/object/sales_credit_memo_line_test.rb +8 -8
  26. data/test/business_central/object/sales_credit_memo_test.rb +1 -1
  27. data/test/business_central/object/sales_invoice_line_test.rb +8 -8
  28. data/test/business_central/object/sales_invoice_test.rb +22 -0
  29. data/test/business_central/object/sales_order_line_test.rb +8 -8
  30. data/test/business_central/object/sales_order_test.rb +1 -1
  31. data/test/business_central/object/sales_quote_line_test.rb +8 -8
  32. data/test/business_central/object/sales_quote_test.rb +1 -1
  33. metadata +18 -6
@@ -125,7 +125,7 @@ class BusinessCentral::Object::SalesCreditMemoTest < Minitest::Test
125
125
  end
126
126
 
127
127
  def test_line_navigation
128
- stub_request(:get, /salesCreditMemoLines/)
128
+ stub_request(:get, %r{salesCreditMemos\(\d+\)\/salesCreditMemoLine})
129
129
  .to_return(
130
130
  status: 200,
131
131
  body: {
@@ -24,7 +24,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
24
24
  end
25
25
 
26
26
  def test_find_all
27
- stub_request(:get, /salesInvoiceLines/)
27
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines})
28
28
  .to_return(
29
29
  status: 200,
30
30
  body: {
@@ -46,7 +46,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
46
46
 
47
47
  def test_find_by_id
48
48
  test_id = '2'
49
- stub_request(:get, /salesInvoiceLines\(#{test_id}\)/)
49
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines\(#{test_id}\)})
50
50
  .to_return(
51
51
  status: 200,
52
52
  body: {
@@ -64,7 +64,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
64
64
 
65
65
  def test_where
66
66
  test_filter = "description eq 'salesInvoiceLine3'"
67
- stub_request(:get, /salesInvoiceLines\?\$filter=#{test_filter}/)
67
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines\?\$filter=#{test_filter}})
68
68
  .to_return(
69
69
  status: 200,
70
70
  body: {
@@ -85,7 +85,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
85
85
  end
86
86
 
87
87
  def test_create
88
- stub_request(:post, /salesInvoiceLines/)
88
+ stub_request(:post, %r{salesInvoices\(\d+\)\/salesInvoiceLines})
89
89
  .to_return(
90
90
  status: 200,
91
91
  body: {
@@ -108,7 +108,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
108
108
 
109
109
  def test_update
110
110
  test_id = '2'
111
- stub_request(:get, /salesInvoiceLines\(#{test_id}\)/)
111
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines\(#{test_id}\)})
112
112
  .to_return(
113
113
  status: 200,
114
114
  body: {
@@ -121,7 +121,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
121
121
  }.to_json
122
122
  )
123
123
 
124
- stub_request(:patch, /salesInvoiceLines\(#{test_id}\)/)
124
+ stub_request(:patch, %r{salesInvoices\(\d+\)\/salesInvoiceLines\(#{test_id}\)})
125
125
  .to_return(
126
126
  status: 200,
127
127
  body: {
@@ -143,7 +143,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
143
143
 
144
144
  def test_delete
145
145
  test_id = '33333'
146
- stub_request(:get, /salesInvoiceLines\(#{test_id}\)/)
146
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines\(#{test_id}\)})
147
147
  .to_return(
148
148
  status: 200,
149
149
  body: {
@@ -156,7 +156,7 @@ class BusinessCentral::Object::SalesInvoiceLineTest < Minitest::Test
156
156
  }.to_json
157
157
  )
158
158
 
159
- stub_request(:delete, /salesInvoiceLines\(#{test_id}\)/)
159
+ stub_request(:delete, %r{salesInvoices\(\d+\)\/salesInvoiceLines\(#{test_id}\)})
160
160
  .to_return(status: 204)
161
161
 
162
162
  assert @sales_invoice_line.destroy(test_id)
@@ -131,4 +131,26 @@ class BusinessCentral::Object::SalesInvoiceTest < Minitest::Test
131
131
 
132
132
  assert @sales_invoice.destroy(test_id)
133
133
  end
134
+
135
+ def test_line_navigation
136
+ stub_request(:get, %r{salesInvoices\(\d+\)\/salesInvoiceLines})
137
+ .to_return(
138
+ status: 200,
139
+ body: {
140
+ 'value': [
141
+ {
142
+ id: '123',
143
+ documentId: 5,
144
+ sequence: 10_000,
145
+ itemId: 5,
146
+ description: 'salesInvoiceLine1'
147
+ }
148
+ ]
149
+ }.to_json
150
+ )
151
+
152
+ response = @client.sales_invoice(company_id: @company_id, id: '123')
153
+ .sales_invoice_line.find_all
154
+ assert_equal response.first[:description], 'salesInvoiceLine1'
155
+ end
134
156
  end
@@ -15,7 +15,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
15
15
  end
16
16
 
17
17
  def test_find_all
18
- stub_request(:get, /salesOrderLines/)
18
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines})
19
19
  .to_return(
20
20
  status: 200,
21
21
  body: {
@@ -35,7 +35,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
35
35
 
36
36
  def test_find_by_id
37
37
  test_id = '09876'
38
- stub_request(:get, /salesOrderLines\(#{test_id}\)/)
38
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines\(#{test_id}\)})
39
39
  .to_return(
40
40
  status: 200,
41
41
  body: {
@@ -51,7 +51,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
51
51
 
52
52
  def test_where
53
53
  test_filter = "sequence eq '1020'"
54
- stub_request(:get, /salesOrderLines\?\$filter=#{test_filter}/)
54
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines\?\$filter=#{test_filter}})
55
55
  .to_return(
56
56
  status: 200,
57
57
  body: {
@@ -69,7 +69,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
69
69
  end
70
70
 
71
71
  def test_create
72
- stub_request(:post, /salesOrderLines/)
72
+ stub_request(:post, %r{salesOrders\(\d+\)\/salesOrderLines})
73
73
  .to_return(
74
74
  status: 200,
75
75
  body: {
@@ -86,7 +86,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
86
86
 
87
87
  def test_update
88
88
  test_id = '011123'
89
- stub_request(:get, /salesOrderLines\(#{test_id}\)/)
89
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines\(#{test_id}\)})
90
90
  .to_return(
91
91
  status: 200,
92
92
  body: {
@@ -97,7 +97,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
97
97
  }.to_json
98
98
  )
99
99
 
100
- stub_request(:patch, /salesOrderLines\(#{test_id}\)/)
100
+ stub_request(:patch, %r{salesOrders\(\d+\)\/salesOrderLines\(#{test_id}\)})
101
101
  .to_return(
102
102
  status: 200,
103
103
  body: {
@@ -116,7 +116,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
116
116
 
117
117
  def test_delete
118
118
  test_id = '0111245'
119
- stub_request(:get, /salesOrderLines\(#{test_id}\)/)
119
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines\(#{test_id}\)})
120
120
  .to_return(
121
121
  status: 200,
122
122
  body: {
@@ -126,7 +126,7 @@ class BusinessCentral::Object::SalesOrderLineTest < Minitest::Test
126
126
  }.to_json
127
127
  )
128
128
 
129
- stub_request(:delete, /salesOrderLines\(#{test_id}\)/)
129
+ stub_request(:delete, %r{salesOrders\(\d+\)\/salesOrderLines\(#{test_id}\)})
130
130
  .to_return(status: 204)
131
131
 
132
132
  assert @sales_order_line.destroy(test_id)
@@ -125,7 +125,7 @@ class BusinessCentral::Object::SalesOrderTest < Minitest::Test
125
125
  end
126
126
 
127
127
  def test_line_navigation
128
- stub_request(:get, /salesOrderLines/)
128
+ stub_request(:get, %r{salesOrders\(\d+\)\/salesOrderLines})
129
129
  .to_return(
130
130
  status: 200,
131
131
  body: {
@@ -15,7 +15,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
15
15
  end
16
16
 
17
17
  def test_find_all
18
- stub_request(:get, /salesQuoteLines/)
18
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines})
19
19
  .to_return(
20
20
  status: 200,
21
21
  body: {
@@ -35,7 +35,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
35
35
 
36
36
  def test_find_by_id
37
37
  test_id = '09876'
38
- stub_request(:get, /salesQuoteLines\(#{test_id}\)/)
38
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines\(#{test_id}\)})
39
39
  .to_return(
40
40
  status: 200,
41
41
  body: {
@@ -51,7 +51,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
51
51
 
52
52
  def test_where
53
53
  test_filter = "sequence eq '1020'"
54
- stub_request(:get, /salesQuoteLines\?\$filter=#{test_filter}/)
54
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines\?\$filter=#{test_filter}})
55
55
  .to_return(
56
56
  status: 200,
57
57
  body: {
@@ -69,7 +69,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
69
69
  end
70
70
 
71
71
  def test_create
72
- stub_request(:post, /salesQuoteLines/)
72
+ stub_request(:post, %r{salesQuotes\(\d+\)\/salesQuoteLines})
73
73
  .to_return(
74
74
  status: 200,
75
75
  body: {
@@ -86,7 +86,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
86
86
 
87
87
  def test_update
88
88
  test_id = '011123'
89
- stub_request(:get, /salesQuoteLines\(#{test_id}\)/)
89
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines\(#{test_id}\)})
90
90
  .to_return(
91
91
  status: 200,
92
92
  body: {
@@ -97,7 +97,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
97
97
  }.to_json
98
98
  )
99
99
 
100
- stub_request(:patch, /salesQuoteLines\(#{test_id}\)/)
100
+ stub_request(:patch, %r{salesQuotes\(\d+\)\/salesQuoteLines\(#{test_id}\)})
101
101
  .to_return(
102
102
  status: 200,
103
103
  body: {
@@ -116,7 +116,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
116
116
 
117
117
  def test_delete
118
118
  test_id = '0111245'
119
- stub_request(:get, /salesQuoteLines\(#{test_id}\)/)
119
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines\(#{test_id}\)})
120
120
  .to_return(
121
121
  status: 200,
122
122
  body: {
@@ -126,7 +126,7 @@ class BusinessCentral::Object::SalesQuoteLineTest < Minitest::Test
126
126
  }.to_json
127
127
  )
128
128
 
129
- stub_request(:delete, /salesQuoteLines\(#{test_id}\)/)
129
+ stub_request(:delete, %r{salesQuotes\(\d+\)\/salesQuoteLines\(#{test_id}\)})
130
130
  .to_return(status: 204)
131
131
 
132
132
  assert @sales_quote_line.destroy(test_id)
@@ -125,7 +125,7 @@ class BusinessCentral::Object::SalesQuoteTest < Minitest::Test
125
125
  end
126
126
 
127
127
  def test_line_navigation
128
- stub_request(:get, /salesQuoteLines/)
128
+ stub_request(:get, %r{salesQuotes\(\d+\)\/salesQuoteLines})
129
129
  .to_return(
130
130
  status: 200,
131
131
  body: {
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: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrad Muir
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.4'
139
- description:
139
+ description:
140
140
  email:
141
141
  - jarrads@live.com
142
142
  executables: []
@@ -152,6 +152,7 @@ files:
152
152
  - lib/business_central/object/aged_account_payable.rb
153
153
  - lib/business_central/object/aged_account_receivable.rb
154
154
  - lib/business_central/object/argument_helper.rb
155
+ - lib/business_central/object/attachment.rb
155
156
  - lib/business_central/object/balance_sheet.rb
156
157
  - lib/business_central/object/base.rb
157
158
  - lib/business_central/object/cash_flow_statement.rb
@@ -170,6 +171,9 @@ files:
170
171
  - lib/business_central/object/dimension_value.rb
171
172
  - lib/business_central/object/employee.rb
172
173
  - lib/business_central/object/filter_query.rb
174
+ - lib/business_central/object/general_ledger_entry.rb
175
+ - lib/business_central/object/income_statement.rb
176
+ - lib/business_central/object/irs1099_code.rb
173
177
  - lib/business_central/object/item.rb
174
178
  - lib/business_central/object/item_category.rb
175
179
  - lib/business_central/object/journal.rb
@@ -210,6 +214,7 @@ files:
210
214
  - test/business_central/object/account_test.rb
211
215
  - test/business_central/object/aged_account_payable_test.rb
212
216
  - test/business_central/object/aged_account_receivable_test.rb
217
+ - test/business_central/object/attachment_test.rb
213
218
  - test/business_central/object/balance_sheet_test.rb
214
219
  - test/business_central/object/base_test.rb
215
220
  - test/business_central/object/cash_flow_statement_test.rb
@@ -228,6 +233,9 @@ files:
228
233
  - test/business_central/object/dimension_value_test.rb
229
234
  - test/business_central/object/employee_test.rb
230
235
  - test/business_central/object/filter_query_test.rb
236
+ - test/business_central/object/general_ledger_entry_test.rb
237
+ - test/business_central/object/income_statement_test.rb
238
+ - test/business_central/object/irs1099_code_test.rb
231
239
  - test/business_central/object/item_category_test.rb
232
240
  - test/business_central/object/item_test.rb
233
241
  - test/business_central/object/journal_line_test.rb
@@ -267,7 +275,7 @@ licenses:
267
275
  metadata:
268
276
  source_code_uri: https://github.com/JDrizzy/business-central
269
277
  changelog_uri: https://github.com/JDrizzy/business-central/releases
270
- post_install_message:
278
+ post_install_message:
271
279
  rdoc_options: []
272
280
  require_paths:
273
281
  - lib
@@ -283,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
291
  version: '0'
284
292
  requirements: []
285
293
  rubygems_version: 3.0.8
286
- signing_key:
294
+ signing_key:
287
295
  specification_version: 4
288
296
  summary: Integration library for Microsoft Dynamic365 business central
289
297
  test_files:
@@ -291,6 +299,7 @@ test_files:
291
299
  - test/business_central/object/account_test.rb
292
300
  - test/business_central/object/aged_account_payable_test.rb
293
301
  - test/business_central/object/aged_account_receivable_test.rb
302
+ - test/business_central/object/attachment_test.rb
294
303
  - test/business_central/object/balance_sheet_test.rb
295
304
  - test/business_central/object/base_test.rb
296
305
  - test/business_central/object/cash_flow_statement_test.rb
@@ -309,6 +318,9 @@ test_files:
309
318
  - test/business_central/object/dimension_value_test.rb
310
319
  - test/business_central/object/employee_test.rb
311
320
  - test/business_central/object/filter_query_test.rb
321
+ - test/business_central/object/general_ledger_entry_test.rb
322
+ - test/business_central/object/income_statement_test.rb
323
+ - test/business_central/object/irs1099_code_test.rb
312
324
  - test/business_central/object/item_category_test.rb
313
325
  - test/business_central/object/item_test.rb
314
326
  - test/business_central/object/journal_line_test.rb