xero-ruby 18.4.0 → 19.0.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/feed_connections_api.rb +410 -0
  3. data/lib/xero-ruby/api_client.rb +42 -24
  4. data/lib/xero-ruby/configuration.rb +10 -6
  5. data/lib/xero-ruby/models/accounting/budget.rb +25 -1
  6. data/lib/xero-ruby/models/accounting/budget_balance.rb +4 -39
  7. data/lib/xero-ruby/models/bankfeeds_v2/account_type.rb +36 -0
  8. data/lib/xero-ruby/models/{finance/lock_history_response.rb → bankfeeds_v2/bulk_feed_connection_response.rb} +16 -35
  9. data/lib/xero-ruby/models/bankfeeds_v2/bulk_feed_connection_result.rb +300 -0
  10. data/lib/xero-ruby/models/bankfeeds_v2/delete_feed_connections_request.rb +229 -0
  11. data/lib/xero-ruby/models/bankfeeds_v2/existing_account_feed_connection.rb +373 -0
  12. data/lib/xero-ruby/models/bankfeeds_v2/existing_account_feed_connections_request.rb +229 -0
  13. data/lib/xero-ruby/models/{finance/account_usage.rb → bankfeeds_v2/feed_connection.rb} +59 -108
  14. data/lib/xero-ruby/models/{finance/account_usage_response.rb → bankfeeds_v2/feed_connection_to_delete.rb} +20 -47
  15. data/lib/xero-ruby/models/bankfeeds_v2/item_error.rb +358 -0
  16. data/lib/xero-ruby/models/bankfeeds_v2/new_account_feed_connection.rb +406 -0
  17. data/lib/xero-ruby/models/{finance/user_activities_response.rb → bankfeeds_v2/new_account_feed_connections_request.rb} +21 -36
  18. data/lib/xero-ruby/models/{finance/report_history_response.rb → bankfeeds_v2/paged_feed_connections.rb} +22 -32
  19. data/lib/xero-ruby/models/{finance/practice_response.rb → bankfeeds_v2/pagination.rb} +36 -46
  20. data/lib/xero-ruby/models/bankfeeds_v2/problem.rb +368 -0
  21. data/lib/xero-ruby/version.rb +2 -2
  22. data/lib/xero-ruby.rb +143 -128
  23. metadata +369 -364
  24. data/lib/xero-ruby/models/finance/history_record_response.rb +0 -262
  25. data/lib/xero-ruby/models/finance/lock_history_model.rb +0 -242
  26. data/lib/xero-ruby/models/finance/report_history_model.rb +0 -242
  27. data/lib/xero-ruby/models/finance/user_response.rb +0 -336
