xeroizer 2.20.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +126 -185
  3. data/lib/xeroizer/connection.rb +49 -0
  4. data/lib/xeroizer/exceptions.rb +2 -0
  5. data/lib/xeroizer/generic_application.rb +8 -3
  6. data/lib/xeroizer/http.rb +5 -80
  7. data/lib/xeroizer/http_response.rb +154 -0
  8. data/lib/xeroizer/models/bank_transaction.rb +1 -0
  9. data/lib/xeroizer/models/batch_payment.rb +4 -1
  10. data/lib/xeroizer/models/contact.rb +10 -4
  11. data/lib/xeroizer/models/credit_note.rb +20 -20
  12. data/lib/xeroizer/models/history_record.rb +72 -0
  13. data/lib/xeroizer/models/invoice.rb +5 -1
  14. data/lib/xeroizer/models/line_item.rb +4 -2
  15. data/lib/xeroizer/models/manual_journal.rb +2 -1
  16. data/lib/xeroizer/models/option.rb +1 -1
  17. data/lib/xeroizer/models/payroll/address.rb +53 -0
  18. data/lib/xeroizer/models/payroll/bank_account.rb +18 -6
  19. data/lib/xeroizer/models/payroll/benefit_line.rb +26 -0
  20. data/lib/xeroizer/models/payroll/benefit_type.rb +45 -0
  21. data/lib/xeroizer/models/payroll/deduction_line.rb +32 -0
  22. data/lib/xeroizer/models/payroll/deduction_type.rb +49 -0
  23. data/lib/xeroizer/models/payroll/earnings_line.rb +39 -0
  24. data/lib/xeroizer/models/payroll/earnings_type.rb +53 -0
  25. data/lib/xeroizer/models/payroll/employee.rb +30 -8
  26. data/lib/xeroizer/models/payroll/leave_application.rb +27 -0
  27. data/lib/xeroizer/models/payroll/leave_line.rb +30 -0
  28. data/lib/xeroizer/models/payroll/leave_period.rb +15 -0
  29. data/lib/xeroizer/models/payroll/pay_items.rb +22 -0
  30. data/lib/xeroizer/models/payroll/pay_run.rb +33 -0
  31. data/lib/xeroizer/models/payroll/pay_schedule.rb +40 -0
  32. data/lib/xeroizer/models/payroll/pay_template.rb +24 -0
  33. data/lib/xeroizer/models/payroll/payment_method.rb +24 -0
  34. data/lib/xeroizer/models/payroll/paystub.rb +44 -0
  35. data/lib/xeroizer/models/payroll/reimbursement_line.rb +21 -0
  36. data/lib/xeroizer/models/payroll/reimbursement_type.rb +22 -0
  37. data/lib/xeroizer/models/payroll/salary_and_wage.rb +29 -0
  38. data/lib/xeroizer/models/payroll/super_line.rb +40 -0
  39. data/lib/xeroizer/models/payroll/tax_declaration.rb +50 -0
  40. data/lib/xeroizer/models/payroll/time_off_line.rb +20 -0
  41. data/lib/xeroizer/models/payroll/time_off_type.rb +32 -0
  42. data/lib/xeroizer/models/payroll/work_location.rb +25 -0
  43. data/lib/xeroizer/models/quote.rb +76 -0
  44. data/lib/xeroizer/models/tax_component.rb +1 -0
  45. data/lib/xeroizer/oauth.rb +12 -1
  46. data/lib/xeroizer/oauth2.rb +82 -0
  47. data/lib/xeroizer/oauth2_application.rb +49 -0
  48. data/lib/xeroizer/payroll_application.rb +8 -3
  49. data/lib/xeroizer/record/base_model.rb +1 -1
  50. data/lib/xeroizer/record/base_model_http_proxy.rb +1 -0
  51. data/lib/xeroizer/record/payroll_base.rb +4 -0
  52. data/lib/xeroizer/record/record_association_helper.rb +4 -4
  53. data/lib/xeroizer/record/validators/associated_validator.rb +1 -0
  54. data/lib/xeroizer/record/xml_helper.rb +16 -16
  55. data/lib/xeroizer/response.rb +22 -17
  56. data/lib/xeroizer/version.rb +1 -1
  57. data/lib/xeroizer.rb +31 -4
  58. data/test/acceptance/about_creating_bank_transactions_test.rb +80 -82
  59. data/test/acceptance/about_creating_prepayment_test.rb +25 -30
  60. data/test/acceptance/about_fetching_bank_transactions_test.rb +10 -10
  61. data/test/acceptance/about_online_invoice_test.rb +6 -10
  62. data/test/acceptance/acceptance_test.rb +28 -26
  63. data/test/acceptance/bank_transfer_test.rb +12 -17
  64. data/test/acceptance/bulk_operations_test.rb +18 -16
  65. data/test/acceptance/connections_test.rb +11 -0
  66. data/test/stub_responses/bad_request.json +6 -0
  67. data/test/stub_responses/connections.json +16 -0
  68. data/test/stub_responses/expired_oauth2_token.json +6 -0
  69. data/test/stub_responses/generic_response_error.json +6 -0
  70. data/test/stub_responses/invalid_oauth2_request_token.json +6 -0
  71. data/test/stub_responses/invalid_tenant_header.json +6 -0
  72. data/test/stub_responses/object_not_found.json +6 -0
  73. data/test/test_helper.rb +16 -11
  74. data/test/unit/generic_application_test.rb +21 -10
  75. data/test/unit/http_test.rb +281 -9
  76. data/test/unit/models/address_test.rb +2 -2
  77. data/test/unit/models/bank_transaction_model_parsing_test.rb +2 -2
  78. data/test/unit/models/bank_transaction_test.rb +1 -1
  79. data/test/unit/models/bank_transaction_validation_test.rb +1 -1
  80. data/test/unit/models/contact_test.rb +2 -2
  81. data/test/unit/models/credit_note_test.rb +8 -8
  82. data/test/unit/models/employee_test.rb +4 -4
  83. data/test/unit/models/invoice_test.rb +12 -12
  84. data/test/unit/models/journal_line_test.rb +6 -6
  85. data/test/unit/models/journal_test.rb +4 -4
  86. data/test/unit/models/line_item_sum_test.rb +1 -1
  87. data/test/unit/models/line_item_test.rb +19 -2
  88. data/test/unit/models/manual_journal_test.rb +3 -3
  89. data/test/unit/models/organisation_test.rb +2 -2
  90. data/test/unit/models/payment_service_test.rb +2 -2
  91. data/test/unit/models/phone_test.rb +7 -7
  92. data/test/unit/models/prepayment_test.rb +4 -4
  93. data/test/unit/models/repeating_invoice_test.rb +2 -2
  94. data/test/unit/models/tax_rate_test.rb +2 -2
  95. data/test/unit/oauth2_test.rb +171 -0
  96. data/test/unit/oauth_config_test.rb +1 -1
  97. data/test/unit/record/base_model_test.rb +13 -13
  98. data/test/unit/record/base_test.rb +5 -4
  99. data/test/unit/record/block_validator_test.rb +1 -1
  100. data/test/unit/record/connection_test.rb +60 -0
  101. data/test/unit/record/model_definition_test.rb +36 -36
  102. data/test/unit/record/parse_params_test.rb +2 -2
  103. data/test/unit/record/parse_where_hash_test.rb +13 -13
  104. data/test/unit/record/record_association_test.rb +14 -14
  105. data/test/unit/record/validators_test.rb +43 -43
  106. data/test/unit/record_definition_test.rb +7 -7
  107. data/test/unit/report_definition_test.rb +7 -7
  108. data/test/unit/report_test.rb +20 -20
  109. data/test/unit_test_helper.rb +16 -0
  110. metadata +106 -23
  111. data/lib/xeroizer/models/payroll/home_address.rb +0 -24
  112. data/lib/xeroizer/partner_application.rb +0 -51
  113. data/lib/xeroizer/private_application.rb +0 -25
  114. data/lib/xeroizer/public_application.rb +0 -21
  115. data/test/unit/http_tsl_12_upgrade_test.rb +0 -31
  116. data/test/unit/oauth_test.rb +0 -118
  117. data/test/unit/private_application_test.rb +0 -20
