xero-ruby 18.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d75be539ff0ad2fa0d3409f229972e17ae8fe55eb5991bef55106729e151f6a
4
- data.tar.gz: 1a763242cf5d8037a7873fd0900d1ed16efa6f65e55820130efeed59e4d0803f
3
+ metadata.gz: 52bb235dbf4f5d1260ef98389d3244fe48a7076c9ffafb2affdeb3175081af35
4
+ data.tar.gz: a8e3ba3ab6fe02c87073f2dbf54021fedc9a8af1566387df60bc081408072c2b
5
5
  SHA512:
6
- metadata.gz: dc1addb974222e59ed8149e07587a8ca18c255f47366e4f40b6ed9247a23237815e7214a1191ab24750e30928e130d60876f88024cc8b9d35e4cd45247af07b8
7
- data.tar.gz: 24a04f06fcd6349102160b3ee21d3092f3b89404d006b5a38d3b953f45751316c5886e0d47c156d8aedd29a816362bd9a76d3283a260f40517dce5dc4d7a361c
6
+ metadata.gz: e6ef682f7a3e731f0f731420f97fa55ca8b7d793470f84346f31b03e8af32bf63096f9e3ec88506f904b1c339aec629922c3691e9b9367246a3efb8dbe917f73
7
+ data.tar.gz: 4ee1e5b5394206b7993326cf79637f60b980407a91aa4ae2439fda138c5f5269b39f6ccdf73f2ef54f4eebc90de8ccffcd1594e747c73dc322badee269f1c52b
@@ -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
@@ -120,6 +120,11 @@ module XeroRuby
120
120
  XeroRuby::AccountDataApi.new(self)
121
121
  end
122
122
 
123
+ def bankfeeds_v2_api
124
+ @config.base_url = @config.bankfeeds_v2_url
125
+ XeroRuby::FeedConnectionsApi.new(self)
126
+ end
127
+
123
128
  # Token Helpers
124
129
  def token_set
125
130
  @config.token_set
@@ -306,6 +311,8 @@ module XeroRuby
306
311
  method_base_url = @config.finance_url
307
312
  when "AccountDataApi"
308
313
  method_base_url = @config.account_data_url
314
+ when "FeedConnectionsApi"
315
+ method_base_url = @config.bankfeeds_v2_url
309
316
  else
310
317
  method_base_url = @config.accounting_url
311
318
  end
@@ -535,6 +542,8 @@ module XeroRuby
535
542
  XeroRuby::Finance.const_get(return_type).build_from_hash(data)
536
543
  when 'AccountDataApi'
537
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)
538
547
  else
539
548
  XeroRuby::Accounting.const_get(return_type).build_from_hash(data)
540
549
  end
@@ -36,6 +36,7 @@ module XeroRuby
36
36
  attr_accessor :app_store_url
37
37
  attr_accessor :finance_url
38
38
  attr_accessor :account_data_url
39
+ attr_accessor :bankfeeds_v2_url
39
40
 
40
41
  # Defines API keys used with API Key authentications.
41
42
  #
@@ -155,6 +156,7 @@ module XeroRuby
155
156
  @app_store_url = 'https://api.xero.com/appstore/2.0/'
156
157
  @finance_url = 'https://api.xero.com/finance.xro/1.0/'
157
158
  @account_data_url = 'https://api.xero.com/accountdata.xro/1.0/'
159
+ @bankfeeds_v2_url = 'https://api.xero.com/bankfeeds.xro/2.0/'
158
160
  @access_token = nil
159
161
  @id_token = nil
160
162
  @api_key = {}
@@ -19,6 +19,11 @@ module XeroRuby::Accounting
19
19
  # Xero identifier
20
20
  attr_accessor :budget_id
21
21
 
22
+ # The tool used to create the budget
23
+ attr_accessor :created_in
24
+ XERO_ANALYTICS ||= "XERO_ANALYTICS".freeze
25
+ BUDGETS_MANAGER ||= "BUDGETS_MANAGER".freeze
26
+
22
27
  # Type of Budget. OVERALL or TRACKING
23
28
  attr_accessor :type
24
29
  OVERALL ||= "OVERALL".freeze
@@ -62,6 +67,7 @@ module XeroRuby::Accounting
62
67
  def self.attribute_map
