xero-ruby 18.3.0 → 18.5.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 (42) 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/feed_connections_api.rb +410 -0
  4. data/lib/xero-ruby/api_client.rb +19 -0
  5. data/lib/xero-ruby/configuration.rb +4 -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/budget.rb +25 -1
  25. data/lib/xero-ruby/models/accounting/budget_balance.rb +4 -39
  26. data/lib/xero-ruby/models/bankfeeds_v2/account_type.rb +36 -0
  27. data/lib/xero-ruby/models/bankfeeds_v2/bulk_feed_connection_response.rb +225 -0
  28. data/lib/xero-ruby/models/bankfeeds_v2/bulk_feed_connection_result.rb +300 -0
  29. data/lib/xero-ruby/models/bankfeeds_v2/delete_feed_connections_request.rb +229 -0
  30. data/lib/xero-ruby/models/bankfeeds_v2/existing_account_feed_connection.rb +373 -0
  31. data/lib/xero-ruby/models/bankfeeds_v2/existing_account_feed_connections_request.rb +229 -0
  32. data/lib/xero-ruby/models/bankfeeds_v2/feed_connection.rb +293 -0
  33. data/lib/xero-ruby/models/bankfeeds_v2/feed_connection_to_delete.rb +227 -0
  34. data/lib/xero-ruby/models/bankfeeds_v2/item_error.rb +358 -0
  35. data/lib/xero-ruby/models/bankfeeds_v2/new_account_feed_connection.rb +406 -0
  36. data/lib/xero-ruby/models/bankfeeds_v2/new_account_feed_connections_request.rb +229 -0
  37. data/lib/xero-ruby/models/bankfeeds_v2/paged_feed_connections.rb +234 -0
  38. data/lib/xero-ruby/models/bankfeeds_v2/pagination.rb +252 -0
  39. data/lib/xero-ruby/models/bankfeeds_v2/problem.rb +368 -0
  40. data/lib/xero-ruby/version.rb +2 -2
  41. data/lib/xero-ruby.rb +34 -0
  42. metadata +385 -351