@@ -0,0 +1,406 @@
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
+ require 'time'
13
+ require 'date'
14
+
15
+ module XeroRuby::BankfeedsV2
16
+ require 'bigdecimal'
17
+
18
+ class NewAccountFeedConnection
19
+ # The financial institute's identifier for the account. Must be unique within your financial institute.
20
+ attr_accessor :account_token
21
+
22
+
23
+ attr_accessor :account_type
24
+
25
+ # The account number for the Xero Bank Account being created. Up to 40 characters when `accountType` is `BANK`. When `accountType` is `CREDITCARD`, supply only the last four digits, and digits only.
26
+ attr_accessor :account_number
27
+
28
+ # The name for the Xero Bank Account being created. Rejected if the Organisation already has an account with this name.
29
+ attr_accessor :account_name
30
+
31
+ # ISO-4217 currency code. Must be a currency the Organisation has.
32
+ attr_accessor :currency
33
+
34
+ # ISO-3166 alpha-2 country code. Required only when the Application supports multiple regions.
35
+ attr_accessor :country
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'account_token' => :'accountToken',
41
+ :'account_type' => :'accountType',
42
+ :'account_number' => :'accountNumber',
43
+ :'account_name' => :'accountName',
44
+ :'currency' => :'currency',
45
+ :'country' => :'country'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'account_token' => :'String',
53
+ :'account_type' => :'AccountType',
54
+ :'account_number' => :'String',
55
+ :'account_name' => :'String',
56
+ :'currency' => :'String',
57
+ :'country' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::NewAccountFeedConnection` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::BankfeedsV2::NewAccountFeedConnection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'account_token')
77
+ self.account_token = attributes[:'account_token']
78
+ end
79
+
80
+ if attributes.key?(:'account_type')
81
+ self.account_type = attributes[:'account_type']
82
+ end
83
+
84
+ if attributes.key?(:'account_number')
85
+ self.account_number = attributes[:'account_number']
86
+ end
87
+
88
+ if attributes.key?(:'account_name')
89
+ self.account_name = attributes[:'account_name']
90
+ end
91
+
92
+ if attributes.key?(:'currency')
93
+ self.currency = attributes[:'currency']
94
+ end
95
+
96
+ if attributes.key?(:'country')
97
+ self.country = attributes[:'country']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @account_token.nil?
106
+ invalid_properties.push('invalid value for "account_token", account_token cannot be nil.')
107
+ end
108
+
109
+ if @account_token.to_s.length > 50
110
+ invalid_properties.push('invalid value for "account_token", the character length must be smaller than or equal to 50.')
111
+ end
112
+
113
+ if @account_type.nil?
114
+ invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
115
+ end
116
+
117
+ if @account_number.nil?
118
+ invalid_properties.push('invalid value for "account_number", account_number cannot be nil.')
119
+ end
120
+
121
+ if @account_number.to_s.length > 40
122
+ invalid_properties.push('invalid value for "account_number", the character length must be smaller than or equal to 40.')
123
+ end
124
+
125
+ if @account_name.nil?
126
+ invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
127
+ end
128
+
129
+ if @account_name.to_s.length > 30
130
+ invalid_properties.push('invalid value for "account_name", the character length must be smaller than or equal to 30.')
131
+ end
132
+
133
+ if @currency.nil?
134
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
135
+ end
136
+
137
+ if @currency.to_s.length > 3
138
+ invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
139
+ end
140
+
141
+ if @currency.to_s.length < 3
142
+ invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
143
+ end
144
+
145
+ if !@country.nil? && @country.to_s.length > 2
146
+ invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 2.')
147
+ end
148
+
149
+ if !@country.nil? && @country.to_s.length < 2
150
+ invalid_properties.push('invalid value for "country", the character length must be great than or equal to 2.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return false if @account_token.nil?
160
+ return false if @account_token.to_s.length > 50
161
+ return false if @account_type.nil?
162
+ return false if @account_number.nil?
163
+ return false if @account_number.to_s.length > 40
164
+ return false if @account_name.nil?
165
+ return false if @account_name.to_s.length > 30
166
+ return false if @currency.nil?
167
+ return false if @currency.to_s.length > 3
168
+ return false if @currency.to_s.length < 3
169
+ return false if !@country.nil? && @country.to_s.length > 2
170
+ return false if !@country.nil? && @country.to_s.length < 2
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] account_token Value to be assigned
176
+ def account_token=(account_token)
177
+ if account_token.nil?
178
+ fail ArgumentError, 'account_token cannot be nil'
179
+ end
180
+
181
+ if account_token.to_s.length > 50
182
+ fail ArgumentError, 'invalid value for "account_token", the character length must be smaller than or equal to 50.'
183
+ end
184
+
185
+ @account_token = account_token
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] account_number Value to be assigned
190
+ def account_number=(account_number)
191
+ if account_number.nil?
192
+ fail ArgumentError, 'account_number cannot be nil'
193
+ end
194
+
195
+ if account_number.to_s.length > 40
196
+ fail ArgumentError, 'invalid value for "account_number", the character length must be smaller than or equal to 40.'
197
+ end
198
+
199
+ @account_number = account_number
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] account_name Value to be assigned
204
+ def account_name=(account_name)
205
+ if account_name.nil?
206
+ fail ArgumentError, 'account_name cannot be nil'
207
+ end
208
+
209
+ if account_name.to_s.length > 30
210
+ fail ArgumentError, 'invalid value for "account_name", the character length must be smaller than or equal to 30.'
211
+ end
212
+
213
+ @account_name = account_name
214
+ end
215
+
216
+ # Custom attribute writer method with validation
217
+ # @param [Object] currency Value to be assigned
218
+ def currency=(currency)
219
+ if currency.nil?
220
+ fail ArgumentError, 'currency cannot be nil'
221
+ end
222
+
223
+ if currency.to_s.length > 3
224
+ fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
225
+ end
226
+
227
+ if currency.to_s.length < 3
228
+ fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
229
+ end
230
+
231
+ @currency = currency
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] country Value to be assigned
236
+ def country=(country)
237
+ if !country.nil? && country.to_s.length > 2
238
+ fail ArgumentError, 'invalid value for "country", the character length must be smaller than or equal to 2.'
239
+ end
240
+
241
+ if !country.nil? && country.to_s.length < 2
242
+ fail ArgumentError, 'invalid value for "country", the character length must be great than or equal to 2.'
243
+ end
244
+
245
+ @country = country
246
+ end
247
+
248
+ # Checks equality by comparing each attribute.
249
+ # @param [Object] Object to be compared
250
+ def ==(o)
251
+ return true if self.equal?(o)
252
+ self.class == o.class &&
253
+ account_token == o.account_token &&
254
+ account_type == o.account_type &&
255
+ account_number == o.account_number &&
256
+ account_name == o.account_name &&
257
+ currency == o.currency &&
258
+ country == o.country
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Integer] Hash code
269
+ def hash
270
+ [account_token, account_type, account_number, account_name, currency, country].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def self.build_from_hash(attributes)
277
+ new.build_from_hash(attributes)
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ self.class.openapi_types.each_pair do |key, type|
286
+ if type =~ /\AArray<(.*)>/i
287
+ # check to ensure the input is an array given that the attribute
288
+ # is documented as an array but the input is not
289
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
290
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
291
+ end
292
+ elsif !attributes[self.class.attribute_map[key]].nil?
293
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
294
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
295
+ end
296
+
297
+ self
298
+ end
299
+
300
+ # Deserializes the data based on type
301
+ # @param string type Data type
302
+ # @param string value Value to be deserialized
303
+ # @return [Object] Deserialized data
304
+ def _deserialize(type, value)
305
+ case type.to_sym
306
+ when :DateTime
307
+ DateTime.parse(parse_date(value))
308
+ when :Date
309
+ Date.parse(parse_date(value))
310
+ when :String
311
+ value.to_s
312
+ when :Integer
313
+ value.to_i
314
+ when :Float
315
+ value.to_f
316
+ when :BigDecimal
317
+ BigDecimal(value.to_s)
318
+ when :Boolean
319
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
+ true
321
+ else
322
+ false
323
+ end
324
+ when :Object
325
+ # generic object (usually a Hash), return directly
326
+ value
327
+ when /\AArray<(?<inner_type>.+)>\z/
328
+ inner_type = Regexp.last_match[:inner_type]
329
+ value.map { |v| _deserialize(inner_type, v) }
330
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
+ k_type = Regexp.last_match[:k_type]
332
+ v_type = Regexp.last_match[:v_type]
333
+ {}.tap do |hash|
334
+ value.each do |k, v|
335
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
+ end
337
+ end
338
+ else # model
339
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
340
+ end
341
+ end
342
+
343
+ # Returns the string representation of the object
344
+ # @return [String] String presentation of the object
345
+ def to_s
346
+ to_hash.to_s
347
+ end
348
+
349
+ # to_body is an alias to to_hash (backward compatibility)
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_body
352
+ to_hash
353
+ end
354
+
355
+ # Returns the object in the form of hash
356
+ # @return [Hash] Returns the object in the form of hash
357
+ def to_hash(downcase: false)
358
+ hash = {}
359
+ self.class.attribute_map.each_pair do |attr, param|
360
+ value = self.send(attr)
361
+ next if value.nil?
362
+ key = downcase ? attr : param
363
+ hash[key] = _to_hash(value, downcase: downcase)
364
+ end
365
+ hash
366
+ end
367
+
368
+ # Returns the object in the form of hash with snake_case
369
+ def to_attributes
370
+ to_hash(downcase: true)
371
+ end
372
+
373
+ # Outputs non-array value in the form of hash
374
+ # For object, use to_hash. Otherwise, just return the value
375
+ # @param [Object] value Any valid value
376
+ # @return [Hash] Returns the value in the form of hash
377
+ def _to_hash(value, downcase: false)
378
+ if value.is_a?(Array)
379
+ value.map do |v|
380
+ v.to_hash(downcase: downcase)
381
+ end
382
+ elsif value.is_a?(Hash)
383
+ {}.tap do |hash|
384
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
385
+ end
386
+ elsif value.respond_to? :to_hash
387
+ value.to_hash(downcase: downcase)
388
+ else
389
+ value
390
+ end
391
+ end
392
+
393
+ def parse_date(datestring)
394
+ if datestring.include?('Date')
395
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
396
+ original, date, timezone = *date_pattern.match(datestring)
397
+ date = (date.to_i / 1000)
398
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
399
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
400
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
401
+ else # handle date 'types' for small subset of payroll API's
402
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
403
+ end
404
+ end
405
+ end
406
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Xero Finance API
2
+ #Xero Bank Feeds API v2
3
3
 
4
- #The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital.
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
5
 
6
6
  Contact: api@xero.com
7
7
  Generated by: https://openapi-generator.tech
@@ -12,34 +12,24 @@ OpenAPI Generator version: 4.3.1
12
12
  require 'time'
13
13
  require 'date'
14
14
 
15
- module XeroRuby::Finance
15
+ module XeroRuby::BankfeedsV2
16
16
  require 'bigdecimal'
17
17
 
18
- class UserActivitiesResponse
19
- # The requested Organisation to which the data pertains
20
- attr_accessor :organisation_id
21
-
22
- # The month of the report
23
- attr_accessor :data_month
24
-
25
-
26
- attr_accessor :users
18
+ class NewAccountFeedConnectionsRequest
19
+ # Between 1 and 50 Feed Connections to create. No element may be null.
20
+ attr_accessor :items
27
21
 
28
22
  # Attribute mapping from ruby-style variable name to JSON key.
29
23
  def self.attribute_map
30
24
  {
31
- :'organisation_id' => :'organisationId',
32
- :'data_month' => :'dataMonth',
33
- :'users' => :'users'
25
+ :'items' => :'items'
34
26
  }
35
27
  end
36
28
 
37
29
  # Attribute type mapping.
38
30
  def self.openapi_types
39
31
  {
40
- :'organisation_id' => :'String',
41
- :'data_month' => :'String',
42
- :'users' => :'Array<UserResponse>'
32
+ :'items' => :'Array<NewAccountFeedConnection>'
43
33
  }
44
34
  end
45
35
 
@@ -47,28 +37,20 @@ module XeroRuby::Finance
47
37
  # @param [Hash] attributes Model attributes in the form of hash
48
38
  def initialize(attributes = {})
49
39
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::UserActivitiesResponse` initialize method"
40
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::NewAccountFeedConnectionsRequest` initialize method"
51
41
  end
52
42
 
53
43
  # check to see if the attribute exists and convert string to symbol for hash key
54
44
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
45
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::UserActivitiesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
46
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::BankfeedsV2::NewAccountFeedConnectionsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
47
  end
58
48
  h[k.to_sym] = v
59
49
  }
60
50
 
61
- if attributes.key?(:'organisation_id')
62
- self.organisation_id = attributes[:'organisation_id']
63
- end
64
-
65
- if attributes.key?(:'data_month')
66
- self.data_month = attributes[:'data_month']
67
- end
68
-
69
- if attributes.key?(:'users')
70
- if (value = attributes[:'users']).is_a?(Array)
71
- self.users = value
51
+ if attributes.key?(:'items')
52
+ if (value = attributes[:'items']).is_a?(Array)
53
+ self.items = value
72
54
  end
73
55
  end
74
56
  end
@@ -77,12 +59,17 @@ module XeroRuby::Finance
77
59
  # @return Array for valid properties with the reasons
78
60
  def list_invalid_properties
79
61
  invalid_properties = Array.new
62
+ if @items.nil?
63
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
64
+ end
65
+
80
66
  invalid_properties
81
67
  end
82
68
 
83
69
  # Check to see if the all the properties in the model are valid
84
70
  # @return true if the model is valid
85
71
  def valid?
72
+ return false if @items.nil?
86
73
  true
87
74
  end
88
75
 
@@ -91,9 +78,7 @@ module XeroRuby::Finance
91
78
  def ==(o)
92
79
  return true if self.equal?(o)
93
80
  self.class == o.class &&
94
- organisation_id == o.organisation_id &&
95
- data_month == o.data_month &&
96
- users == o.users
81
+ items == o.items
97
82
  end
98
83
 
99
84
  # @see the `==` method
@@ -105,7 +90,7 @@ module XeroRuby::Finance
105
90
  # Calculates hash code according to all attributes.
106
91
  # @return [Integer] Hash code
107
92
  def hash
108
- [organisation_id, data_month, users].hash
93
+ [items].hash
109
94
  end
110
95
 
111
96
  # Builds the object from hash
@@ -174,7 +159,7 @@ module XeroRuby::Finance
174
159
  end
175
160
  end
176
161
  else # model
177
- XeroRuby::Finance.const_get(type).build_from_hash(value)
162
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
178
163
  end
179
164
  end
180
165
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Xero Finance API
2
+ #Xero Bank Feeds API v2
3
3
 
4
- #The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital.
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
5
 
6
6
  Contact: api@xero.com
7
7
  Generated by: https://openapi-generator.tech
@@ -12,34 +12,29 @@ OpenAPI Generator version: 4.3.1
12
12
  require 'time'
13
13
  require 'date'
14
14
 
15
- module XeroRuby::Finance
15
+ module XeroRuby::BankfeedsV2
16
16
  require 'bigdecimal'
17
17
 
18
- class ReportHistoryResponse
19
- # The requested Organisation to which the data pertains
20
- attr_accessor :organisation_id
21
-
22
- # The end date of the report
23
- attr_accessor :end_date
18
+ class PagedFeedConnections
19
+
20
+ attr_accessor :pagination
24
21
 
25
22
 
26
- attr_accessor :reports
23
+ attr_accessor :items
27
24
 
28
25
  # Attribute mapping from ruby-style variable name to JSON key.
29
26
  def self.attribute_map
30
27
  {
31
- :'organisation_id' => :'organisationId',
32
- :'end_date' => :'endDate',
33
- :'reports' => :'reports'
28
+ :'pagination' => :'pagination',
29
+ :'items' => :'items'
34
30
  }
35
31
  end
36
32
 
37
33
  # Attribute type mapping.
38
34
  def self.openapi_types
39
35
  {
40
- :'organisation_id' => :'String',
41
- :'end_date' => :'Date',
42
- :'reports' => :'Array<ReportHistoryModel>'
36
+ :'pagination' => :'Pagination',
37
+ :'items' => :'Array<FeedConnection>'
43
38
  }
44
39
  end
45
40
 
@@ -47,28 +42,24 @@ module XeroRuby::Finance
47
42
  # @param [Hash] attributes Model attributes in the form of hash
48
43
  def initialize(attributes = {})
49
44
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::ReportHistoryResponse` initialize method"
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::PagedFeedConnections` initialize method"
51
46
  end
52
47
 
53
48
  # check to see if the attribute exists and convert string to symbol for hash key
54
49
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
50
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::ReportHistoryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::BankfeedsV2::PagedFeedConnections`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
52
  end