63
68
  {
64
69
  :'budget_id' => :'BudgetID',
70
+ :'created_in' => :'CreatedIn',
65
71
  :'type' => :'Type',
66
72
  :'description' => :'Description',
67
73
  :'updated_date_utc' => :'UpdatedDateUTC',
@@ -74,6 +80,7 @@ module XeroRuby::Accounting
74
80
  def self.openapi_types
75
81
  {
76
82
  :'budget_id' => :'String',
83
+ :'created_in' => :'String',
77
84
  :'type' => :'String',
78
85
  :'description' => :'String',
79
86
  :'updated_date_utc' => :'DateTime',
@@ -101,6 +108,10 @@ module XeroRuby::Accounting
101
108
  self.budget_id = attributes[:'budget_id']
102
109
  end
103
110
 
111
+ if attributes.key?(:'created_in')
112
+ self.created_in = attributes[:'created_in']
113
+ end
114
+
104
115
  if attributes.key?(:'type')
105
116
  self.type = attributes[:'type']
106
117
  end
@@ -140,12 +151,24 @@ module XeroRuby::Accounting
140
151
  # Check to see if the all the properties in the model are valid
141
152
  # @return true if the model is valid
142
153
  def valid?
154
+ created_in_validator = EnumAttributeValidator.new('String', ["XERO_ANALYTICS", "BUDGETS_MANAGER"])
155
+ return false unless created_in_validator.valid?(@created_in)
143
156
  type_validator = EnumAttributeValidator.new('String', ["OVERALL", "TRACKING"])
144
157
  return false unless type_validator.valid?(@type)
145
158
  return false if !@description.nil? && @description.to_s.length > 255
146
159
  true
147
160
  end
148
161
 
162
+ # Custom attribute writer method checking allowed values (enum).
163
+ # @param [Object] created_in Object to be assigned
164
+ def created_in=(created_in)
165
+ validator = EnumAttributeValidator.new('String', ["XERO_ANALYTICS", "BUDGETS_MANAGER"])
166
+ unless validator.valid?(created_in)
167
+ fail ArgumentError, "invalid value for \"created_in\", must be one of #{validator.allowable_values}."
168
+ end
169
+ @created_in = created_in
170
+ end
171
+
149
172
  # Custom attribute writer method checking allowed values (enum).
150
173
  # @param [Object] type Object to be assigned
151
174
  def type=(type)
@@ -172,6 +195,7 @@ module XeroRuby::Accounting
172
195
  return true if self.equal?(o)
173
196
  self.class == o.class &&
174
197
  budget_id == o.budget_id &&
198
+ created_in == o.created_in &&
175
199
  type == o.type &&
176
200
  description == o.description &&
177
201
  updated_date_utc == o.updated_date_utc &&
@@ -188,7 +212,7 @@ module XeroRuby::Accounting
188
212
  # Calculates hash code according to all attributes.
189
213
  # @return [Integer] Hash code
190
214
  def hash
191
- [budget_id, type, description, updated_date_utc, budget_lines, tracking].hash
215
+ [budget_id, created_in, type, description, updated_date_utc, budget_lines, tracking].hash
192
216
  end
193
217
 
194
218
  # Builds the object from hash
@@ -22,19 +22,11 @@ module XeroRuby::Accounting
22
22
  # LineItem Quantity
23
23
  attr_accessor :amount
24
24
 
25
- # Budgeted amount
26
- attr_accessor :unit_amount
27
-
28
- # Any footnotes associated with this balance
29
- attr_accessor :notes
30
-
31
25
  # Attribute mapping from ruby-style variable name to JSON key.
32
26
  def self.attribute_map
33
27
  {
34
28
  :'period' => :'Period',
35
- :'amount' => :'Amount',
36
- :'unit_amount' => :'UnitAmount',
37
- :'notes' => :'Notes'
29
+ :'amount' => :'Amount'
38
30
  }
39
31
  end
40
32
 
@@ -42,9 +34,7 @@ module XeroRuby::Accounting
42
34
  def self.openapi_types
43
35
  {
44
36
  :'period' => :'Date',
45
- :'amount' => :'BigDecimal',
46
- :'unit_amount' => :'BigDecimal',
47
- :'notes' => :'String'
37
+ :'amount' => :'BigDecimal'
48
38
  }
49
39
  end
50
40
 
@@ -70,53 +60,28 @@ module XeroRuby::Accounting
70
60
  if attributes.key?(:'amount')
71
61
  self.amount = attributes[:'amount']
72
62
  end
73
-
74
- if attributes.key?(:'unit_amount')
75
- self.unit_amount = attributes[:'unit_amount']
76
- end
77
-
78
- if attributes.key?(:'notes')
79
- self.notes = attributes[:'notes']
80
- end
81
63
  end
82
64
 
83
65
  # Show invalid properties with the reasons. Usually used together with valid?
84
66
  # @return Array for valid properties with the reasons
85
67
  def list_invalid_properties
86
68
  invalid_properties = Array.new
87
- if !@notes.nil? && @notes.to_s.length > 255
88
- invalid_properties.push('invalid value for "notes", the character length must be smaller than or equal to 255.')
89
- end
90
-
91
69
  invalid_properties
92
70
  end
93
71
 
94
72
  # Check to see if the all the properties in the model are valid
95
73
  # @return true if the model is valid
96
74
  def valid?
97
- return false if !@notes.nil? && @notes.to_s.length > 255
98
75
  true
99
76
  end
100
77
 
101
- # Custom attribute writer method with validation
102
- # @param [Object] notes Value to be assigned
103
- def notes=(notes)
104
- if !notes.nil? && notes.to_s.length > 255
105
- fail ArgumentError, 'invalid value for "notes", the character length must be smaller than or equal to 255.'
106
- end
107
-
108
- @notes = notes
109
- end
110
-
111
78
  # Checks equality by comparing each attribute.
112
79
  # @param [Object] Object to be compared
113
80
  def ==(o)
114
81
  return true if self.equal?(o)
115
82
  self.class == o.class &&
116
83
  period == o.period &&
117
- amount == o.amount &&
118
- unit_amount == o.unit_amount &&
119
- notes == o.notes
84
+ amount == o.amount
120
85
  end
121
86
 
122
87
  # @see the `==` method
@@ -128,7 +93,7 @@ module XeroRuby::Accounting
128
93
  # Calculates hash code according to all attributes.
129
94
  # @return [Integer] Hash code
130
95
  def hash
131
- [period, amount, unit_amount, notes].hash
96
+ [period, amount].hash
132
97
  end
133
98
 
134
99
  # Builds the object from hash