xeroizer 2.17.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +246 -213
  3. data/lib/xeroizer/connection.rb +49 -0
  4. data/lib/xeroizer/exceptions.rb +4 -0
  5. data/lib/xeroizer/generic_application.rb +13 -5
  6. data/lib/xeroizer/http.rb +7 -80
  7. data/lib/xeroizer/http_response.rb +154 -0
  8. data/lib/xeroizer/models/bank_account.rb +1 -0
  9. data/lib/xeroizer/models/bank_transaction.rb +1 -0
  10. data/lib/xeroizer/models/batch_payment.rb +27 -0
  11. data/lib/xeroizer/models/branding_theme.rb +49 -9
  12. data/lib/xeroizer/models/contact.rb +12 -6
  13. data/lib/xeroizer/models/contact_group.rb +45 -0
  14. data/lib/xeroizer/models/credit_note.rb +24 -22
  15. data/lib/xeroizer/models/currency.rb +14 -2
  16. data/lib/xeroizer/models/from_bank_account.rb +1 -0
  17. data/lib/xeroizer/models/history_record.rb +72 -0
  18. data/lib/xeroizer/models/invoice.rb +17 -3
  19. data/lib/xeroizer/models/item.rb +2 -1
  20. data/lib/xeroizer/models/item_purchase_details.rb +1 -1
  21. data/lib/xeroizer/models/line_item.rb +17 -5
  22. data/lib/xeroizer/models/manual_journal.rb +2 -1
  23. data/lib/xeroizer/models/online_invoice.rb +37 -0
  24. data/lib/xeroizer/models/option.rb +1 -1
  25. data/lib/xeroizer/models/organisation.rb +2 -0
  26. data/lib/xeroizer/models/payment_service.rb +22 -0
  27. data/lib/xeroizer/models/payroll/address.rb +53 -0
  28. data/lib/xeroizer/models/payroll/bank_account.rb +18 -6
  29. data/lib/xeroizer/models/payroll/benefit_line.rb +26 -0
  30. data/lib/xeroizer/models/payroll/benefit_type.rb +45 -0
  31. data/lib/xeroizer/models/payroll/deduction_line.rb +32 -0
  32. data/lib/xeroizer/models/payroll/deduction_type.rb +49 -0
  33. data/lib/xeroizer/models/payroll/earnings_line.rb +39 -0
  34. data/lib/xeroizer/models/payroll/earnings_type.rb +53 -0
  35. data/lib/xeroizer/models/payroll/employee.rb +30 -8
  36. data/lib/xeroizer/models/payroll/leave_application.rb +27 -0
  37. data/lib/xeroizer/models/payroll/leave_line.rb +30 -0
  38. data/lib/xeroizer/models/payroll/leave_period.rb +15 -0
  39. data/lib/xeroizer/models/payroll/pay_items.rb +22 -0
  40. data/lib/xeroizer/models/payroll/pay_run.rb +33 -0
  41. data/lib/xeroizer/models/payroll/pay_schedule.rb +40 -0
  42. data/lib/xeroizer/models/payroll/pay_template.rb +24 -0
  43. data/lib/xeroizer/models/payroll/payment_method.rb +24 -0
  44. data/lib/xeroizer/models/payroll/paystub.rb +44 -0
  45. data/lib/xeroizer/models/payroll/reimbursement_line.rb +21 -0
  46. data/lib/xeroizer/models/payroll/reimbursement_type.rb +22 -0
  47. data/lib/xeroizer/models/payroll/salary_and_wage.rb +29 -0
  48. data/lib/xeroizer/models/payroll/super_line.rb +40 -0
  49. data/lib/xeroizer/models/payroll/tax_declaration.rb +50 -0
  50. data/lib/xeroizer/models/payroll/time_off_line.rb +20 -0
  51. data/lib/xeroizer/models/payroll/time_off_type.rb +32 -0
  52. data/lib/xeroizer/models/payroll/work_location.rb +25 -0
  53. data/lib/xeroizer/models/prepayment.rb +1 -0
  54. data/lib/xeroizer/models/purchase_order.rb +6 -6
  55. data/lib/xeroizer/models/quote.rb +76 -0
  56. data/lib/xeroizer/models/schedule.rb +1 -0
  57. data/lib/xeroizer/models/tax_component.rb +1 -0
  58. data/lib/xeroizer/models/to_bank_account.rb +1 -0
  59. data/lib/xeroizer/oauth.rb +12 -1
  60. data/lib/xeroizer/oauth2.rb +82 -0
  61. data/lib/xeroizer/oauth2_application.rb +49 -0
  62. data/lib/xeroizer/payroll_application.rb +8 -3
  63. data/lib/xeroizer/record/base.rb +11 -2
  64. data/lib/xeroizer/record/base_model.rb +1 -1
  65. data/lib/xeroizer/record/base_model_http_proxy.rb +37 -17
  66. data/lib/xeroizer/record/model_definition_helper.rb +1 -1
  67. data/lib/xeroizer/record/payroll_base.rb +4 -0
  68. data/lib/xeroizer/record/record_association_helper.rb +4 -4
  69. data/lib/xeroizer/record/validators/associated_validator.rb +1 -0
  70. data/lib/xeroizer/record/xml_helper.rb +18 -18
  71. data/lib/xeroizer/report/aged_receivables_by_contact.rb +1 -1
  72. data/lib/xeroizer/report/cell_xml_helper.rb +13 -13
  73. data/lib/xeroizer/response.rb +22 -17
  74. data/lib/xeroizer/version.rb +1 -1
  75. data/lib/xeroizer.rb +34 -4
  76. data/test/acceptance/about_creating_bank_transactions_test.rb +89 -81
  77. data/test/acceptance/about_creating_prepayment_test.rb +25 -30
  78. data/test/acceptance/about_fetching_bank_transactions_test.rb +12 -12
  79. data/test/acceptance/about_online_invoice_test.rb +25 -0
  80. data/test/acceptance/acceptance_test.rb +28 -26
  81. data/test/acceptance/bank_transfer_test.rb +12 -17
  82. data/test/acceptance/bulk_operations_test.rb +18 -16
  83. data/test/acceptance/connections_test.rb +11 -0
  84. data/test/stub_responses/bad_request.json +6 -0
  85. data/test/stub_responses/connections.json +16 -0
  86. data/test/stub_responses/expired_oauth2_token.json +6 -0
  87. data/test/stub_responses/generic_response_error.json +6 -0
  88. data/test/stub_responses/invalid_oauth2_request_token.json +6 -0
  89. data/test/stub_responses/invalid_tenant_header.json +6 -0
  90. data/test/stub_responses/object_not_found.json +6 -0
  91. data/test/stub_responses/organisations.xml +10 -0
  92. data/test/stub_responses/payment_service.xml +15 -0
  93. data/test/test_helper.rb +17 -12
  94. data/test/unit/generic_application_test.rb +21 -10
  95. data/test/unit/http_test.rb +282 -10
  96. data/test/unit/models/address_test.rb +2 -2
  97. data/test/unit/models/bank_transaction_model_parsing_test.rb +2 -2
  98. data/test/unit/models/bank_transaction_test.rb +1 -1
  99. data/test/unit/models/bank_transaction_validation_test.rb +1 -1
  100. data/test/unit/models/contact_test.rb +20 -11
  101. data/test/unit/models/credit_note_test.rb +8 -8
  102. data/test/unit/models/employee_test.rb +4 -4
  103. data/test/unit/models/invoice_test.rb +12 -12
  104. data/test/unit/models/journal_line_test.rb +6 -6
  105. data/test/unit/models/journal_test.rb +4 -4
  106. data/test/unit/models/line_item_sum_test.rb +1 -1
  107. data/test/unit/models/line_item_test.rb +29 -37
  108. data/test/unit/models/manual_journal_test.rb +3 -3
  109. data/test/unit/models/organisation_test.rb +16 -2
  110. data/test/unit/models/payment_service_test.rb +29 -0
  111. data/test/unit/models/phone_test.rb +7 -7
  112. data/test/unit/models/prepayment_test.rb +4 -4
  113. data/test/unit/models/repeating_invoice_test.rb +3 -3
  114. data/test/unit/models/tax_rate_test.rb +2 -2
  115. data/test/unit/oauth2_test.rb +171 -0
  116. data/test/unit/oauth_config_test.rb +1 -1
  117. data/test/unit/record/base_model_test.rb +13 -13
  118. data/test/unit/record/base_test.rb +73 -4
  119. data/test/unit/record/block_validator_test.rb +1 -1
  120. data/test/unit/record/connection_test.rb +60 -0
  121. data/test/unit/record/model_definition_test.rb +36 -36
  122. data/test/unit/record/parse_params_test.rb +59 -0
  123. data/test/unit/record/parse_where_hash_test.rb +13 -13
  124. data/test/unit/record/record_association_test.rb +14 -14
  125. data/test/unit/record/validators_test.rb +43 -43
  126. data/test/unit/record_definition_test.rb +7 -7
  127. data/test/unit/report_definition_test.rb +7 -7
  128. data/test/unit/report_test.rb +20 -20
  129. data/test/unit_test_helper.rb +16 -0
  130. metadata +117 -27
  131. data/lib/xeroizer/models/payroll/home_address.rb +0 -24
  132. data/lib/xeroizer/partner_application.rb +0 -51
  133. data/lib/xeroizer/private_application.rb +0 -25
  134. data/lib/xeroizer/public_application.rb +0 -21
  135. data/test/unit/oauth_test.rb +0 -118
  136. data/test/unit/private_application_test.rb +0 -20
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xeroizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.17.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Robinson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-19 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '2.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,6 +54,20 @@ dependencies:
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: shoulda
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.6.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.6.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: test-unit
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: test-unit
84
+ name: turn
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rest-client
98
+ name: ansi
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,7 +109,7 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: turn
112
+ name: redcarpet
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: ansi
126
+ name: yard
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -123,7 +137,7 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: redcarpet
140
+ name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
@@ -137,7 +151,7 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: yard
154
+ name: pry
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - ">="
@@ -178,6 +192,20 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: 0.4.5
195
+ - !ruby/object:Gem::Dependency
196
+ name: oauth2
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: 1.4.0
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 1.4.0
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: activesupport
183
211
  requirement: !ruby/object:Gem::Requirement
