xero-ruby 18.2.0 → 18.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/account_data_api.rb +419 -0
  3. data/lib/xero-ruby/api/payroll_nz_api.rb +2 -0
  4. data/lib/xero-ruby/api_client.rb +10 -0
  5. data/lib/xero-ruby/configuration.rb +2 -0
  6. data/lib/xero-ruby/models/account_data/account.rb +351 -0
  7. data/lib/xero-ruby/models/account_data/account_balance.rb +287 -0
  8. data/lib/xero-ruby/models/account_data/account_balances_response.rb +229 -0
  9. data/lib/xero-ruby/models/account_data/account_movement.rb +347 -0
  10. data/lib/xero-ruby/models/account_data/account_movements_response.rb +229 -0
  11. data/lib/xero-ruby/models/account_data/account_transaction_line.rb +359 -0
  12. data/lib/xero-ruby/models/account_data/account_transactions_response.rb +269 -0
  13. data/lib/xero-ruby/models/account_data/account_transactions_response_pagination.rb +243 -0
  14. data/lib/xero-ruby/models/account_data/accounting_date_range.rb +242 -0
  15. data/lib/xero-ruby/models/account_data/field_problem.rb +273 -0
  16. data/lib/xero-ruby/models/account_data/gateway_problem.rb +285 -0
  17. data/lib/xero-ruby/models/account_data/ledger_decimal.rb +278 -0
  18. data/lib/xero-ruby/models/account_data/line_source.rb +273 -0
  19. data/lib/xero-ruby/models/account_data/line_tax_rate.rb +243 -0
  20. data/lib/xero-ruby/models/account_data/problem_details.rb +273 -0
  21. data/lib/xero-ruby/models/account_data/tracking_item_details.rb +257 -0
  22. data/lib/xero-ruby/models/account_data/transaction_account.rb +366 -0
  23. data/lib/xero-ruby/models/account_data/validation_problem.rb +275 -0
  24. data/lib/xero-ruby/models/accounting/account.rb +11 -1
  25. data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +44 -6
  26. data/lib/xero-ruby/version.rb +2 -2
  27. data/lib/xero-ruby.rb +19 -0
  28. metadata +385 -366
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9723c121626d5cb4fc006c058b2d6bbc607ea4347f0a91c623bb8ffb5f157532
4
- data.tar.gz: 219e8c9de3d26987b848adc13f10c928041cef317951034cbe0ec2e445b0ff74
3
+ metadata.gz: 4d75be539ff0ad2fa0d3409f229972e17ae8fe55eb5991bef55106729e151f6a
4
+ data.tar.gz: 1a763242cf5d8037a7873fd0900d1ed16efa6f65e55820130efeed59e4d0803f
5
5
  SHA512:
6
- metadata.gz: ac3bd6c2cb80946187ccdf4353be83477651bf4a1a0c87371035d7eeea2f89fd72a728a5ba707fa8facab287f0e8c2701118448278e598da97327bb91f13241e
7
- data.tar.gz: '05391f17b69d1532418a0d18dde8d3b96ae91e6de92b8affe86074d006100470ff247f2f325833f544e71273d81b9eb556ac53d0215b9a6914ce44abc4ddf086'
6
+ metadata.gz: dc1addb974222e59ed8149e07587a8ca18c255f47366e4f40b6ed9247a23237815e7214a1191ab24750e30928e130d60876f88024cc8b9d35e4cd45247af07b8
7
+ data.tar.gz: 24a04f06fcd6349102160b3ee21d3092f3b89404d006b5a38d3b953f45751316c5886e0d47c156d8aedd29a816362bd9a76d3283a260f40517dce5dc4d7a361c
@@ -0,0 +1,419 @@
1
+ =begin
2
+ #Xero Account Data API (Beta)
3
+
4
+ #**Beta:** this API is in beta. Endpoints, request parameters and response shapes may change before general availability. The Account Data API provides read access to general ledger account data for a Xero organisation: account balances as at a date, account movements over a date range, and the individual account transactions behind them.
5
+
6
+ Contact: api@xero.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 4.3.1
9
+
10
+ =end
11
+
12
+ module XeroRuby
13
+ class AccountDataApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.new)
17
+ @api_client = api_client
18
+ end
19
+ # Get the balance of each general ledger account as at a given date
20
+ # Retrieves account balances as at `date`, optionally including balances for one or more prior comparison periods, and optionally filtered by account class, type, account IDs, system account code, or tracking item. ### Filtering - Filter by `class`, `type`, `accountIds`, and/or `systemAccountCodes`. These can be combined freely — when more than one is supplied, the server returns only accounts that match **all** of the supplied filters (an intersection, not a union). - `type` values are matched case-sensitively, so use uppercase (for example `BANK`). Inventory asset accounts are reported as, and can only be filtered by, `INVENTORY`; filtering by their underlying account type does not match them. - `trackingItemIds` and `unassignedToTrackingCategoryIds` can be used independently of the filters above to further narrow which accounts are returned. ### Comparison periods - Supplying `comparisonPeriodCount` together with `comparisonPeriodSize` returns additional balances at prior points in time, in addition to the balance at `date`. - The n-th comparison date is `date` shifted back n times `comparisonPeriodSize`. For `MONTH`, `QUARTER`, and `YEAR` sizes, a `date` that falls on the last day of its month keeps landing on the last day of the shifted month (so comparisons across February behave correctly). - `comparisonPeriodCount` and `comparisonPeriodSize` must be supplied together. ### Bank accounts Bank account data is only available to users with bank account view permission for the organisation. - If the request would include bank accounts and the user lacks this permission, it is rejected with `403 Forbidden`. A request is treated as including bank accounts when it has no account filters, filters by all five `class` values and nothing else, includes `BANK` in `type`, or lists a bank account in `accountIds`. - For other requests (for example `class=ASSET`), bank accounts are silently excluded from the response for users without this permission, instead of the request being rejected. ### Results Only accounts with a non-zero balance at a given date are returned; accounts and comparison dates with a net-zero balance are omitted, so the response can be empty. ### Pagination This endpoint does not paginate — all matching account balances are returned in a single response.
21
+ # @param accounting_basis [String] Accounting basis for the balance calculation.
22
+ # @param date [Date] The date to calculate account balances as at, in ISO 8601 format (YYYY-MM-DD).
23
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Integer] :comparison_period_count Number of additional comparison balances to return, each one further back in time than the last. Must be supplied together with `comparisonPeriodSize`. - **Minimum**: 1 - **Maximum**: 100
26
+ # @option opts [String] :comparison_period_size The unit of time each comparison period steps back by. Must be supplied together with `comparisonPeriodCount`.
27
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. - **Maximum**: 50 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
28
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters.
29
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters.
30
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Can be combined with other filters.
31
+ # @option opts [Array<String>] :tracking_item_ids Filter to accounts assigned to any of the given tracking item IDs.
32
+ # @option opts [Array<String>] :unassigned_to_tracking_category_ids Filter to accounts that are not assigned to any tracking option within the given tracking category IDs.
33
+ # @return [AccountBalancesResponse]
34
+ def get_account_balances(accounting_basis, date, xero_tenant_id, opts = {})
35
+ data, _status_code, _headers = get_account_balances_with_http_info(accounting_basis, date, xero_tenant_id, opts)
36
+ data
37
+ end
38
+
39
+ # Get the balance of each general ledger account as at a given date
40
+ # Retrieves account balances as at &#x60;date&#x60;, optionally including balances for one or more prior comparison periods, and optionally filtered by account class, type, account IDs, system account code, or tracking item. ### Filtering - Filter by &#x60;class&#x60;, &#x60;type&#x60;, &#x60;accountIds&#x60;, and/or &#x60;systemAccountCodes&#x60;. These can be combined freely — when more than one is supplied, the server returns only accounts that match **all** of the supplied filters (an intersection, not a union). - &#x60;type&#x60; values are matched case-sensitively, so use uppercase (for example &#x60;BANK&#x60;). Inventory asset accounts are reported as, and can only be filtered by, &#x60;INVENTORY&#x60;; filtering by their underlying account type does not match them. - &#x60;trackingItemIds&#x60; and &#x60;unassignedToTrackingCategoryIds&#x60; can be used independently of the filters above to further narrow which accounts are returned. ### Comparison periods - Supplying &#x60;comparisonPeriodCount&#x60; together with &#x60;comparisonPeriodSize&#x60; returns additional balances at prior points in time, in addition to the balance at &#x60;date&#x60;. - The n-th comparison date is &#x60;date&#x60; shifted back n times &#x60;comparisonPeriodSize&#x60;. For &#x60;MONTH&#x60;, &#x60;QUARTER&#x60;, and &#x60;YEAR&#x60; sizes, a &#x60;date&#x60; that falls on the last day of its month keeps landing on the last day of the shifted month (so comparisons across February behave correctly). - &#x60;comparisonPeriodCount&#x60; and &#x60;comparisonPeriodSize&#x60; must be supplied together. ### Bank accounts Bank account data is only available to users with bank account view permission for the organisation. - If the request would include bank accounts and the user lacks this permission, it is rejected with &#x60;403 Forbidden&#x60;. A request is treated as including bank accounts when it has no account filters, filters by all five &#x60;class&#x60; values and nothing else, includes &#x60;BANK&#x60; in &#x60;type&#x60;, or lists a bank account in &#x60;accountIds&#x60;. - For other requests (for example &#x60;class&#x3D;ASSET&#x60;), bank accounts are silently excluded from the response for users without this permission, instead of the request being rejected. ### Results Only accounts with a non-zero balance at a given date are returned; accounts and comparison dates with a net-zero balance are omitted, so the response can be empty. ### Pagination This endpoint does not paginate — all matching account balances are returned in a single response.
41
+ # @param accounting_basis [String] Accounting basis for the balance calculation.
42
+ # @param date [Date] The date to calculate account balances as at, in ISO 8601 format (YYYY-MM-DD).
43
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
44
+ # @param [Hash] opts the optional parameters
45
+ # @option opts [Integer] :comparison_period_count Number of additional comparison balances to return, each one further back in time than the last. Must be supplied together with &#x60;comparisonPeriodSize&#x60;. - **Minimum**: 1 - **Maximum**: 100
46
+ # @option opts [String] :comparison_period_size The unit of time each comparison period steps back by. Must be supplied together with &#x60;comparisonPeriodCount&#x60;.
47
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. - **Maximum**: 50 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
48
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters.
49
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters.
50
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Can be combined with other filters.
51
+ # @option opts [Array<String>] :tracking_item_ids Filter to accounts assigned to any of the given tracking item IDs.
52
+ # @option opts [Array<String>] :unassigned_to_tracking_category_ids Filter to accounts that are not assigned to any tracking option within the given tracking category IDs.
53
+ # @return [Array<(AccountBalancesResponse, Integer, Hash)>] AccountBalancesResponse data, response status code and response headers
54
+ def get_account_balances_with_http_info(accounting_basis, date, xero_tenant_id, options = {})
55
+ opts = options.dup
56
+ if @api_client.config.debugging
57
+ @api_client.config.logger.debug 'Calling API: AccountDataApi.get_account_balances ...'
58
+ end
59
+ # verify the required parameter 'accounting_basis' is set
60
+ if @api_client.config.client_side_validation && accounting_basis.nil?
61
+ fail ArgumentError, "Missing the required parameter 'accounting_basis' when calling AccountDataApi.get_account_balances"
62
+ end
63
+ # verify enum value
64
+ allowable_values = ["ACCRUAL", "CASH"]
65
+ if @api_client.config.client_side_validation && !allowable_values.include?(accounting_basis)
66
+ fail ArgumentError, "invalid value for \"accounting_basis\", must be one of #{allowable_values}"
67
+ end
68
+ # verify the required parameter 'date' is set
69
+ if @api_client.config.client_side_validation && date.nil?
70
+ fail ArgumentError, "Missing the required parameter 'date' when calling AccountDataApi.get_account_balances"
71
+ end
72
+ # verify the required parameter 'xero_tenant_id' is set
73
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
74
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountDataApi.get_account_balances"
75
+ end
76
+ if @api_client.config.client_side_validation && !opts[:'comparison_period_count'].nil? && opts[:'comparison_period_count'] > 100
77
+ fail ArgumentError, 'invalid value for "opts[:"comparison_period_count"]" when calling AccountDataApi.get_account_balances, must be smaller than or equal to 100.'
78
+ end
79
+
80
+ if @api_client.config.client_side_validation && !opts[:'comparison_period_count'].nil? && opts[:'comparison_period_count'] < 1
81
+ fail ArgumentError, 'invalid value for "opts[:"comparison_period_count"]" when calling AccountDataApi.get_account_balances, must be greater than or equal to 1.'
82
+ end
83
+
84
+ allowable_values = ["DAY", "WEEK", "MONTH", "QUARTER", "YEAR"]
85
+ if @api_client.config.client_side_validation && opts[:'comparison_period_size'] && !allowable_values.include?(opts[:'comparison_period_size'])
86
+ fail ArgumentError, "invalid value for \"comparison_period_size\", must be one of #{allowable_values}"
87
+ end
88
+ if @api_client.config.client_side_validation && !opts[:'account_ids'].nil? && opts[:'account_ids'].length > 50
89
+ fail ArgumentError, 'invalid value for "opts[:"account_ids"]" when calling AccountDataApi.get_account_balances, number of items must be less than or equal to 50.'
90
+ end
91
+
92
+ allowable_values = ["ASSET", "LIABILITY", "EQUITY", "REVENUE", "EXPENSE"]
93
+ if @api_client.config.client_side_validation && opts[:'_class'] && !opts[:'_class'].all? { |item| allowable_values.include?(item) }
94
+ fail ArgumentError, "invalid value for \"_class\", must include one of #{allowable_values}"
95
+ end
96
+ # resource path
97
+ local_var_path = '/account-balances'
98
+
99
+ # camelize keys of incoming `where` opts
100
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
101
+
102
+ # query parameters
103
+ query_params = opts[:query_params] || {}
104
+ query_params[:'accountingBasis'] = accounting_basis
105
+ query_params[:'date'] = date
106
+ query_params[:'comparisonPeriodCount'] = opts[:'comparison_period_count'] if !opts[:'comparison_period_count'].nil?
107
+ query_params[:'comparisonPeriodSize'] = opts[:'comparison_period_size'] if !opts[:'comparison_period_size'].nil?
108
+ query_params[:'accountIds'] = @api_client.build_collection_param(opts[:'account_ids'], :multi) if !opts[:'account_ids'].nil?
109
+ query_params[:'class'] = @api_client.build_collection_param(opts[:'_class'], :multi) if !opts[:'_class'].nil?
110
+ query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if !opts[:'type'].nil?
111
+ query_params[:'systemAccountCodes'] = @api_client.build_collection_param(opts[:'system_account_codes'], :multi) if !opts[:'system_account_codes'].nil?
112
+ query_params[:'trackingItemIds'] = @api_client.build_collection_param(opts[:'tracking_item_ids'], :multi) if !opts[:'tracking_item_ids'].nil?
113
+ query_params[:'unassignedToTrackingCategoryIds'] = @api_client.build_collection_param(opts[:'unassigned_to_tracking_category_ids'], :multi) if !opts[:'unassigned_to_tracking_category_ids'].nil?
114
+
115
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
116
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
117
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
123
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
124
+
125
+ # form parameters
126
+ form_params = opts[:form_params] || {}
127
+
128
+ # http body (model)
129
+ post_body = opts[:body]
130
+
131
+ # return_type
132
+ return_type = opts[:return_type] || 'AccountBalancesResponse'
133
+
134
+ # auth_names
135
+ auth_names = opts[:auth_names] || ['OAuth2']
136
+
137
+ new_options = opts.merge(
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountDataApi", new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: AccountDataApi#get_account_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Get the net movement of each general ledger account over a date range
154
+ # Retrieves account movements between `startDate` and `endDate`, optionally including movements for one or more prior comparison periods of the same length, and optionally filtered by account class, type, account IDs, system account code, or tracking item. ### Filtering - Filter by `class`, `type`, `accountIds`, and/or `systemAccountCodes`. These can be combined freely — when more than one is supplied, the server returns only accounts that match **all** of the supplied filters (an intersection, not a union). - `type` values are matched case-sensitively, so use uppercase (for example `BANK`). Inventory asset accounts are reported as, and can only be filtered by, `INVENTORY`; filtering by their underlying account type does not match them. - `trackingItemIds` and `unassignedToTrackingCategoryIds` can be used independently of the filters above to further narrow which accounts are returned. ### Comparison periods - Supplying `comparisonPeriodCount` together with `comparisonPeriodSize` returns additional movements for prior date ranges of the same length, in addition to the movement between `startDate` and `endDate`. - Each comparison range is calculated by moving the primary range back by `comparisonPeriodSize`, `comparisonPeriodCount` times. For `MONTH`, `QUARTER`, and `YEAR` sizes, range boundaries that fall on the last day of a month keep landing on the last day of the shifted month. - `comparisonPeriodCount` and `comparisonPeriodSize` must be supplied together. - The primary range and every comparison range must not overlap each other. A request whose periods would overlap is rejected with `400 Bad Request`. Ranges that share a single boundary day count as overlapping, which month-end adjustment can cause when shifting by `MONTH`, `QUARTER`, or `YEAR`. ### Bank accounts Bank account data is only available to users with bank account view permission for the organisation. - If the request would include bank accounts and the user lacks this permission, it is rejected with `403 Forbidden`. A request is treated as including bank accounts when it has no account filters, filters by all five `class` values and nothing else, includes `BANK` in `type`, or lists a bank account in `accountIds`. - For other requests (for example `class=ASSET`), bank accounts are silently excluded from the response for users without this permission, instead of the request being rejected. ### Pagination This endpoint does not paginate — the full set of matching account movements is returned in a single response. ### Results Only combinations of account and date range with non-zero movement are returned; comparison ranges are not zero-filled. The response is a flat list with no guaranteed ordering.
155
+ # @param accounting_basis [String] Accounting basis for the movement calculation.
156
+ # @param start_date [Date] Start date of the movement range, in ISO 8601 format (YYYY-MM-DD).
157
+ # @param end_date [Date] End date of the movement range, in ISO 8601 format (YYYY-MM-DD).
158
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
159
+ # @param [Hash] opts the optional parameters
160
+ # @option opts [Integer] :comparison_period_count Number of additional comparison movements to return, each covering a range further back in time than the last. Must be supplied together with &#x60;comparisonPeriodSize&#x60;. - **Minimum**: 1 - **Maximum**: 100
161
+ # @option opts [String] :comparison_period_size The unit of time each comparison range steps back by. Must be supplied together with &#x60;comparisonPeriodCount&#x60;.
162
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. - **Maximum**: 50 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
163
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters.
164
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters.
165
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Can be combined with other filters.
166
+ # @option opts [Array<String>] :tracking_item_ids Filter to accounts assigned to any of the given tracking item IDs.
167
+ # @option opts [Array<String>] :unassigned_to_tracking_category_ids Filter to accounts that are not assigned to any tracking option within the given tracking category IDs.
168
+ # @return [AccountMovementsResponse]
169
+ def get_account_movements(accounting_basis, start_date, end_date, xero_tenant_id, opts = {})
170
+ data, _status_code, _headers = get_account_movements_with_http_info(accounting_basis, start_date, end_date, xero_tenant_id, opts)
171
+ data
172
+ end
173
+
174
+ # Get the net movement of each general ledger account over a date range
175
+ # Retrieves account movements between &#x60;startDate&#x60; and &#x60;endDate&#x60;, optionally including movements for one or more prior comparison periods of the same length, and optionally filtered by account class, type, account IDs, system account code, or tracking item. ### Filtering - Filter by &#x60;class&#x60;, &#x60;type&#x60;, &#x60;accountIds&#x60;, and/or &#x60;systemAccountCodes&#x60;. These can be combined freely — when more than one is supplied, the server returns only accounts that match **all** of the supplied filters (an intersection, not a union). - &#x60;type&#x60; values are matched case-sensitively, so use uppercase (for example &#x60;BANK&#x60;). Inventory asset accounts are reported as, and can only be filtered by, &#x60;INVENTORY&#x60;; filtering by their underlying account type does not match them. - &#x60;trackingItemIds&#x60; and &#x60;unassignedToTrackingCategoryIds&#x60; can be used independently of the filters above to further narrow which accounts are returned. ### Comparison periods - Supplying &#x60;comparisonPeriodCount&#x60; together with &#x60;comparisonPeriodSize&#x60; returns additional movements for prior date ranges of the same length, in addition to the movement between &#x60;startDate&#x60; and &#x60;endDate&#x60;. - Each comparison range is calculated by moving the primary range back by &#x60;comparisonPeriodSize&#x60;, &#x60;comparisonPeriodCount&#x60; times. For &#x60;MONTH&#x60;, &#x60;QUARTER&#x60;, and &#x60;YEAR&#x60; sizes, range boundaries that fall on the last day of a month keep landing on the last day of the shifted month. - &#x60;comparisonPeriodCount&#x60; and &#x60;comparisonPeriodSize&#x60; must be supplied together. - The primary range and every comparison range must not overlap each other. A request whose periods would overlap is rejected with &#x60;400 Bad Request&#x60;. Ranges that share a single boundary day count as overlapping, which month-end adjustment can cause when shifting by &#x60;MONTH&#x60;, &#x60;QUARTER&#x60;, or &#x60;YEAR&#x60;. ### Bank accounts Bank account data is only available to users with bank account view permission for the organisation. - If the request would include bank accounts and the user lacks this permission, it is rejected with &#x60;403 Forbidden&#x60;. A request is treated as including bank accounts when it has no account filters, filters by all five &#x60;class&#x60; values and nothing else, includes &#x60;BANK&#x60; in &#x60;type&#x60;, or lists a bank account in &#x60;accountIds&#x60;. - For other requests (for example &#x60;class&#x3D;ASSET&#x60;), bank accounts are silently excluded from the response for users without this permission, instead of the request being rejected. ### Pagination This endpoint does not paginate — the full set of matching account movements is returned in a single response. ### Results Only combinations of account and date range with non-zero movement are returned; comparison ranges are not zero-filled. The response is a flat list with no guaranteed ordering.
176
+ # @param accounting_basis [String] Accounting basis for the movement calculation.
177
+ # @param start_date [Date] Start date of the movement range, in ISO 8601 format (YYYY-MM-DD).
178
+ # @param end_date [Date] End date of the movement range, in ISO 8601 format (YYYY-MM-DD).
179
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
180
+ # @param [Hash] opts the optional parameters
181
+ # @option opts [Integer] :comparison_period_count Number of additional comparison movements to return, each covering a range further back in time than the last. Must be supplied together with &#x60;comparisonPeriodSize&#x60;. - **Minimum**: 1 - **Maximum**: 100
182
+ # @option opts [String] :comparison_period_size The unit of time each comparison range steps back by. Must be supplied together with &#x60;comparisonPeriodCount&#x60;.
183
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. - **Maximum**: 50 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
184
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters.
185
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters.
186
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Can be combined with other filters.
187
+ # @option opts [Array<String>] :tracking_item_ids Filter to accounts assigned to any of the given tracking item IDs.
188
+ # @option opts [Array<String>] :unassigned_to_tracking_category_ids Filter to accounts that are not assigned to any tracking option within the given tracking category IDs.
189
+ # @return [Array<(AccountMovementsResponse, Integer, Hash)>] AccountMovementsResponse data, response status code and response headers
190
+ def get_account_movements_with_http_info(accounting_basis, start_date, end_date, xero_tenant_id, options = {})
191
+ opts = options.dup
192
+ if @api_client.config.debugging
193
+ @api_client.config.logger.debug 'Calling API: AccountDataApi.get_account_movements ...'
194
+ end
195
+ # verify the required parameter 'accounting_basis' is set
196
+ if @api_client.config.client_side_validation && accounting_basis.nil?
197
+ fail ArgumentError, "Missing the required parameter 'accounting_basis' when calling AccountDataApi.get_account_movements"
198
+ end
199
+ # verify enum value
200
+ allowable_values = ["ACCRUAL", "CASH"]
201
+ if @api_client.config.client_side_validation && !allowable_values.include?(accounting_basis)
202
+ fail ArgumentError, "invalid value for \"accounting_basis\", must be one of #{allowable_values}"
203
+ end
204
+ # verify the required parameter 'start_date' is set
205
+ if @api_client.config.client_side_validation && start_date.nil?
206
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AccountDataApi.get_account_movements"
207
+ end
208
+ # verify the required parameter 'end_date' is set
209
+ if @api_client.config.client_side_validation && end_date.nil?
210
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AccountDataApi.get_account_movements"
211
+ end
212
+ # verify the required parameter 'xero_tenant_id' is set
213
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
214
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountDataApi.get_account_movements"
215
+ end
216
+ if @api_client.config.client_side_validation && !opts[:'comparison_period_count'].nil? && opts[:'comparison_period_count'] > 100
217
+ fail ArgumentError, 'invalid value for "opts[:"comparison_period_count"]" when calling AccountDataApi.get_account_movements, must be smaller than or equal to 100.'
218
+ end
219
+
220
+ if @api_client.config.client_side_validation && !opts[:'comparison_period_count'].nil? && opts[:'comparison_period_count'] < 1
221
+ fail ArgumentError, 'invalid value for "opts[:"comparison_period_count"]" when calling AccountDataApi.get_account_movements, must be greater than or equal to 1.'
222
+ end
223
+
224
+ allowable_values = ["DAY", "WEEK", "MONTH", "QUARTER", "YEAR"]
225
+ if @api_client.config.client_side_validation && opts[:'comparison_period_size'] && !allowable_values.include?(opts[:'comparison_period_size'])
226
+ fail ArgumentError, "invalid value for \"comparison_period_size\", must be one of #{allowable_values}"
227
+ end
228
+ if @api_client.config.client_side_validation && !opts[:'account_ids'].nil? && opts[:'account_ids'].length > 50
229
+ fail ArgumentError, 'invalid value for "opts[:"account_ids"]" when calling AccountDataApi.get_account_movements, number of items must be less than or equal to 50.'
230
+ end
231
+
232
+ allowable_values = ["ASSET", "LIABILITY", "EQUITY", "REVENUE", "EXPENSE"]
233
+ if @api_client.config.client_side_validation && opts[:'_class'] && !opts[:'_class'].all? { |item| allowable_values.include?(item) }
234
+ fail ArgumentError, "invalid value for \"_class\", must include one of #{allowable_values}"
235
+ end
236
+ # resource path
237
+ local_var_path = '/account-movements'
238
+
239
+ # camelize keys of incoming `where` opts
240
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
241
+
242
+ # query parameters
243
+ query_params = opts[:query_params] || {}
244
+ query_params[:'accountingBasis'] = accounting_basis
245
+ query_params[:'startDate'] = start_date
246
+ query_params[:'endDate'] = end_date
247
+ query_params[:'comparisonPeriodCount'] = opts[:'comparison_period_count'] if !opts[:'comparison_period_count'].nil?
248
+ query_params[:'comparisonPeriodSize'] = opts[:'comparison_period_size'] if !opts[:'comparison_period_size'].nil?
249
+ query_params[:'accountIds'] = @api_client.build_collection_param(opts[:'account_ids'], :multi) if !opts[:'account_ids'].nil?
250
+ query_params[:'class'] = @api_client.build_collection_param(opts[:'_class'], :multi) if !opts[:'_class'].nil?
251
+ query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if !opts[:'type'].nil?
252
+ query_params[:'systemAccountCodes'] = @api_client.build_collection_param(opts[:'system_account_codes'], :multi) if !opts[:'system_account_codes'].nil?
253
+ query_params[:'trackingItemIds'] = @api_client.build_collection_param(opts[:'tracking_item_ids'], :multi) if !opts[:'tracking_item_ids'].nil?
254
+ query_params[:'unassignedToTrackingCategoryIds'] = @api_client.build_collection_param(opts[:'unassigned_to_tracking_category_ids'], :multi) if !opts[:'unassigned_to_tracking_category_ids'].nil?
255
+
256
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
257
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
258
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
259
+
260
+ # header parameters
261
+ header_params = opts[:header_params] || {}
262
+ # HTTP header 'Accept' (if needed)
263
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
264
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
265
+
266
+ # form parameters
267
+ form_params = opts[:form_params] || {}
268
+
269
+ # http body (model)
270
+ post_body = opts[:body]
271
+
272
+ # return_type
273
+ return_type = opts[:return_type] || 'AccountMovementsResponse'
274
+
275
+ # auth_names
276
+ auth_names = opts[:auth_names] || ['OAuth2']
277
+
278
+ new_options = opts.merge(
279
+ :header_params => header_params,
280
+ :query_params => query_params,
281
+ :form_params => form_params,
282
+ :body => post_body,
283
+ :auth_names => auth_names,
284
+ :return_type => return_type
285
+ )
286
+
287
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountDataApi", new_options)
288
+ if @api_client.config.debugging
289
+ @api_client.config.logger.debug "API called: AccountDataApi#get_account_movements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
290
+ end
291
+ return data, status_code, headers
292
+ end
293
+
294
+ # Get general ledger account transactions between two dates, with pagination and filtering
295
+ # Retrieves transactions posted between `startDate` and `endDate` (inclusive), optionally filtered by account IDs, class, type, or system account code, with cursor-based pagination for large result sets. **First call:** omit `token`. Supply `accountingBasis`, `startDate`, and `endDate` (all required), plus any optional filters. **Continuation calls:** supply only `token`, taken from the previous response's `pagination.nextToken`. Do not send any other query parameters — they are ignored if present, since the original request is captured by the token. ### Pagination - Results are returned in pages of 200 lines. - Use `pagination.nextToken` from the response as the `token` query parameter to fetch the next page. Send only the `token` query parameter on continuation requests — all other query parameters are ignored on a continuation call, since the original request's parameters are already captured by the token. - The `token` value is an opaque string. Treat it as an opaque string only — do not parse, modify, or construct it yourself. Tokens may expire. - When `pagination` is `null`, you've reached the last page. - The API captures a consistent snapshot at the time of the first request (via `maxJournalNumber`), so transactions added while you are paginating through a result set won't appear partway through, and won't cause duplicates or gaps. ### Filtering - Filter by `accountIds`, `class`, `type`, and/or `systemAccountCodes`. These can be combined freely — when more than one is supplied, the server returns only transactions for accounts that match **all** of the supplied filters (an intersection, not a union). - `type` values are matched case-sensitively, so use uppercase (for example `BANK`). Inventory asset accounts are reported as, and can only be filtered by, `INVENTORY`; filtering by their underlying account type does not match them. - Use `systemAccountCodes=NONE` to match accounts that have no system account code. - Filters are only read from the first request in a pagination sequence — see Pagination above. ### Bank accounts Bank account transactions are only available to users with bank account view permission for the organisation. - If the user lacks this permission and the request includes `BANK` in `type`, or lists a bank account in `accountIds`, it is rejected with `403 Forbidden`. - For all other requests, including unfiltered requests, bank account transactions are silently excluded from the results for users without this permission.
296
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
297
+ # @param [Hash] opts the optional parameters
298
+ # @option opts [String] :accounting_basis Accounting basis for the transaction query. Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
299
+ # @option opts [Date] :start_date Start date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
300
+ # @option opts [Date] :end_date End date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
301
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. Only used on the first call. - **Maximum**: 20 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
302
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters. Only used on the first call.
303
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters. Only used on the first call.
304
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Use &#x60;NONE&#x60; to match accounts with no system account code. Can be combined with other filters. Only used on the first call.
305
+ # @option opts [Array<String>] :include Additional data to include in the response. Only used on the first call.
306
+ # @option opts [Integer] :max_journal_number Maximum journal number to include in results, for point-in-time queries. If omitted, the server captures the current maximum journal number at the time of the first request and reuses it for every subsequent page, so the whole paginated result set is consistent as at the moment you started. Only used on the first call.
307
+ # @option opts [String] :token Continuation token from a previous response&#39;s &#x60;pagination.nextToken&#x60;. When present, all other query parameters are ignored. Opaque — do not parse, modify, or construct it.
308
+ # @return [AccountTransactionsResponse]
309
+ def get_account_transactions(xero_tenant_id, opts = {})
310
+ data, _status_code, _headers = get_account_transactions_with_http_info(xero_tenant_id, opts)
311
+ data
312
+ end
313
+
314
+ # Get general ledger account transactions between two dates, with pagination and filtering
315
+ # Retrieves transactions posted between &#x60;startDate&#x60; and &#x60;endDate&#x60; (inclusive), optionally filtered by account IDs, class, type, or system account code, with cursor-based pagination for large result sets. **First call:** omit &#x60;token&#x60;. Supply &#x60;accountingBasis&#x60;, &#x60;startDate&#x60;, and &#x60;endDate&#x60; (all required), plus any optional filters. **Continuation calls:** supply only &#x60;token&#x60;, taken from the previous response&#39;s &#x60;pagination.nextToken&#x60;. Do not send any other query parameters — they are ignored if present, since the original request is captured by the token. ### Pagination - Results are returned in pages of 200 lines. - Use &#x60;pagination.nextToken&#x60; from the response as the &#x60;token&#x60; query parameter to fetch the next page. Send only the &#x60;token&#x60; query parameter on continuation requests — all other query parameters are ignored on a continuation call, since the original request&#39;s parameters are already captured by the token. - The &#x60;token&#x60; value is an opaque string. Treat it as an opaque string only — do not parse, modify, or construct it yourself. Tokens may expire. - When &#x60;pagination&#x60; is &#x60;null&#x60;, you&#39;ve reached the last page. - The API captures a consistent snapshot at the time of the first request (via &#x60;maxJournalNumber&#x60;), so transactions added while you are paginating through a result set won&#39;t appear partway through, and won&#39;t cause duplicates or gaps. ### Filtering - Filter by &#x60;accountIds&#x60;, &#x60;class&#x60;, &#x60;type&#x60;, and/or &#x60;systemAccountCodes&#x60;. These can be combined freely — when more than one is supplied, the server returns only transactions for accounts that match **all** of the supplied filters (an intersection, not a union). - &#x60;type&#x60; values are matched case-sensitively, so use uppercase (for example &#x60;BANK&#x60;). Inventory asset accounts are reported as, and can only be filtered by, &#x60;INVENTORY&#x60;; filtering by their underlying account type does not match them. - Use &#x60;systemAccountCodes&#x3D;NONE&#x60; to match accounts that have no system account code. - Filters are only read from the first request in a pagination sequence — see Pagination above. ### Bank accounts Bank account transactions are only available to users with bank account view permission for the organisation. - If the user lacks this permission and the request includes &#x60;BANK&#x60; in &#x60;type&#x60;, or lists a bank account in &#x60;accountIds&#x60;, it is rejected with &#x60;403 Forbidden&#x60;. - For all other requests, including unfiltered requests, bank account transactions are silently excluded from the results for users without this permission.
316
+ # @param xero_tenant_id [String] The ID of the Xero organisation to query.
317
+ # @param [Hash] opts the optional parameters
318
+ # @option opts [String] :accounting_basis Accounting basis for the transaction query. Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
319
+ # @option opts [Date] :start_date Start date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
320
+ # @option opts [Date] :end_date End date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not used (and ignored) on continuation calls made with &#x60;token&#x60;.
321
+ # @option opts [Array<String>] :account_ids Filter to specific account IDs (GUIDs). Repeat the parameter for multiple accounts. Only used on the first call. - **Maximum**: 20 account IDs - **Validation**: Returns 404 if any ID does not exist for the organisation
322
+ # @option opts [Array<String>] :_class Account classes to filter by. Can be combined with other filters. Only used on the first call.
323
+ # @option opts [Array<String>] :type Account types to filter by (e.g. &#x60;BANK&#x60;, &#x60;CURRENT&#x60;, etc). Use &#x60;INVENTORY&#x60; to match inventory asset accounts, regardless of their underlying account type. Can be combined with other filters. Only used on the first call.
324
+ # @option opts [Array<String>] :system_account_codes System account codes to filter by (e.g. &#x60;RETAINEDEARNINGS&#x60;, &#x60;UNREALISEDGAINS&#x60;). Use &#x60;NONE&#x60; to match accounts with no system account code. Can be combined with other filters. Only used on the first call.
325
+ # @option opts [Array<String>] :include Additional data to include in the response. Only used on the first call.
326
+ # @option opts [Integer] :max_journal_number Maximum journal number to include in results, for point-in-time queries. If omitted, the server captures the current maximum journal number at the time of the first request and reuses it for every subsequent page, so the whole paginated result set is consistent as at the moment you started. Only used on the first call.
327
+ # @option opts [String] :token Continuation token from a previous response&#39;s &#x60;pagination.nextToken&#x60;. When present, all other query parameters are ignored. Opaque — do not parse, modify, or construct it.
328
+ # @return [Array<(AccountTransactionsResponse, Integer, Hash)>] AccountTransactionsResponse data, response status code and response headers
329
+ def get_account_transactions_with_http_info(xero_tenant_id, options = {})
330
+ opts = options.dup
331
+ if @api_client.config.debugging
332
+ @api_client.config.logger.debug 'Calling API: AccountDataApi.get_account_transactions ...'
333
+ end
334
+ # verify the required parameter 'xero_tenant_id' is set
335
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
336
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountDataApi.get_account_transactions"
337
+ end
338
+ allowable_values = ["ACCRUAL", "CASH"]
339
+ if @api_client.config.client_side_validation && opts[:'accounting_basis'] && !allowable_values.include?(opts[:'accounting_basis'])
340
+ fail ArgumentError, "invalid value for \"accounting_basis\", must be one of #{allowable_values}"
341
+ end
342
+ if @api_client.config.client_side_validation && !opts[:'account_ids'].nil? && opts[:'account_ids'].length > 20
343
+ fail ArgumentError, 'invalid value for "opts[:"account_ids"]" when calling AccountDataApi.get_account_transactions, number of items must be less than or equal to 20.'
344
+ end
345
+
346
+ if @api_client.config.client_side_validation && !opts[:'account_ids'].nil? && opts[:'account_ids'].length < 1
347
+ fail ArgumentError, 'invalid value for "opts[:"account_ids"]" when calling AccountDataApi.get_account_transactions, number of items must be greater than or equal to 1.'
348
+ end
349
+
350
+ allowable_values = ["ASSET", "LIABILITY", "EQUITY", "REVENUE", "EXPENSE"]
351
+ if @api_client.config.client_side_validation && opts[:'_class'] && !opts[:'_class'].all? { |item| allowable_values.include?(item) }
352
+ fail ArgumentError, "invalid value for \"_class\", must include one of #{allowable_values}"
353
+ end
354
+ allowable_values = ["trackingCategories"]
355
+ if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
356
+ fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
357
+ end
358
+ if @api_client.config.client_side_validation && !opts[:'max_journal_number'].nil? && opts[:'max_journal_number'] < 0
359
+ fail ArgumentError, 'invalid value for "opts[:"max_journal_number"]" when calling AccountDataApi.get_account_transactions, must be greater than or equal to 0.'
360
+ end
361
+
362
+ # resource path
363
+ local_var_path = '/account-transactions'
364
+
365
+ # camelize keys of incoming `where` opts
366
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
367
+
368
+ # query parameters
369
+ query_params = opts[:query_params] || {}
370
+ query_params[:'accountingBasis'] = opts[:'accounting_basis'] if !opts[:'accounting_basis'].nil?
371
+ query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
372
+ query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
373
+ query_params[:'accountIds'] = @api_client.build_collection_param(opts[:'account_ids'], :multi) if !opts[:'account_ids'].nil?
374
+ query_params[:'class'] = @api_client.build_collection_param(opts[:'_class'], :multi) if !opts[:'_class'].nil?
375
+ query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if !opts[:'type'].nil?
376
+ query_params[:'systemAccountCodes'] = @api_client.build_collection_param(opts[:'system_account_codes'], :multi) if !opts[:'system_account_codes'].nil?
377
+ query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if !opts[:'include'].nil?
378
+ query_params[:'maxJournalNumber'] = opts[:'max_journal_number'] if !opts[:'max_journal_number'].nil?
379
+ query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?
380
+
381
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
382
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
383
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
384
+
385
+ # header parameters
386
+ header_params = opts[:header_params] || {}
387
+ # HTTP header 'Accept' (if needed)
388
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
389
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
390
+
391
+ # form parameters
392
+ form_params = opts[:form_params] || {}
393
+
394
+ # http body (model)
395
+ post_body = opts[:body]
396
+
397
+ # return_type
398
+ return_type = opts[:return_type] || 'AccountTransactionsResponse'
399
+
400
+ # auth_names
401
+ auth_names = opts[:auth_names] || ['OAuth2']
402
+
403
+ new_options = opts.merge(
404
+ :header_params => header_params,
405
+ :query_params => query_params,
406
+ :form_params => form_params,
407
+ :body => post_body,
408
+ :auth_names => auth_names,
409
+ :return_type => return_type
410
+ )
411
+
412
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountDataApi", new_options)
413
+ if @api_client.config.debugging
414
+ @api_client.config.logger.debug "API called: AccountDataApi#get_account_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
415
+ end
416
+ return data, status_code, headers
417
+ end
418
+ end
419
+ end
@@ -5392,6 +5392,7 @@ module XeroRuby
5392
5392
  end
5393
5393
 
5394
5394
  # Updates the tax records for a specific employee
5395
+ # Replaces the entire EmployeeTax record. This is not a partial update. Any field omitted from the request is treated as null and overwrites the stored value. To change individual fields, GET the current record, merge your changes, remove deprecated fields such as isEligibleForKiwiSaver, and POST the complete object.
5395
5396
  # @param xero_tenant_id [String] Xero identifier for Tenant
5396
5397
  # @param employee_id [String] Employee id for single object
5397
5398
  # @param employee_tax [EmployeeTax]
@@ -5404,6 +5405,7 @@ module XeroRuby
5404
5405
  end
5405
5406
 
5406
5407
  # Updates the tax records for a specific employee
5408
+ # Replaces the entire EmployeeTax record. This is not a partial update. Any field omitted from the request is treated as null and overwrites the stored value. To change individual fields, GET the current record, merge your changes, remove deprecated fields such as isEligibleForKiwiSaver, and POST the complete object.
5407
5409
  # @param xero_tenant_id [String] Xero identifier for Tenant
5408
5410
  # @param employee_id [String] Employee id for single object
5409
5411
  # @param employee_tax [EmployeeTax]
@@ -115,6 +115,11 @@ module XeroRuby
115
115
  XeroRuby::FinanceApi.new(self)
116
116
  end
117
117
 
118
+ def account_data_api
119
+ @config.base_url = @config.account_data_url
120
+ XeroRuby::AccountDataApi.new(self)
121
+ end
122
+
118
123
  # Token Helpers
119
124
  def token_set
120
125
  @config.token_set
@@ -299,11 +304,14 @@ module XeroRuby
299
304
  method_base_url = @config.app_store_url
300
305
  when "FinanceApi"
301
306
  method_base_url = @config.finance_url
307
+ when "AccountDataApi"
308
+ method_base_url = @config.account_data_url
302
309
  else
303
310
  method_base_url = @config.accounting_url
304
311
  end
305
312
 
306
313
  connection = Faraday.new(:url => method_base_url, :ssl => ssl_options) do |conn|
314
+ conn.options.params_encoder = Faraday::FlatParamsEncoder if api_client == "AccountDataApi"
307
315
  conn.request(:authorization, :basic, config.username, config.password)
308
316
  if opts[:header_params]["Content-Type"] == "multipart/form-data"
309
317
  conn.request :multipart
@@ -525,6 +533,8 @@ module XeroRuby
525
533
  XeroRuby::AppStore.const_get(return_type).build_from_hash(data)
526
534
  when 'FinanceApi'
527
535
  XeroRuby::Finance.const_get(return_type).build_from_hash(data)
536
+ when 'AccountDataApi'
537
+ XeroRuby::AccountData.const_get(return_type).build_from_hash(data)
528
538
  else
529
539
  XeroRuby::Accounting.const_get(return_type).build_from_hash(data)
530
540
  end
@@ -35,6 +35,7 @@ module XeroRuby
35
35
  attr_accessor :payroll_uk_url
36
36
  attr_accessor :app_store_url
37
37
  attr_accessor :finance_url
38
+ attr_accessor :account_data_url
38
39
 
39
40
  # Defines API keys used with API Key authentications.
40
41
  #
@@ -153,6 +154,7 @@ module XeroRuby
153
154
  @payroll_uk_url = 'https://api.xero.com/payroll.xro/2.0/'
154
155
  @app_store_url = 'https://api.xero.com/appstore/2.0/'
155
156
  @finance_url = 'https://api.xero.com/finance.xro/1.0/'
157
+ @account_data_url = 'https://api.xero.com/accountdata.xro/1.0/'
156
158
  @access_token = nil
157
159
  @id_token = nil
158
160
  @api_key = {}