@@ -1,16 +1,16 @@
1
- require 'test_helper'
1
+ require 'unit_test_helper'
2
2
 
3
3
  class RecordDefinitionTest < Test::Unit::TestCase
4
4
  include TestHelper
5
-
5
+
6
6
  def setup
7
- @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
7
+ @client = Xeroizer::OAuth2Application.new(CLIENT_ID, CLIENT_SECRET)
8
8
  end
9
-
9
+
10
10
  context "record definitions" do
11
-
11
+
12
12
  should "be defined correctly" do
13
- [
13
+ [
14
14
  :Account, :BrandingTheme, :Contact, :CreditNote, :Currency, :Invoice,
15
15
  :Item, :Journal, :ManualJournal, :Organisation, :Payment, :TaxRate,
16
16
  :TrackingCategory, :User
@@ -21,7 +21,7 @@ class RecordDefinitionTest < Test::Unit::TestCase
21
21
  assert_equal(record_type.to_s, record_factory.model_name)
22
22
  end
23
23
  end
24
-
24
+
25
25
  end
26
26
 
27
27
  end
@@ -1,16 +1,16 @@
1
- require 'test_helper'
1
+ require 'unit_test_helper'
2
2
 
3
3
  class ReportDefinitionTest < Test::Unit::TestCase
4
4
  include TestHelper
5
-
5
+
6
6
  def setup
7
- @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
7
+ @client = Xeroizer::OAuth2Application.new(CLIENT_ID, CLIENT_SECRET)
8
8
  end
9
-
9
+
10
10
  context "report definitions" do
11
-
11
+
12
12
  should "be defined correctly" do
13
- [
13
+ [
14
14
  :AgedPayablesByContact, :AgedReceivablesByContact, :BalanceSheet, :BankStatement, :BankSummary,
15
15
  :BudgetSummary, :ExecutiveSummary, :ProfitAndLoss, :TrialBalance
16
16
  ].each do | report_type |
@@ -20,7 +20,7 @@ class ReportDefinitionTest < Test::Unit::TestCase
20
20
  assert_equal(report_type.to_s, report_factory.report_type)
21
21
  end
22
22
  end
23
-
23
+
24
24
  end
25
25
 
26
26
  end
@@ -1,20 +1,20 @@
1
- require 'test_helper'
1
+ require 'unit_test_helper'
2
2
 
3
3
  class MockNonReportClassDefinition; end
4
4
 
5
5
  class FactoryTest < Test::Unit::TestCase
6
6
  include TestHelper
7
-
7
+
8
8
  def setup
9
- @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
9
+ @client = Xeroizer::OAuth2Application.new(CLIENT_ID, CLIENT_SECRET)
10
10
  mock_report_api("TrialBalance")
11
11
  @report = @client.TrialBalance.get
12
12
  end
13
-
13
+
14
14
  context "report factory" do
15
-
15
+
16
16
  should "have correct API-part of URL based on its type" do
17
- [
17
+ [
18
18
  :AgedPayablesByContact, :AgedReceivablesByContact, :BalanceSheet, :BankStatement, :BankSummary,
19
19
  :BudgetSummary, :ExecutiveSummary, :ProfitAndLoss, :TrialBalance
20
20
  ].each do | report_type |
@@ -22,11 +22,11 @@ class FactoryTest < Test::Unit::TestCase
22
22
  assert_equal("Reports/#{report_type}", report_factory.api_controller_name)
23
23
  end
24
24
  end
25
-
25
+
26
26
  should "build report model from XML" do
27
27
  assert_kind_of(Xeroizer::Report::Base, @report)
28
28
  end
29
-
29
+
30
30
  should "have all attributes in report summary" do
31
31
  assert_equal("TrialBalance", @report.id)
32
32
  assert_equal("TrialBalance", @report.type)
@@ -35,7 +35,7 @@ class FactoryTest < Test::Unit::TestCase
35
35
  assert_equal(Date.parse('2011-03-23'), @report.date)
36
36
  assert_equal(Time.parse('2011-03-23T00:29:12.6021453Z'), @report.updated_at)
37
37
  end
38
-
38
+
39
39
  should "have valid rows" do
40
40
  assert_not_equal(0, @report.rows.size)
41
41
  @report.rows.each do | row |
@@ -43,7 +43,7 @@ class FactoryTest < Test::Unit::TestCase
43
43
  assert(%w(Header Row SummaryRow Section).include?(row.type), "'#{row.type}' is not a valid row type.")
44
44
  end
45
45
  end
46
-
46
+
47
47
  should "have cells and no rows if not Section" do
48
48
  @report.rows.each do | row |
49
49
  if row.type != 'Section'
@@ -52,7 +52,7 @@ class FactoryTest < Test::Unit::TestCase
52
52
  end
53
53
  end
54
54
  end
55
-
55
+
56
56
  should "have rows and no cells if Section" do
57
57
  @report.rows.each do | row |
58
58
  if row.type == 'Section'
@@ -61,7 +61,7 @@ class FactoryTest < Test::Unit::TestCase
61
61
  end
62
62
  end
63
63
  end
64
-
64
+
65
65
  should "convert cells to BigDecimal where possible" do
66
66
  def assess_row(row)
67
67
  return 0 unless row.row? || row.summary?
@@ -82,7 +82,7 @@ class FactoryTest < Test::Unit::TestCase
82
82
  end
83
83
  assert_not_equal(0, counter, "at least one converted number in the report should be greater than 0")
84
84
  end
85
-
85
+
86
86
  should "be at least one Section row with a title" do
87
87
  counter = 0
88
88
  @report.rows.each do | row |
@@ -101,24 +101,24 @@ class FactoryTest < Test::Unit::TestCase
101
101
  end
102
102
  end
103
103
  end
104
-
104
+
105
105
  should "have valid header row" do
106
106
  assert_kind_of(Xeroizer::Report::HeaderRow, @report.header)
107
107
  assert_equal(['Account', 'Debit', 'Credit', 'YTD Debit', 'YTD Credit'], @report.header.cells.map { | c | c.value })
108
108
  end
109
-
109
+
110
110
  should "have sections" do
111
111
  assert_not_equal(0, @report.sections)
112
112
  @report.sections.each do | section |
113
113
  assert_kind_of(Xeroizer::Report::SectionRow, section)
114
114
  end
115
115
  end
116
-
116
+
117
117
  should "have summary" do
118
118
  assert_kind_of(Xeroizer::Report::SummaryRow, @report.summary)
119
119
  assert_equal(['Total', '33244.04', '33244.04', '80938.93', '80938.93'], @report.summary.cells.map { | c | c.value.to_s })
120
120
  end
121
-
121
+
122
122
  should "have summary on final section for trial balance (which has a blank title)" do
123
123
  section = @report.sections.last
124
124
  summary = section.rows.last
@@ -126,7 +126,7 @@ class FactoryTest < Test::Unit::TestCase
126
126
  assert_nil(section.title)
127
127
  assert_equal(['Total', '33244.04', '33244.04', '80938.93', '80938.93'], summary.cells.map { | c | c.value.to_s })
128
128
  end
129
-
129
+
130
130
  end
131
131
 
132
132
  context "report factory in the dirty real world" do
@@ -139,7 +139,7 @@ class FactoryTest < Test::Unit::TestCase
139
139
  end
140
140
 
141
141
  private
142
-
142
+
143
143
  def check_valid_report_type(row)
144
144
  case row.type
145
145
  when 'Header' then assert_equal(true, row.header?)
@@ -150,5 +150,5 @@ class FactoryTest < Test::Unit::TestCase
150
150
  assert(false, "Invalid type: #{row.type}")
151
151
  end
152
152
  end
153
-
153
+
154
154
  end
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+ require 'webmock'
3
+
4
+ include WebMock::API
5
+ WebMock.disable_net_connect!(allow_localhost: true)
6
+
7
+ class UnitTestCase < Test::Unit::TestCase
8
+ def setup
9
+ WebMock.reset!
10
+ WebMock.enable!
11
+ end
12
+
13
+ def teardown
14
+ WebMock.disable!
15
+ end
16
+ end
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.20.0
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: 2019-10-17 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
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: shoulda
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 3.6.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 3.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: test-unit
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: builder
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +192,20 @@ dependencies:
164
192
  - - ">="
165
193
  - !ruby/object:Gem::Version
166
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
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: activesupport
169
211
  requirement: !ruby/object:Gem::Requirement
@@ -236,10 +278,12 @@ files:
236
278
  - lib/xeroizer/application_http_proxy.rb
237
279
  - lib/xeroizer/ca-certificates.crt
238
280
  - lib/xeroizer/configuration.rb
281
+ - lib/xeroizer/connection.rb
239
282
  - lib/xeroizer/exceptions.rb
240
283
  - lib/xeroizer/generic_application.rb
241
284
  - lib/xeroizer/http.rb
242
285
  - lib/xeroizer/http_encoding_helper.rb
286
+ - lib/xeroizer/http_response.rb
243
287
  - lib/xeroizer/logging.rb
244
288
  - lib/xeroizer/models/account.rb
245
289
  - lib/xeroizer/models/accounts_payable.rb
@@ -266,6 +310,7 @@ files:
266
310
  - lib/xeroizer/models/expense_claim.rb
267
311
  - lib/xeroizer/models/external_link.rb
268
312
  - lib/xeroizer/models/from_bank_account.rb
313
+ - lib/xeroizer/models/history_record.rb
269
314
  - lib/xeroizer/models/invoice.rb
270
315
  - lib/xeroizer/models/invoice_reminder.rb
271
316
  - lib/xeroizer/models/item.rb
@@ -286,12 +331,36 @@ files:
286
331
  - lib/xeroizer/models/payment.rb
287
332
  - lib/xeroizer/models/payment_service.rb
288
333
  - lib/xeroizer/models/payment_terms.rb
334
+ - lib/xeroizer/models/payroll/address.rb
289
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
290
342
  - lib/xeroizer/models/payroll/employee.rb
291
- - 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
292
360
  - lib/xeroizer/models/phone.rb
293
361
  - lib/xeroizer/models/prepayment.rb
294
362
  - lib/xeroizer/models/purchase_order.rb
363
+ - lib/xeroizer/models/quote.rb
295
364
  - lib/xeroizer/models/receipt.rb
296
365
  - lib/xeroizer/models/repeating_invoice.rb
297
366
  - lib/xeroizer/models/sales.rb
@@ -303,10 +372,9 @@ files:
303
372
  - lib/xeroizer/models/tracking_category_child.rb
304
373
  - lib/xeroizer/models/user.rb
305
374
  - lib/xeroizer/oauth.rb
306
- - lib/xeroizer/partner_application.rb
375
+ - lib/xeroizer/oauth2.rb
376
+ - lib/xeroizer/oauth2_application.rb
307
377
  - lib/xeroizer/payroll_application.rb
308
- - lib/xeroizer/private_application.rb
309
- - lib/xeroizer/public_application.rb
310
378
  - lib/xeroizer/record/application_helper.rb
311
379
  - lib/xeroizer/record/base.rb
312
380
  - lib/xeroizer/record/base_model.rb
@@ -344,10 +412,13 @@ files:
344
412
  - test/acceptance/bank_transaction_reference_data.rb
345
413
  - test/acceptance/bank_transfer_test.rb
346
414
  - test/acceptance/bulk_operations_test.rb
415
+ - test/acceptance/connections_test.rb
347
416
  - test/stub_responses/accounts.xml
348
417
  - test/stub_responses/api_exception.xml
418
+ - test/stub_responses/bad_request.json
349
419
  - test/stub_responses/bogus_oauth_error
350
420
  - test/stub_responses/branding_themes.xml
421
+ - test/stub_responses/connections.json
351
422
  - test/stub_responses/contact.xml
352
423
  - test/stub_responses/contact_with_details.xml
353
424
  - test/stub_responses/contacts.xml
@@ -358,9 +429,13 @@ files:
358
429
  - test/stub_responses/credit_notes.xml
359
430
  - test/stub_responses/currencies.xml
360
431
  - test/stub_responses/employees.xml
432
+ - test/stub_responses/expired_oauth2_token.json
433
+ - test/stub_responses/generic_response_error.json
361
434
  - test/stub_responses/invalid_api_key_error.xml
362
435
  - test/stub_responses/invalid_consumer_key
436
+ - test/stub_responses/invalid_oauth2_request_token.json
363
437
  - test/stub_responses/invalid_request_token
438
+ - test/stub_responses/invalid_tenant_header.json
364
439
  - test/stub_responses/invoice.xml
365
440
  - test/stub_responses/invoice_not_found_error.xml
366
441
  - test/stub_responses/invoices.xml
@@ -368,6 +443,7 @@ files:
368
443
  - test/stub_responses/manual_journal.xml
369
444
  - test/stub_responses/manual_journals.xml
370
445
  - test/stub_responses/nonce_used
446
+ - test/stub_responses/object_not_found.json
371
447
  - test/stub_responses/organisation.xml
372
448
  - test/stub_responses/organisations.xml
373
449
  - test/stub_responses/payment_service.xml
@@ -585,7 +661,6 @@ files:
585
661
  - test/test_helper.rb
586
662
  - test/unit/generic_application_test.rb
587
663
  - test/unit/http_test.rb
588
- - test/unit/http_tsl_12_upgrade_test.rb
589
664
  - test/unit/models/address_test.rb
590
665
  - test/unit/models/bank_transaction_model_parsing_test.rb
591
666
  - test/unit/models/bank_transaction_test.rb
@@ -605,12 +680,12 @@ files:
605
680
  - test/unit/models/prepayment_test.rb
606
681
  - test/unit/models/repeating_invoice_test.rb
607
682
  - test/unit/models/tax_rate_test.rb
683
+ - test/unit/oauth2_test.rb
608
684
  - test/unit/oauth_config_test.rb
609
- - test/unit/oauth_test.rb
610
- - test/unit/private_application_test.rb
611
685
  - test/unit/record/base_model_test.rb
612
686
  - test/unit/record/base_test.rb
613
687
  - test/unit/record/block_validator_test.rb
688
+ - test/unit/record/connection_test.rb
614
689
  - test/unit/record/model_definition_test.rb
615
690
  - test/unit/record/parse_params_test.rb
616
691
  - test/unit/record/parse_where_hash_test.rb
@@ -619,6 +694,7 @@ files:
619
694
  - test/unit/record_definition_test.rb
620
695
  - test/unit/report_definition_test.rb
621
696
  - test/unit/report_test.rb
697
+ - test/unit_test_helper.rb
622
698
  homepage: http://github.com/waynerobinson/xeroizer
623
699
  licenses:
624
700
  - MIT
@@ -628,7 +704,7 @@ metadata:
628
704
  source_code_uri: https://github.com/waynerobinson/xeroizer
629
705
  documentation_uri: https://developer.xero.com/documentation/
630
706
  mailing_list_uri: https://developer.xero.com/subscribe-to-the-xero-api-developer-mailing-list
631
- post_install_message:
707
+ post_install_message:
632
708
  rdoc_options: []
633
709
  require_paths:
634
710
  - lib
@@ -643,9 +719,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
643
719
  - !ruby/object:Gem::Version
644
720
  version: '0'
645
721
  requirements: []
646
- rubyforge_project:
647
- rubygems_version: 2.5.1
648
- signing_key:
722
+ rubygems_version: 3.2.3
723
+ signing_key:
649
724
  specification_version: 4
650
725
  summary: Ruby Library for Xero accounting API
651
726
  test_files:
@@ -657,10 +732,13 @@ test_files:
657
732
  - test/acceptance/bank_transaction_reference_data.rb
658
733
  - test/acceptance/bank_transfer_test.rb
659
734
  - test/acceptance/bulk_operations_test.rb
735
+ - test/acceptance/connections_test.rb
660
736
  - test/stub_responses/accounts.xml
661
737
  - test/stub_responses/api_exception.xml
738
+ - test/stub_responses/bad_request.json
662
739
  - test/stub_responses/bogus_oauth_error
663
740
  - test/stub_responses/branding_themes.xml
741
+ - test/stub_responses/connections.json
664
742
  - test/stub_responses/contact.xml
665
743
  - test/stub_responses/contact_with_details.xml
666
744
  - test/stub_responses/contacts.xml
@@ -671,9 +749,13 @@ test_files:
671
749
  - test/stub_responses/credit_notes.xml
672
750
  - test/stub_responses/currencies.xml
673
751
  - test/stub_responses/employees.xml
752
+ - test/stub_responses/expired_oauth2_token.json
753
+ - test/stub_responses/generic_response_error.json
674
754
  - test/stub_responses/invalid_api_key_error.xml
675
755
  - test/stub_responses/invalid_consumer_key
756
+ - test/stub_responses/invalid_oauth2_request_token.json
676
757
  - test/stub_responses/invalid_request_token
758
+ - test/stub_responses/invalid_tenant_header.json
677
759
  - test/stub_responses/invoice.xml
678
760
  - test/stub_responses/invoice_not_found_error.xml
679
761
  - test/stub_responses/invoices.xml
@@ -681,6 +763,7 @@ test_files:
681
763
  - test/stub_responses/manual_journal.xml
682
764
  - test/stub_responses/manual_journals.xml
683
765
  - test/stub_responses/nonce_used
766
+ - test/stub_responses/object_not_found.json
684
767
  - test/stub_responses/organisation.xml
685
768
  - test/stub_responses/organisations.xml
686
769
  - test/stub_responses/payment_service.xml
@@ -898,7 +981,6 @@ test_files:
898
981
  - test/test_helper.rb
899
982
  - test/unit/generic_application_test.rb
900
983
  - test/unit/http_test.rb
901
- - test/unit/http_tsl_12_upgrade_test.rb
902
984
  - test/unit/models/address_test.rb
903
985
  - test/unit/models/bank_transaction_model_parsing_test.rb
904
986
  - test/unit/models/bank_transaction_test.rb
@@ -918,12 +1000,12 @@ test_files:
918
1000
  - test/unit/models/prepayment_test.rb
919
1001
  - test/unit/models/repeating_invoice_test.rb
920
1002
  - test/unit/models/tax_rate_test.rb
1003
+ - test/unit/oauth2_test.rb
921
1004
  - test/unit/oauth_config_test.rb
922
- - test/unit/oauth_test.rb
923
- - test/unit/private_application_test.rb
924
1005
  - test/unit/record/base_model_test.rb
925
1006
  - test/unit/record/base_test.rb
926
1007
  - test/unit/record/block_validator_test.rb
1008
+ - test/unit/record/connection_test.rb
927
1009
  - test/unit/record/model_definition_test.rb
928
1010
  - test/unit/record/parse_params_test.rb
929
1011
  - test/unit/record/parse_where_hash_test.rb
@@ -932,3 +1014,4 @@ test_files:
932
1014
  - test/unit/record_definition_test.rb
933
1015
  - test/unit/report_definition_test.rb
934
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