@@ -234,8 +262,11 @@ dependencies:
234
262
  - - ">="
235
263
  - !ruby/object:Gem::Version
236
264
  version: '0'
237
- description: Ruby library for the Xero accounting system API.
238
- email: wayne.robinson@gmail.com
265
+ description: Ruby library for the Xero accounting API. Originally developed by Wayne
266
+ Robinson, now maintained by the Xero API Team & Xero/Ruby developer community.
267
+ email:
268
+ - wayne.robinson@gmail.com
269
+ - api@xero.com
239
270
  executables: []
240
271
  extensions: []
241
272
  extra_rdoc_files: []
@@ -247,10 +278,12 @@ files:
247
278
  - lib/xeroizer/application_http_proxy.rb
248
279
  - lib/xeroizer/ca-certificates.crt
249
280
  - lib/xeroizer/configuration.rb
281
+ - lib/xeroizer/connection.rb
250
282
  - lib/xeroizer/exceptions.rb
251
283
  - lib/xeroizer/generic_application.rb
252
284
  - lib/xeroizer/http.rb
253
285
  - lib/xeroizer/http_encoding_helper.rb
286
+ - lib/xeroizer/http_response.rb
254
287
  - lib/xeroizer/logging.rb
255
288
  - lib/xeroizer/models/account.rb