58
53
  h[k.to_sym] = v
59
54
  }
60
55
 
61
- if attributes.key?(:'organisation_id')
62
- self.organisation_id = attributes[:'organisation_id']
63
- end
64
-
65
- if attributes.key?(:'end_date')
66
- self.end_date = attributes[:'end_date']
56
+ if attributes.key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
67
58
  end
68
59
 
69
- if attributes.key?(:'reports')
70
- if (value = attributes[:'reports']).is_a?(Array)
71
- self.reports = value
60
+ if attributes.key?(:'items')
61
+ if (value = attributes[:'items']).is_a?(Array)
62
+ self.items = value
72
63
  end
73
64
  end
74
65
  end
@@ -91,9 +82,8 @@ module XeroRuby::Finance
91
82
  def ==(o)
92
83
  return true if self.equal?(o)
93
84
  self.class == o.class &&
94
- organisation_id == o.organisation_id &&
95
- end_date == o.end_date &&
96
- reports == o.reports
85
+ pagination == o.pagination &&
86
+ items == o.items
97
87
  end
98
88
 
99
89
  # @see the `==` method
@@ -105,7 +95,7 @@ module XeroRuby::Finance
105
95
  # Calculates hash code according to all attributes.
106
96
  # @return [Integer] Hash code
107
97
  def hash
108
- [organisation_id, end_date, reports].hash
98
+ [pagination, items].hash
109
99
  end
110
100
 
111
101
  # Builds the object from hash
@@ -174,7 +164,7 @@ module XeroRuby::Finance
174
164
  end
175
165
  end
176
166
  else # model
177
- XeroRuby::Finance.const_get(type).build_from_hash(value)
167
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
178
168
  end
179
169
  end
180
170