@@ -0,0 +1,410 @@
1
+ =begin
2
+ #Xero Bank Feeds API v2
3
+
4
+ #The Bank Feeds API is available to financial institutions with a Xero partnership and approved app partners. For non-bank apps, it automates statement imports into Xero bank and credit card accounts; it does not create a direct bank feed. Feed Connections 2.0 is intended to replace 1.0. The customer chooses whether to connect an existing Xero account or create a new one. Use ExistingAccount with the chosen accountId, or NewAccount to create an account; Xero does not guess which account to connect or silently change an account name. The GET and delete operations also use 2.0. Statements continue to use 1.0. Partial failures are rare, and nearly all are recoverable by your app with no need to contact Xero support. If an item in a write response has `status` `PARTIAL_FAILURE`, handle only that item and read its `error.type`. For `partial-failure-new-account-creation`, do not resend the NewAccount item: connect `error.accountId` with `POST /FeedConnections/ExistingAccount`. For `partial-failure-new-account-existence-not-confirmed`, the account named in `error.accountName` may or may not exist. Use the Accounting API to check whether an account with that name exists. If it does, connect it with `POST /FeedConnections/ExistingAccount`. If it does not, resend the NewAccount item. If your app has a user, you can show them this message instead: \"Something went wrong. Please check whether your chosen account name now exists. If it does, connect it. If not, try creating the new one again.\" For any other `partial-failure-*` type, resend the same item. If the recovery request for `partial-failure-new-account-creation`, `partial-failure-previous-connection-deletion` or `partial-failure-connection-creation` returns 409 `feed-already-connected-in-current-organisation`, the earlier attempt succeeded: treat the item as created and use `GET /FeedConnections` to find its `id`. `error.subtype` is optional diagnostics; do not branch on it, and never parse `title` or `detail`. Full detail: https://developer.xero.com/documentation/api/bankfeeds/feedconnections-2-0-errors/#partial-failures
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 FeedConnectionsApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.new)
17
+ @api_client = api_client
18
+ end
19
+ # Connect feeds to Xero Bank Accounts that already exist
20
+ # Creates Feed Connections against Xero Bank Accounts the Organisation already has. Each item must include the `accountId` of the account it connects to. Xero performs no matching of its own, and `accountNumber` and `accountName` are ignored if supplied. Use this endpoint whenever the customer has chosen an account, including when they are reconnecting a feed that was previously terminated. Each item is processed independently, and the response has one result per request item in request order.
21
+ # @param xero_tenant_id [String] Xero identifier for Tenant
22
+ # @param existing_account_feed_connections_request [ExistingAccountFeedConnectionsRequest]
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [BulkFeedConnectionResponse]
25
+ def create_feed_connections_for_existing_accounts(xero_tenant_id, existing_account_feed_connections_request, opts = {})
26
+ data, _status_code, _headers = create_feed_connections_for_existing_accounts_with_http_info(xero_tenant_id, existing_account_feed_connections_request, opts)
27
+ data
28
+ end
29
+
30
+ # Connect feeds to Xero Bank Accounts that already exist
31
+ # Creates Feed Connections against Xero Bank Accounts the Organisation already has. Each item must include the `accountId` of the account it connects to. Xero performs no matching of its own, and `accountNumber` and `accountName` are ignored if supplied. Use this endpoint whenever the customer has chosen an account, including when they are reconnecting a feed that was previously terminated. Each item is processed independently, and the response has one result per request item in request order.
32
+ # @param xero_tenant_id [String] Xero identifier for Tenant
33
+ # @param existing_account_feed_connections_request [ExistingAccountFeedConnectionsRequest]
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(BulkFeedConnectionResponse, Integer, Hash)>] BulkFeedConnectionResponse data, response status code and response headers
36
+ def create_feed_connections_for_existing_accounts_with_http_info(xero_tenant_id, existing_account_feed_connections_request, options = {})
37
+ opts = options.dup
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: FeedConnectionsApi.create_feed_connections_for_existing_accounts ...'
40
+ end
41
+ # verify the required parameter 'xero_tenant_id' is set
42
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FeedConnectionsApi.create_feed_connections_for_existing_accounts"
44
+ end
45
+ # verify the required parameter 'existing_account_feed_connections_request' is set
46
+ if @api_client.config.client_side_validation && existing_account_feed_connections_request.nil?
47
+ fail ArgumentError, "Missing the required parameter 'existing_account_feed_connections_request' when calling FeedConnectionsApi.create_feed_connections_for_existing_accounts"
48
+ end
49
+ # resource path
50
+ local_var_path = '/FeedConnections/ExistingAccount'
51
+
52
+ # camelize keys of incoming `where` opts
53
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
54
+
55
+ # query parameters
56
+ query_params = opts[:query_params] || {}
57
+
58
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
59
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
60
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
61
+
62
+ # header parameters
63
+ header_params = opts[:header_params] || {}
64
+ # HTTP header 'Accept' (if needed)
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json', ])
66
+ # HTTP header 'Content-Type'
67
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
68
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:body] || @api_client.object_to_http_body(existing_account_feed_connections_request)
75
+
76
+ # return_type
77
+ return_type = opts[:return_type] || 'BulkFeedConnectionResponse'
78
+
79
+ # auth_names
80
+ auth_names = opts[:auth_names] || ['OAuth2']
81
+
82
+ new_options = opts.merge(
83
+ :header_params => header_params,
84
+ :query_params => query_params,
85
+ :form_params => form_params,
86
+ :body => post_body,
87
+ :auth_names => auth_names,
88
+ :return_type => return_type
89
+ )
90
+
91
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "FeedConnectionsApi", new_options)
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug "API called: FeedConnectionsApi#create_feed_connections_for_existing_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
94
+ end
95
+ return data, status_code, headers
96
+ end
97
+
98
+ # Create Xero Bank Accounts and connect feeds to them
99
+ # Creates a new Xero Bank Account for each item and connects a feed to it. `accountId` must not be supplied. An item that includes one — including an all-zeros GUID, or a value that is not a GUID at all — is rejected, because supplying an account identifier means the Application intends to connect an account that already exists, which is what `/FeedConnections/ExistingAccount` is for. `accountNumber` and `accountName` are required here, since they describe the account being created. If the Organisation already has an account with the requested name, the item is rejected with `account-name-already-exists` naming that account, and no account is created. The same applies to a second item in the same request that uses a name an earlier item has just taken.
100
+ # @param xero_tenant_id [String] Xero identifier for Tenant
101
+ # @param new_account_feed_connections_request [NewAccountFeedConnectionsRequest]
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [BulkFeedConnectionResponse]
104
+ def create_feed_connections_for_new_accounts(xero_tenant_id, new_account_feed_connections_request, opts = {})
105
+ data, _status_code, _headers = create_feed_connections_for_new_accounts_with_http_info(xero_tenant_id, new_account_feed_connections_request, opts)
106
+ data
107
+ end
108
+
109
+ # Create Xero Bank Accounts and connect feeds to them
110
+ # Creates a new Xero Bank Account for each item and connects a feed to it. &#x60;accountId&#x60; must not be supplied. An item that includes one — including an all-zeros GUID, or a value that is not a GUID at all — is rejected, because supplying an account identifier means the Application intends to connect an account that already exists, which is what &#x60;/FeedConnections/ExistingAccount&#x60; is for. &#x60;accountNumber&#x60; and &#x60;accountName&#x60; are required here, since they describe the account being created. If the Organisation already has an account with the requested name, the item is rejected with &#x60;account-name-already-exists&#x60; naming that account, and no account is created. The same applies to a second item in the same request that uses a name an earlier item has just taken.
111
+ # @param xero_tenant_id [String] Xero identifier for Tenant
112
+ # @param new_account_feed_connections_request [NewAccountFeedConnectionsRequest]
113
+ # @param [Hash] opts the optional parameters
114
+ # @return [Array<(BulkFeedConnectionResponse, Integer, Hash)>] BulkFeedConnectionResponse data, response status code and response headers
115
+ def create_feed_connections_for_new_accounts_with_http_info(xero_tenant_id, new_account_feed_connections_request, options = {})
116
+ opts = options.dup
117
+ if @api_client.config.debugging
118
+ @api_client.config.logger.debug 'Calling API: FeedConnectionsApi.create_feed_connections_for_new_accounts ...'
119
+ end
120
+ # verify the required parameter 'xero_tenant_id' is set
121
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
122
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FeedConnectionsApi.create_feed_connections_for_new_accounts"
123
+ end
124
+ # verify the required parameter 'new_account_feed_connections_request' is set
125
+ if @api_client.config.client_side_validation && new_account_feed_connections_request.nil?
126
+ fail ArgumentError, "Missing the required parameter 'new_account_feed_connections_request' when calling FeedConnectionsApi.create_feed_connections_for_new_accounts"
127
+ end
128
+ # resource path
129
+ local_var_path = '/FeedConnections/NewAccount'
130
+
131
+ # camelize keys of incoming `where` opts
132
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
133
+
134
+ # query parameters
135
+ query_params = opts[:query_params] || {}
136
+
137
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
138
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
139
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
140
+
141
+ # header parameters
142
+ header_params = opts[:header_params] || {}
143
+ # HTTP header 'Accept' (if needed)
144
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json', ])
145
+ # HTTP header 'Content-Type'
146
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
147
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
148
+
149
+ # form parameters
150
+ form_params = opts[:form_params] || {}
151
+
152
+ # http body (model)
153
+ post_body = opts[:body] || @api_client.object_to_http_body(new_account_feed_connections_request)
154
+
155
+ # return_type
156
+ return_type = opts[:return_type] || 'BulkFeedConnectionResponse'
157
+
158
+ # auth_names
159
+ auth_names = opts[:auth_names] || ['OAuth2']
160
+
161
+ new_options = opts.merge(
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => return_type
168
+ )
169
+
170
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "FeedConnectionsApi", new_options)
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: FeedConnectionsApi#create_feed_connections_for_new_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+
177
+ # Terminate Feed Connections
178
+ # Terminates the Feed Connections named in the request. Terminating a Feed Connection discontinues the bank feed, and does not otherwise affect the customer's data in Xero. Each item is identified by the Feed Connection `id` alone. An item naming a Feed Connection that does not exist, has already been terminated, or belongs to a different Application is reported as `feed-not-found-or-already-deleted` with `status` `SUCCESS` and `statusCode` `204` — there was nothing to terminate, which is not a failure, and is reported the same way a real termination is. The same identifier may not appear twice in one request. Re-sending a completed delete is idempotent. If an item reports `PARTIAL_FAILURE`, or the original response was lost, resend the same DeleteRequests item. The retry checks whether the connection remains and terminates it if needed. A `SUCCESS` item on the resend means the deletion is complete, including `feed-not-found-or-already-deleted` at `statusCode` `204`. If a retry keeps reporting `PARTIAL_FAILURE`, contact Xero support with the connection id in `error.connectionId`.
179
+ # @param xero_tenant_id [String] Xero identifier for Tenant
180
+ # @param delete_feed_connections_request [DeleteFeedConnectionsRequest]
181
+ # @param [Hash] opts the optional parameters
182
+ # @return [BulkFeedConnectionResponse]
183
+ def delete_feed_connections(xero_tenant_id, delete_feed_connections_request, opts = {})
184
+ data, _status_code, _headers = delete_feed_connections_with_http_info(xero_tenant_id, delete_feed_connections_request, opts)
185
+ data
186
+ end
187
+
188
+ # Terminate Feed Connections
189
+ # Terminates the Feed Connections named in the request. Terminating a Feed Connection discontinues the bank feed, and does not otherwise affect the customer&#39;s data in Xero. Each item is identified by the Feed Connection &#x60;id&#x60; alone. An item naming a Feed Connection that does not exist, has already been terminated, or belongs to a different Application is reported as &#x60;feed-not-found-or-already-deleted&#x60; with &#x60;status&#x60; &#x60;SUCCESS&#x60; and &#x60;statusCode&#x60; &#x60;204&#x60; — there was nothing to terminate, which is not a failure, and is reported the same way a real termination is. The same identifier may not appear twice in one request. Re-sending a completed delete is idempotent. If an item reports &#x60;PARTIAL_FAILURE&#x60;, or the original response was lost, resend the same DeleteRequests item. The retry checks whether the connection remains and terminates it if needed. A &#x60;SUCCESS&#x60; item on the resend means the deletion is complete, including &#x60;feed-not-found-or-already-deleted&#x60; at &#x60;statusCode&#x60; &#x60;204&#x60;. If a retry keeps reporting &#x60;PARTIAL_FAILURE&#x60;, contact Xero support with the connection id in &#x60;error.connectionId&#x60;.
190
+ # @param xero_tenant_id [String] Xero identifier for Tenant
191
+ # @param delete_feed_connections_request [DeleteFeedConnectionsRequest]
192
+ # @param [Hash] opts the optional parameters
193
+ # @return [Array<(BulkFeedConnectionResponse, Integer, Hash)>] BulkFeedConnectionResponse data, response status code and response headers
194
+ def delete_feed_connections_with_http_info(xero_tenant_id, delete_feed_connections_request, options = {})
195
+ opts = options.dup
196
+ if @api_client.config.debugging
197
+ @api_client.config.logger.debug 'Calling API: FeedConnectionsApi.delete_feed_connections ...'
198
+ end
199
+ # verify the required parameter 'xero_tenant_id' is set
200
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
201
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FeedConnectionsApi.delete_feed_connections"
202
+ end
203
+ # verify the required parameter 'delete_feed_connections_request' is set
204
+ if @api_client.config.client_side_validation && delete_feed_connections_request.nil?
205
+ fail ArgumentError, "Missing the required parameter 'delete_feed_connections_request' when calling FeedConnectionsApi.delete_feed_connections"
206
+ end
207
+ # resource path
208
+ local_var_path = '/FeedConnections/DeleteRequests'
209
+
210
+ # camelize keys of incoming `where` opts
211
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
212
+
213
+ # query parameters
214
+ query_params = opts[:query_params] || {}
215
+
216
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
217
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
218
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
219
+
220
+ # header parameters
221
+ header_params = opts[:header_params] || {}
222
+ # HTTP header 'Accept' (if needed)
223
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json', ])
224
+ # HTTP header 'Content-Type'
225
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
226
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
227
+
228
+ # form parameters
229
+ form_params = opts[:form_params] || {}
230
+
231
+ # http body (model)
232
+ post_body = opts[:body] || @api_client.object_to_http_body(delete_feed_connections_request)
233
+
234
+ # return_type
235
+ return_type = opts[:return_type] || 'BulkFeedConnectionResponse'
236
+
237
+ # auth_names
238
+ auth_names = opts[:auth_names] || ['OAuth2']
239
+
240
+ new_options = opts.merge(
241
+ :header_params => header_params,
242
+ :query_params => query_params,
243
+ :form_params => form_params,
244
+ :body => post_body,
245
+ :auth_names => auth_names,
246
+ :return_type => return_type
247
+ )
248
+
249
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "FeedConnectionsApi", new_options)
250
+ if @api_client.config.debugging
251
+ @api_client.config.logger.debug "API called: FeedConnectionsApi#delete_feed_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
252
+ end
253
+ return data, status_code, headers
254
+ end
255
+
256
+ # Retrieve a single Feed Connection
257
+ # Returns one Feed Connection, as a bare object rather than inside an envelope. The response is `404 bank-feed-not-found` when the identifier names no Feed Connection, when it names one belonging to a different Application, when it is an all-zeros GUID, and when it is not a GUID at all. These cases are deliberately indistinguishable from one another, so an Application cannot use this endpoint to discover what another Application has.
258
+ # @param id [String] The Feed Connection identifier.
259
+ # @param xero_tenant_id [String] Xero identifier for Tenant
260
+ # @param [Hash] opts the optional parameters
261
+ # @return [FeedConnection]
262
+ def get_feed_connection(id, xero_tenant_id, opts = {})
263
+ data, _status_code, _headers = get_feed_connection_with_http_info(id, xero_tenant_id, opts)
264
+ data
265
+ end
266
+
267
+ # Retrieve a single Feed Connection
268
+ # Returns one Feed Connection, as a bare object rather than inside an envelope. The response is &#x60;404 bank-feed-not-found&#x60; when the identifier names no Feed Connection, when it names one belonging to a different Application, when it is an all-zeros GUID, and when it is not a GUID at all. These cases are deliberately indistinguishable from one another, so an Application cannot use this endpoint to discover what another Application has.
269
+ # @param id [String] The Feed Connection identifier.
270
+ # @param xero_tenant_id [String] Xero identifier for Tenant
271
+ # @param [Hash] opts the optional parameters
272
+ # @return [Array<(FeedConnection, Integer, Hash)>] FeedConnection data, response status code and response headers
273
+ def get_feed_connection_with_http_info(id, xero_tenant_id, options = {})
274
+ opts = options.dup
275
+ if @api_client.config.debugging
276
+ @api_client.config.logger.debug 'Calling API: FeedConnectionsApi.get_feed_connection ...'
277
+ end
278
+ # verify the required parameter 'id' is set
279
+ if @api_client.config.client_side_validation && id.nil?
280
+ fail ArgumentError, "Missing the required parameter 'id' when calling FeedConnectionsApi.get_feed_connection"
281
+ end
282
+ # verify the required parameter 'xero_tenant_id' is set
283
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
284
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FeedConnectionsApi.get_feed_connection"
285
+ end
286
+ # resource path
287
+ local_var_path = '/FeedConnections/{id}'.sub('{' + 'id' + '}', id.to_s)
288
+
289
+ # camelize keys of incoming `where` opts
290
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
291
+
292
+ # query parameters
293
+ query_params = opts[:query_params] || {}
294
+
295
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
296
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
297
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
298
+
299
+ # header parameters
300
+ header_params = opts[:header_params] || {}
301
+ # HTTP header 'Accept' (if needed)
302
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
303
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
304
+
305
+ # form parameters
306
+ form_params = opts[:form_params] || {}
307
+
308
+ # http body (model)
309
+ post_body = opts[:body]
310
+
311
+ # return_type
312
+ return_type = opts[:return_type] || 'FeedConnection'
313
+
314
+ # auth_names
315
+ auth_names = opts[:auth_names] || ['OAuth2']
316
+
317
+ new_options = opts.merge(
318
+ :header_params => header_params,
319
+ :query_params => query_params,
320
+ :form_params => form_params,
321
+ :body => post_body,
322
+ :auth_names => auth_names,
323
+ :return_type => return_type
324
+ )
325
+
326
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FeedConnectionsApi", new_options)
327
+ if @api_client.config.debugging
328
+ @api_client.config.logger.debug "API called: FeedConnectionsApi#get_feed_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
329
+ end
330
+ return data, status_code, headers
331
+ end
332
+
333
+ # Retrieve the Feed Connections for an Organisation
334
+ # Returns the Feed Connections belonging to both the Organisation in `Xero-Tenant-Id` and the Application associated with the OAuth client. Connections belonging to another Application are not returned, and there is no way to observe that they exist. A `page` beyond the end of the collection returns an empty `items` array rather than an error.
335
+ # @param xero_tenant_id [String] Xero identifier for Tenant
336
+ # @param [Hash] opts the optional parameters
337
+ # @option opts [Integer] :page The page to return, counting from 1. (default to 1)
338
+ # @option opts [Integer] :page_size How many Feed Connections to return per page. No maximum is enforced. (default to 10)
339
+ # @return [PagedFeedConnections]
340
+ def get_feed_connections(xero_tenant_id, opts = {})
341
+ data, _status_code, _headers = get_feed_connections_with_http_info(xero_tenant_id, opts)
342
+ data
343
+ end
344
+
345
+ # Retrieve the Feed Connections for an Organisation
346
+ # Returns the Feed Connections belonging to both the Organisation in &#x60;Xero-Tenant-Id&#x60; and the Application associated with the OAuth client. Connections belonging to another Application are not returned, and there is no way to observe that they exist. A &#x60;page&#x60; beyond the end of the collection returns an empty &#x60;items&#x60; array rather than an error.
347
+ # @param xero_tenant_id [String] Xero identifier for Tenant
348
+ # @param [Hash] opts the optional parameters
349
+ # @option opts [Integer] :page The page to return, counting from 1.
350
+ # @option opts [Integer] :page_size How many Feed Connections to return per page. No maximum is enforced.
351
+ # @return [Array<(PagedFeedConnections, Integer, Hash)>] PagedFeedConnections data, response status code and response headers
352
+ def get_feed_connections_with_http_info(xero_tenant_id, options = {})
353
+ opts = options.dup
354
+ if @api_client.config.debugging
355
+ @api_client.config.logger.debug 'Calling API: FeedConnectionsApi.get_feed_connections ...'
356
+ end
357
+ # verify the required parameter 'xero_tenant_id' is set
358
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
359
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FeedConnectionsApi.get_feed_connections"
360
+ end
361
+ # resource path
362
+ local_var_path = '/FeedConnections'
363
+
364
+ # camelize keys of incoming `where` opts
365
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
366
+
367
+ # query parameters
368
+ query_params = opts[:query_params] || {}
369
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
370
+ query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
371
+
372
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
373
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
374
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
375
+
376
+ # header parameters
377
+ header_params = opts[:header_params] || {}
378
+ # HTTP header 'Accept' (if needed)
379
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
380
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
381
+
382
+ # form parameters
383
+ form_params = opts[:form_params] || {}
384
+
385
+ # http body (model)
386
+ post_body = opts[:body]
387
+
388
+ # return_type
389
+ return_type = opts[:return_type] || 'PagedFeedConnections'
390
+
391
+ # auth_names
392
+ auth_names = opts[:auth_names] || ['OAuth2']
393
+
394
+ new_options = opts.merge(
395
+ :header_params => header_params,
396
+ :query_params => query_params,
397
+ :form_params => form_params,
398
+ :body => post_body,
399
+ :auth_names => auth_names,
400
+ :return_type => return_type
401
+ )
402
+
403
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FeedConnectionsApi", new_options)
404
+ if @api_client.config.debugging
405
+ @api_client.config.logger.debug "API called: FeedConnectionsApi#get_feed_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
406
+ end
407
+ return data, status_code, headers
408
+ end
409
+ end
410
+ end
@@ -115,6 +115,16 @@ 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
+
123
+ def bankfeeds_v2_api
124
+ @config.base_url = @config.bankfeeds_v2_url
125
+ XeroRuby::FeedConnectionsApi.new(self)
126
+ end
127
+
118
128
  # Token Helpers