256
289
  - lib/xeroizer/models/accounts_payable.rb
@@ -262,6 +295,7 @@ files:
262
295
  - lib/xeroizer/models/bank_account.rb
263
296
  - lib/xeroizer/models/bank_transaction.rb
264
297
  - lib/xeroizer/models/bank_transfer.rb
298
+ - lib/xeroizer/models/batch_payment.rb
265
299
  - lib/xeroizer/models/batch_payments.rb
266
300
  - lib/xeroizer/models/bills.rb
267
301
  - lib/xeroizer/models/branding_theme.rb
@@ -276,6 +310,7 @@ files:
276
310
  - lib/xeroizer/models/expense_claim.rb
277
311
  - lib/xeroizer/models/external_link.rb
278
312
  - lib/xeroizer/models/from_bank_account.rb
313
+ - lib/xeroizer/models/history_record.rb
279
314
  - lib/xeroizer/models/invoice.rb
280
315
  - lib/xeroizer/models/invoice_reminder.rb
281
316
  - lib/xeroizer/models/item.rb
@@ -289,17 +324,43 @@ files:
289
324
  - lib/xeroizer/models/line_item_sum.rb
290
325
  - lib/xeroizer/models/manual_journal.rb
291
326
  - lib/xeroizer/models/manual_journal_line.rb
327
+ - lib/xeroizer/models/online_invoice.rb
292
328
  - lib/xeroizer/models/option.rb
293
329
  - lib/xeroizer/models/organisation.rb
294
330
  - lib/xeroizer/models/overpayment.rb
295
331
  - lib/xeroizer/models/payment.rb
332
+ - lib/xeroizer/models/payment_service.rb
296
333
  - lib/xeroizer/models/payment_terms.rb
334
+ - lib/xeroizer/models/payroll/address.rb
297
335
  - lib/xeroizer/models/payroll/bank_account.rb
336
+ - lib/xeroizer/models/payroll/benefit_line.rb
337
+ - lib/xeroizer/models/payroll/benefit_type.rb
338
+ - lib/xeroizer/models/payroll/deduction_line.rb
339
+ - lib/xeroizer/models/payroll/deduction_type.rb
340
+ - lib/xeroizer/models/payroll/earnings_line.rb
341
+ - lib/xeroizer/models/payroll/earnings_type.rb
298
342
  - lib/xeroizer/models/payroll/employee.rb
299
- - lib/xeroizer/models/payroll/home_address.rb
343
+ - lib/xeroizer/models/payroll/leave_application.rb
344
+ - lib/xeroizer/models/payroll/leave_line.rb
345
+ - lib/xeroizer/models/payroll/leave_period.rb
346
+ - lib/xeroizer/models/payroll/pay_items.rb
347
+ - lib/xeroizer/models/payroll/pay_run.rb
348
+ - lib/xeroizer/models/payroll/pay_schedule.rb
349
+ - lib/xeroizer/models/payroll/pay_template.rb
350
+ - lib/xeroizer/models/payroll/payment_method.rb
351
+ - lib/xeroizer/models/payroll/paystub.rb
352
+ - lib/xeroizer/models/payroll/reimbursement_line.rb
353
+ - lib/xeroizer/models/payroll/reimbursement_type.rb
354
+ - lib/xeroizer/models/payroll/salary_and_wage.rb
355
+ - lib/xeroizer/models/payroll/super_line.rb
356
+ - lib/xeroizer/models/payroll/tax_declaration.rb
357
+ - lib/xeroizer/models/payroll/time_off_line.rb
358
+ - lib/xeroizer/models/payroll/time_off_type.rb
359
+ - lib/xeroizer/models/payroll/work_location.rb
300
360
  - lib/xeroizer/models/phone.rb
301
361
  - lib/xeroizer/models/prepayment.rb
302
362
  - lib/xeroizer/models/purchase_order.rb
363
+ - lib/xeroizer/models/quote.rb
303
364
  - lib/xeroizer/models/receipt.rb
304
365
  - lib/xeroizer/models/repeating_invoice.rb
305
366
  - lib/xeroizer/models/sales.rb
@@ -311,10 +372,9 @@ files:
311
372
  - lib/xeroizer/models/tracking_category_child.rb
312
373
  - lib/xeroizer/models/user.rb
313
374
  - lib/xeroizer/oauth.rb
314
- - lib/xeroizer/partner_application.rb
375
+ - lib/xeroizer/oauth2.rb
376
+ - lib/xeroizer/oauth2_application.rb
315
377
  - lib/xeroizer/payroll_application.rb
316
- - lib/xeroizer/private_application.rb
317
- - lib/xeroizer/public_application.rb
318
378
  - lib/xeroizer/record/application_helper.rb
319
379
  - lib/xeroizer/record/base.rb
320
380
  - lib/xeroizer/record/base_model.rb
@@ -347,14 +407,18 @@ files:
347
407
  - test/acceptance/about_creating_bank_transactions_test.rb
348
408
  - test/acceptance/about_creating_prepayment_test.rb
349
409
  - test/acceptance/about_fetching_bank_transactions_test.rb
410
+ - test/acceptance/about_online_invoice_test.rb
350
411
  - test/acceptance/acceptance_test.rb
351
412
  - test/acceptance/bank_transaction_reference_data.rb
352
413
  - test/acceptance/bank_transfer_test.rb
353
414
  - test/acceptance/bulk_operations_test.rb
415
+ - test/acceptance/connections_test.rb
354
416
  - test/stub_responses/accounts.xml
355
417
  - test/stub_responses/api_exception.xml
418
+ - test/stub_responses/bad_request.json
356
419
  - test/stub_responses/bogus_oauth_error
357
420
  - test/stub_responses/branding_themes.xml
421
+ - test/stub_responses/connections.json
358
422
  - test/stub_responses/contact.xml
359
423
  - test/stub_responses/contact_with_details.xml
360
424
  - test/stub_responses/contacts.xml