119
129
  def token_set
120
130
  @config.token_set
@@ -299,11 +309,16 @@ module XeroRuby
299
309
  method_base_url = @config.app_store_url
300
310
  when "FinanceApi"
301
311
  method_base_url = @config.finance_url
312
+ when "AccountDataApi"
313
+ method_base_url = @config.account_data_url
314
+ when "FeedConnectionsApi"
315
+ method_base_url = @config.bankfeeds_v2_url
302
316
  else
303
317
  method_base_url = @config.accounting_url
304
318
  end
305
319
 
306
320
  connection = Faraday.new(:url => method_base_url, :ssl => ssl_options) do |conn|
321
+ conn.options.params_encoder = Faraday::FlatParamsEncoder if api_client == "AccountDataApi"
307
322
  conn.request(:authorization, :basic, config.username, config.password)
308
323
  if opts[:header_params]["Content-Type"] == "multipart/form-data"
309
324
  conn.request :multipart
@@ -525,6 +540,10 @@ module XeroRuby
525
540
  XeroRuby::AppStore.const_get(return_type).build_from_hash(data)
526
541
  when 'FinanceApi'
527
542
  XeroRuby::Finance.const_get(return_type).build_from_hash(data)
543
+ when 'AccountDataApi'
544
+ XeroRuby::AccountData.const_get(return_type).build_from_hash(data)
545
+ when 'FeedConnectionsApi'
546
+ XeroRuby::BankfeedsV2.const_get(return_type).build_from_hash(data)
528
547
  else
529
548
  XeroRuby::Accounting.const_get(return_type).build_from_hash(data)
530
549
  end
@@ -35,6 +35,8 @@ 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
39
+ attr_accessor :bankfeeds_v2_url
38
40
 
39
41
  # Defines API keys used with API Key authentications.
40
42
  #
@@ -153,6 +155,8 @@ module XeroRuby
153
155
  @payroll_uk_url = 'https://api.xero.com/payroll.xro/2.0/'
154
156
  @app_store_url = 'https://api.xero.com/appstore/2.0/'
155
157
  @finance_url = 'https://api.xero.com/finance.xro/1.0/'
158
+ @account_data_url = 'https://api.xero.com/accountdata.xro/1.0/'
159
+ @bankfeeds_v2_url = 'https://api.xero.com/bankfeeds.xro/2.0/'
156
160
  @access_token = nil
157
161
  @id_token = nil
158
162
  @api_key = {}