@@ -365,9 +429,13 @@ files:
365
429
  - test/stub_responses/credit_notes.xml
366
430
  - test/stub_responses/currencies.xml
367
431
  - test/stub_responses/employees.xml
432
+ - test/stub_responses/expired_oauth2_token.json
433
+ - test/stub_responses/generic_response_error.json
368
434
  - test/stub_responses/invalid_api_key_error.xml
369
435
  - test/stub_responses/invalid_consumer_key
436
+ - test/stub_responses/invalid_oauth2_request_token.json
370
437
  - test/stub_responses/invalid_request_token
438
+ - test/stub_responses/invalid_tenant_header.json
371
439
  - test/stub_responses/invoice.xml
372
440
  - test/stub_responses/invoice_not_found_error.xml
373
441
  - test/stub_responses/invoices.xml
@@ -375,8 +443,10 @@ files:
375
443
  - test/stub_responses/manual_journal.xml
376
444
  - test/stub_responses/manual_journals.xml
377
445
  - test/stub_responses/nonce_used
446
+ - test/stub_responses/object_not_found.json
378
447
  - test/stub_responses/organisation.xml
379
448
  - test/stub_responses/organisations.xml
449
+ - test/stub_responses/payment_service.xml
380
450
  - test/stub_responses/payments.xml
381
451
  - test/stub_responses/prepayments.xml
382
452
  - test/stub_responses/rate_limit_exceeded
@@ -605,28 +675,36 @@ files:
605
675
  - test/unit/models/line_item_test.rb
606
676
  - test/unit/models/manual_journal_test.rb
607
677
  - test/unit/models/organisation_test.rb
678
+ - test/unit/models/payment_service_test.rb
608
679
  - test/unit/models/phone_test.rb
609
680
  - test/unit/models/prepayment_test.rb
610
681
  - test/unit/models/repeating_invoice_test.rb
611
682
  - test/unit/models/tax_rate_test.rb
683
+ - test/unit/oauth2_test.rb
612
684
  - test/unit/oauth_config_test.rb
613
- - test/unit/oauth_test.rb
614
- - test/unit/private_application_test.rb
615
685
  - test/unit/record/base_model_test.rb
616
686
  - test/unit/record/base_test.rb
617
687
  - test/unit/record/block_validator_test.rb
688
+ - test/unit/record/connection_test.rb
618
689
  - test/unit/record/model_definition_test.rb
690
+ - test/unit/record/parse_params_test.rb
619
691
  - test/unit/record/parse_where_hash_test.rb
620
692
  - test/unit/record/record_association_test.rb
621
693
  - test/unit/record/validators_test.rb
622
694
  - test/unit/record_definition_test.rb
623
695
  - test/unit/report_definition_test.rb
624
696
  - test/unit/report_test.rb
697
+ - test/unit_test_helper.rb
625
698
  homepage: http://github.com/waynerobinson/xeroizer
626
699
  licenses:
627
700
  - MIT
628
- metadata: {}
629
- post_install_message:
701
+ metadata:
702
+ bug_tracker_uri: https://github.com/waynerobinson/xeroizer/issues
703
+ changelog_uri: https://github.com/waynerobinson/xeroizer/releases
704
+ source_code_uri: https://github.com/waynerobinson/xeroizer
705
+ documentation_uri: https://developer.xero.com/documentation/
706
+ mailing_list_uri: https://developer.xero.com/subscribe-to-the-xero-api-developer-mailing-list
707
+ post_install_message:
630
708
  rdoc_options: []
631
709
  require_paths:
632
710
  - lib
@@ -641,23 +719,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
641
719
  - !ruby/object:Gem::Version
642
720
  version: '0'
643
721
  requirements: []
644
- rubyforge_project:
645
- rubygems_version: 2.6.12
646
- signing_key:
722
+ rubygems_version: 3.2.3
723
+ signing_key:
647
724
  specification_version: 4
648
- summary: Xero library
725
+ summary: Ruby Library for Xero accounting API
649
726
  test_files:
650
727
  - test/acceptance/about_creating_bank_transactions_test.rb
651
728
  - test/acceptance/about_creating_prepayment_test.rb
652
729
  - test/acceptance/about_fetching_bank_transactions_test.rb
730
+ - test/acceptance/about_online_invoice_test.rb
653
731
  - test/acceptance/acceptance_test.rb
654
732
  - test/acceptance/bank_transaction_reference_data.rb
655
733
  - test/acceptance/bank_transfer_test.rb
656
734
  - test/acceptance/bulk_operations_test.rb
735
+ - test/acceptance/connections_test.rb
657
736
  - test/stub_responses/accounts.xml
658
737
  - test/stub_responses/api_exception.xml
738
+ - test/stub_responses/bad_request.json
659
739
  - test/stub_responses/bogus_oauth_error
660
740
  - test/stub_responses/branding_themes.xml
741
+ - test/stub_responses/connections.json
661
742
  - test/stub_responses/contact.xml
662
743
  - test/stub_responses/contact_with_details.xml
663
744
  - test/stub_responses/contacts.xml
@@ -668,9 +749,13 @@ test_files:
668
749
  - test/stub_responses/credit_notes.xml
669
750
  - test/stub_responses/currencies.xml
670
751
  - test/stub_responses/employees.xml
752
+ - test/stub_responses/expired_oauth2_token.json
753
+ - test/stub_responses/generic_response_error.json
671
754
  - test/stub_responses/invalid_api_key_error.xml
672
755
  - test/stub_responses/invalid_consumer_key
756
+ - test/stub_responses/invalid_oauth2_request_token.json
673
757
  - test/stub_responses/invalid_request_token
758
+ - test/stub_responses/invalid_tenant_header.json
674
759
  - test/stub_responses/invoice.xml
675
760
  - test/stub_responses/invoice_not_found_error.xml
676
761
  - test/stub_responses/invoices.xml
@@ -678,8 +763,10 @@ test_files:
678
763
  - test/stub_responses/manual_journal.xml
679
764
  - test/stub_responses/manual_journals.xml
680
765
  - test/stub_responses/nonce_used
766
+ - test/stub_responses/object_not_found.json
681
767
  - test/stub_responses/organisation.xml
682
768
  - test/stub_responses/organisations.xml
769
+ - test/stub_responses/payment_service.xml
683
770
  - test/stub_responses/payments.xml
684
771
  - test/stub_responses/prepayments.xml
685
772
  - test/stub_responses/rate_limit_exceeded
@@ -908,20 +995,23 @@ test_files:
908
995
  - test/unit/models/line_item_test.rb
909
996
  - test/unit/models/manual_journal_test.rb
910
997
  - test/unit/models/organisation_test.rb
998
+ - test/unit/models/payment_service_test.rb
911
999
  - test/unit/models/phone_test.rb
912
1000
  - test/unit/models/prepayment_test.rb
913
1001
  - test/unit/models/repeating_invoice_test.rb
914
1002
  - test/unit/models/tax_rate_test.rb
1003
+ - test/unit/oauth2_test.rb
915
1004
  - test/unit/oauth_config_test.rb
916
- - test/unit/oauth_test.rb
917
- - test/unit/private_application_test.rb
918
1005
  - test/unit/record/base_model_test.rb
919
1006
  - test/unit/record/base_test.rb
920
1007
  - test/unit/record/block_validator_test.rb
1008
+ - test/unit/record/connection_test.rb
921
1009
  - test/unit/record/model_definition_test.rb
1010
+ - test/unit/record/parse_params_test.rb
922
1011
  - test/unit/record/parse_where_hash_test.rb
923
1012
  - test/unit/record/record_association_test.rb
924
1013
  - test/unit/record/validators_test.rb
925
1014
  - test/unit/record_definition_test.rb
926
1015
  - test/unit/report_definition_test.rb
927
1016
  - test/unit/report_test.rb
1017
+ - test/unit_test_helper.rb
@@ -1,24 +0,0 @@
1
- module Xeroizer
2
- module Record
3
- module Payroll
4
-
5
- class HomeAddressModel < PayrollBaseModel
6
-
7
- end
8
-
9
- class HomeAddress < PayrollBase
10
-
11
- string :address_line_1
12
- string :address_line_2
13
- string :address_line_3
14
- string :address_line_4
15
- string :city
16
- string :region
17
- string :postal_code
18
- string :country
19
-
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,51 +0,0 @@
1
- module Xeroizer
2
- class PartnerApplication < GenericApplication
3
-
4
- extend Forwardable
5
- def_delegators :client, :request_token, :authorize_from_request, :renew_access_token, :expires_at, :authorization_expires_at, :session_handle, :authorize_from_access
6
-
7
- public
8
-
9
- # Partner applications allow for public AccessToken's received via the stanard OAuth
10
- # authentication process to be renewed up until the session's expiry. The default session
11
- # expiry for Xero is 365 days and the default AccessToken expiry is 30 minutes.
12
- #
13
- # @param [String] consumer_key consumer key/token from application developer (found at http://api.xero.com for your application).
14
- # @param [String] consumer_secret consumer secret from application developer (found at http://api.xero.com for your application).
15
- # @param [String] path_to_private_key application's private key for message signing (uploaded to http://api.xero.com)
16
- # @param [Hash] options other options to pass to the GenericApplication constructor
17
- # @return [PartnerApplication] instance of PrivateApplication
18
- def initialize(consumer_key, consumer_secret, path_to_private_key, options = {})
19
- default_options = {
20
- :xero_url => 'https://api.xero.com/api.xro/2.0',
21
- :site => 'https://api.xero.com',
22
- :authorize_url => 'https://api.xero.com/oauth/Authorize',
23
- :signature_method => 'RSA-SHA1'
24
- }
25
- options = default_options.merge(options).merge(
26
- :private_key_file => path_to_private_key
27
- )
28
- super(consumer_key, consumer_secret, options)
29
-
30
- # Load up an existing token if passed the token/key.
31
- if options[:access_token] && options[:access_key]
32
- authorize_from_access(options[:access_token], options[:access_key])
33
- end
34
-
35
- # Save the session_handle if passed in so we can renew the token.
36
- if options[:session_handle]
37
- client.session_handle = options[:session_handle]
38
- end
39
- end
40
-
41
- private
42
-
43
- def read_certificate(cert)
44
- if File.exists?(cert)
45
- File.read(cert)
46
- else
47
- cert
48
- end
49
- end
50
- end
51
- end
@@ -1,25 +0,0 @@
1
- module Xeroizer
2
- class PrivateApplication < GenericApplication
3
-
4
- extend Forwardable
5
- def_delegators :client, :authorize_from_access
6
-
7
- public
8
-
9
- # Private applications are defined in the Xero API website and can be accessed in the
10
- # background without ever requiring a redirect to the Xero website for authorisation.
11
- #
12
- # @param [String] consumer_key consumer key/token from application developer (found at http://api.xero.com for your application).
13
- # @param [String] consumer_secret consumer secret from application developer (found at http://api.xero.com for your application).
14
- # @param [String] path_to_private_key application's private key for message signing (uploaded to http://api.xero.com)
15
- # @param [Hash] options other options to pass to the GenericApplication constructor
16
- # @return [PrivateApplication] instance of PrivateApplication
17
- def initialize(consumer_key, consumer_secret, path_to_private_key, options = {})
18
- options[:signature_method] = 'RSA-SHA1'
19
- options[:private_key_file] = path_to_private_key
20
- super(consumer_key, consumer_secret, options)
21
- @client.authorize_from_access(consumer_key, consumer_secret)
22
- end
23
-
24
- end
25
- end
@@ -1,21 +0,0 @@
1
- module Xeroizer
2
- class PublicApplication < GenericApplication
3
-
4
- extend Forwardable
5
- def_delegators :client, :request_token, :authorize_from_request, :authorize_from_access
6
-
7
- public
8
-
9
- # Public appliations are authenticated via the Xero website via OAuth. AccessTokens are valid for 30 minutes
10
- # after authentication. To extend this time you must redirect the user to Xero's OAuth server again.
11
- #
12
- # @param [String] consumer_key consumer key/token from application developer (found at http://api.xero.com for your application)
13
- # @param [String] consumer_secret consumer secret from application developer (found at http://api.xero.com for your application)
14
- # @param [Hash] options other options to pass to the GenericApplication constructor
15
- # @return [PublicApplication] instance of PrivateApplication
16
- def initialize(consumer_key, consumer_secret, options = {})
17
- super(consumer_key, consumer_secret, options)
18
- end
19
-
20
- end
21
- end
@@ -1,118 +0,0 @@
1
- require 'test_helper'
2
-
3
- class OAuthTest < Test::Unit::TestCase
4
- include TestHelper
5
-
6
- def setup
7
- @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
8
- end
9
-
10
- context "with oauth error handling" do
11
-
12
- should "handle token expired" do
13
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("token_expired"), :code => "401"))
14
-
15
- assert_raises Xeroizer::OAuth::TokenExpired do
16
- @client.Organisation.first
17
- end
18
- end
19
-
20
- should "handle invalid request tokens" do
21
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("invalid_request_token"), :code => "401"))
22
-
23
- assert_raises Xeroizer::OAuth::TokenInvalid do
24
- @client.Organisation.first
25
- end
26
- end
27
-
28
- should "handle invalid consumer key" do
29
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("invalid_consumer_key"), :code => "401"))
30
-
31
- assert_raises Xeroizer::OAuth::TokenInvalid do
32
- @client.Organisation.first
33
- end
34
- end
35
-
36
- should "handle nonce used" do
37
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("nonce_used"), :code => "401"))
38
-
39
- assert_raises Xeroizer::OAuth::NonceUsed do
40
- @client.Organisation.first
41
- end
42
- end
43
-
44
- should "raise rate limit exceeded" do
45
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("rate_limit_exceeded"), :code => "401"))
46
-
47
- assert_raises Xeroizer::OAuth::RateLimitExceeded do
48
- @client.Organisation.first
49
- end
50
- end
51
-
52
- should "automatically handle rate limit exceeded" do
53
- auto_rate_limit_client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET, :rate_limit_sleep => 1)
54
-
55
- # Return rate limit exceeded on first call, OK on the second
56
- Xeroizer::OAuth.any_instance.stubs(:get).returns(
57
- stub(:plain_body => get_file_as_string("rate_limit_exceeded"), :code => "401"),
58
- stub(:plain_body => get_record_xml(:organisation), :code => '200')
59
- )
60
-
61
- auto_rate_limit_client.expects(:sleep_for).with(1).returns(1)
62
-
63
- auto_rate_limit_client.Organisation.first
64
- end
65
-
66
- should "only retry rate limited request a configurable number of times" do
67
- auto_rate_limit_client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET, :rate_limit_sleep => 1, :rate_limit_max_attempts => 4)
68
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("rate_limit_exceeded"), :code => "401"))
69
-
70
- auto_rate_limit_client.expects(:sleep_for).with(1).times(4).returns(1)
71
-
72
- assert_raises Xeroizer::OAuth::RateLimitExceeded do
73
- auto_rate_limit_client.Organisation.first
74
- end
75
- end
76
-
77
- should "retry nonce_used failures a configurable number of times" do
78
- nonce_used_client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET, :nonce_used_max_attempts => 4)
79
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("nonce_used"), :code => "401"))
80
-
81
- nonce_used_client.expects(:sleep_for).with(1).times(4).returns(1)
82
-
83
- assert_raises Xeroizer::OAuth::NonceUsed do
84
- nonce_used_client.Organisation.first
85
- end
86
- end
87
-
88
- should "handle unknown errors" do
89
- Xeroizer::OAuth.any_instance.stubs(:get).returns(stub(:plain_body => get_file_as_string("bogus_oauth_error"), :code => "401"))
90
-
91
- assert_raises Xeroizer::OAuth::UnknownError do
92
- @client.Organisation.first
93
- end
94
- end
95
-
96
- should "handle ApiExceptions" do
97
- Xeroizer::OAuth.any_instance.stubs(:put).returns(stub(:plain_body => get_file_as_string("api_exception.xml"),
98
- :code => "400"))
99
-
100
- assert_raises Xeroizer::ApiException do
101
- contact = @client.Contact.build(:name => 'Test Contact')
102
- contact.save
103
- end
104
- end
105
-
106
- should "handle random root elements" do
107
- Xeroizer::OAuth.any_instance.stubs(:put).returns(stub(:plain_body => "<RandomRootElement></RandomRootElement>",
108
- :code => "200"))
109
-
110
- assert_raises Xeroizer::UnparseableResponse do
111
- contact = @client.Contact.build(:name => 'Test Contact')
112
- contact.save
113
- end
114
- end
115
-
116
- end
117
-
118
- end
@@ -1,20 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PrivateApplicationTest < Test::Unit::TestCase
4
- include TestHelper
5
-
6
- def setup
7
- @client = Xeroizer::PrivateApplication.new(CONSUMER_KEY, CONSUMER_SECRET, PRIVATE_KEY_PATH)
8
- end
9
-
10
- context "initialization" do
11
-
12
- should "have a valid client" do
13
- assert_kind_of(Xeroizer::OAuth, @client.client)
14
- assert_equal(CONSUMER_KEY, @client.client.ctoken)
15
- assert_equal(CONSUMER_SECRET, @client.client.csecret)
16
- end
17
-
18
- end
19
-
20
- end