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,229 @@
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 ExistingAccountFeedConnectionsRequest
19
+ # Between 1 and 50 Feed Connections to create. No element may be null.
20
+ attr_accessor :items
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'items' => :'items'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'items' => :'Array<ExistingAccountFeedConnection>'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ if (!attributes.is_a?(Hash))
40
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::ExistingAccountFeedConnectionsRequest` initialize method"
41
+ end
42
+
43
+ # check to see if the attribute exists and convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h|
45
+ if (!self.class.attribute_map.key?(k.to_sym))
46
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::BankfeedsV2::ExistingAccountFeedConnectionsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
47
+ end
48
+ h[k.to_sym] = v
49
+ }
50
+
51
+ if attributes.key?(:'items')
52
+ if (value = attributes[:'items']).is_a?(Array)
53
+ self.items = value
54
+ end
55
+ end
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ if @items.nil?
63
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
64
+ end
65
+
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ return false if @items.nil?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ items == o.items
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [items].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ new.build_from_hash(attributes)
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.openapi_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(parse_date(value))
131
+ when :Date
132
+ Date.parse(parse_date(value))
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BigDecimal
140
+ BigDecimal(value.to_s)
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash(downcase: false)
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ key = downcase ? attr : param
186
+ hash[key] = _to_hash(value, downcase: downcase)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Returns the object in the form of hash with snake_case
192
+ def to_attributes
193
+ to_hash(downcase: true)
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value, downcase: false)
201
+ if value.is_a?(Array)
202
+ value.map do |v|
203
+ v.to_hash(downcase: downcase)
204
+ end
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash(downcase: downcase)
211
+ else
212
+ value
213
+ end
214
+ end
215
+
216
+ def parse_date(datestring)
217
+ if datestring.include?('Date')
218
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
219
+ original, date, timezone = *date_pattern.match(datestring)
220
+ date = (date.to_i / 1000)
221
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
222
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
223
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
224
+ else # handle date 'types' for small subset of payroll API's
225
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
226
+ end
227
+ end
228
+ end
229
+ 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,84 +12,60 @@ 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
+ # A Feed Connection as Xero records it.
16
17
  require 'bigdecimal'
17
18
 
18
- class AccountUsage
19
- # The month this usage item contains data for
20
- attr_accessor :month
19
+ class FeedConnection
20
+ # Xero's identifier for the Feed Connection.
21
+ attr_accessor :id
21
22
 
22
- # The account this usage item contains data for
23
- attr_accessor :account_id
24
-
25
- # The currency code this usage item contains data for
26
- attr_accessor :currency_code
27
-
28
- # Total received
29
- attr_accessor :total_received
30
-
31
- # Count of received
32
- attr_accessor :count_received
23
+ # The financial institute's identifier for the account.
24
+ attr_accessor :account_token
33
25
 
34
- # Total paid
35
- attr_accessor :total_paid
36
-
37
- # Count of paid
38
- attr_accessor :count_paid
39
-
40
- # Total value of manual journals
41
- attr_accessor :total_manual_journal
26
+
27
+ attr_accessor :account_type
42
28
 
43
- # Count of manual journals
44
- attr_accessor :count_manual_journal
29
+ # The account number the feed is connected to.
30
+ attr_accessor :account_number
45
31
 
46
- # The name of the account
32
+ # The name of the Xero Bank Account.
47
33
  attr_accessor :account_name
48
34
 
49
- # Shown if set
50
- attr_accessor :reporting_code
35
+ # Xero's identifier for the Xero Bank Account.
36
+ attr_accessor :account_id
51
37
 
52
- # Shown if set
53
- attr_accessor :reporting_code_name
38
+ # ISO-4217 currency code.
39
+ attr_accessor :currency
54
40
 
55
- # Last modified date UTC format
56
- attr_accessor :report_code_updated_date_utc
41
+ # ISO-3166 alpha-2 country code.
42
+ attr_accessor :country
57
43
 
58
44
  # Attribute mapping from ruby-style variable name to JSON key.
59
45
  def self.attribute_map
60
46
  {
61
- :'month' => :'month',
62
- :'account_id' => :'accountId',
63
- :'currency_code' => :'currencyCode',
64
- :'total_received' => :'totalReceived',
65
- :'count_received' => :'countReceived',
66
- :'total_paid' => :'totalPaid',
67
- :'count_paid' => :'countPaid',
68
- :'total_manual_journal' => :'totalManualJournal',
69
- :'count_manual_journal' => :'countManualJournal',
47
+ :'id' => :'id',
48
+ :'account_token' => :'accountToken',
49
+ :'account_type' => :'accountType',
50
+ :'account_number' => :'accountNumber',
70
51
  :'account_name' => :'accountName',
71
- :'reporting_code' => :'reportingCode',
72
- :'reporting_code_name' => :'reportingCodeName',
73
- :'report_code_updated_date_utc' => :'reportCodeUpdatedDateUtc'
52
+ :'account_id' => :'accountId',
53
+ :'currency' => :'currency',
54
+ :'country' => :'country'
74
55
  }
75
56
  end
76
57
 
77
58
  # Attribute type mapping.
78
59
  def self.openapi_types
79
60
  {
80
- :'month' => :'String',
81
- :'account_id' => :'String',
82
- :'currency_code' => :'String',
83
- :'total_received' => :'BigDecimal',
84
- :'count_received' => :'Integer',
85
- :'total_paid' => :'BigDecimal',
86
- :'count_paid' => :'Integer',
87
- :'total_manual_journal' => :'BigDecimal',
88
- :'count_manual_journal' => :'Integer',
61
+ :'id' => :'String',
62
+ :'account_token' => :'String',
63
+ :'account_type' => :'AccountType',
64
+ :'account_number' => :'String',
89
65
  :'account_name' => :'String',
90
- :'reporting_code' => :'String',
91
- :'reporting_code_name' => :'String',
92
- :'report_code_updated_date_utc' => :'DateTime'
66
+ :'account_id' => :'String',
67
+ :'currency' => :'String',
68
+ :'country' => :'String'
93
69
  }
94
70
  end
95
71
 
@@ -97,67 +73,47 @@ module XeroRuby::Finance
97
73
  # @param [Hash] attributes Model attributes in the form of hash
98
74
  def initialize(attributes = {})
99
75
  if (!attributes.is_a?(Hash))
100
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::AccountUsage` initialize method"
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::FeedConnection` initialize method"
101
77
  end
102
78
 
103
79
  # check to see if the attribute exists and convert string to symbol for hash key
104
80
  attributes = attributes.each_with_object({}) { |(k, v), h|
105
81
  if (!self.class.attribute_map.key?(k.to_sym))
106
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::AccountUsage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::BankfeedsV2::FeedConnection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
83
  end
108
84
  h[k.to_sym] = v
109
85
  }
110
86
 
111
- if attributes.key?(:'month')
112
- self.month = attributes[:'month']
113
- end
114
-
115
- if attributes.key?(:'account_id')
116
- self.account_id = attributes[:'account_id']
117
- end
118
-
119
- if attributes.key?(:'currency_code')
120
- self.currency_code = attributes[:'currency_code']
121
- end
122
-
123
- if attributes.key?(:'total_received')
124
- self.total_received = attributes[:'total_received']
125
- end
126
-
127
- if attributes.key?(:'count_received')
128
- self.count_received = attributes[:'count_received']
129
- end
130
-
131
- if attributes.key?(:'total_paid')
132
- self.total_paid = attributes[:'total_paid']
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
133
89
  end
134
90
 
135
- if attributes.key?(:'count_paid')
136
- self.count_paid = attributes[:'count_paid']
91
+ if attributes.key?(:'account_token')
92
+ self.account_token = attributes[:'account_token']
137
93
  end
138
94
 
139
- if attributes.key?(:'total_manual_journal')
140
- self.total_manual_journal = attributes[:'total_manual_journal']
95
+ if attributes.key?(:'account_type')
96
+ self.account_type = attributes[:'account_type']
141
97
  end
142
98
 
143
- if attributes.key?(:'count_manual_journal')
144
- self.count_manual_journal = attributes[:'count_manual_journal']
99
+ if attributes.key?(:'account_number')
100
+ self.account_number = attributes[:'account_number']
145
101
  end
146
102
 
147
103
  if attributes.key?(:'account_name')
148
104
  self.account_name = attributes[:'account_name']
149
105
  end
150
106
 
151
- if attributes.key?(:'reporting_code')
152
- self.reporting_code = attributes[:'reporting_code']
107
+ if attributes.key?(:'account_id')
108
+ self.account_id = attributes[:'account_id']
153
109
  end
154
110
 
155
- if attributes.key?(:'reporting_code_name')
156
- self.reporting_code_name = attributes[:'reporting_code_name']
111
+ if attributes.key?(:'currency')
112
+ self.currency = attributes[:'currency']
157
113
  end
158
114
 
159
- if attributes.key?(:'report_code_updated_date_utc')
160
- self.report_code_updated_date_utc = attributes[:'report_code_updated_date_utc']
115
+ if attributes.key?(:'country')
116
+ self.country = attributes[:'country']
161
117
  end
162
118
  end
163
119
 
@@ -179,19 +135,14 @@ module XeroRuby::Finance
179
135
  def ==(o)
180
136
  return true if self.equal?(o)
181
137
  self.class == o.class &&
182
- month == o.month &&
183
- account_id == o.account_id &&
184
- currency_code == o.currency_code &&
185
- total_received == o.total_received &&
186
- count_received == o.count_received &&
187
- total_paid == o.total_paid &&
188
- count_paid == o.count_paid &&
189
- total_manual_journal == o.total_manual_journal &&
190
- count_manual_journal == o.count_manual_journal &&
138
+ id == o.id &&
139
+ account_token == o.account_token &&
140
+ account_type == o.account_type &&
141
+ account_number == o.account_number &&
191
142
  account_name == o.account_name &&
192
- reporting_code == o.reporting_code &&
193
- reporting_code_name == o.reporting_code_name &&
194
- report_code_updated_date_utc == o.report_code_updated_date_utc
143
+ account_id == o.account_id &&
144
+ currency == o.currency &&
145
+ country == o.country
195
146
  end
196
147
 
197
148
  # @see the `==` method
@@ -203,7 +154,7 @@ module XeroRuby::Finance
203
154
  # Calculates hash code according to all attributes.
204
155
  # @return [Integer] Hash code
205
156
  def hash
206
- [month, account_id, currency_code, total_received, count_received, total_paid, count_paid, total_manual_journal, count_manual_journal, account_name, reporting_code, reporting_code_name, report_code_updated_date_utc].hash
157
+ [id, account_token, account_type, account_number, account_name, account_id, currency, country].hash
207
158
  end
208
159
 
209
160
  # Builds the object from hash
@@ -272,7 +223,7 @@ module XeroRuby::Finance
272
223
  end
273
224
  end
274
225
  else # model
275
- XeroRuby::Finance.const_get(type).build_from_hash(value)
226
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
276
227
  end
277
228
  end
278
229
 
@@ -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,39 +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 AccountUsageResponse
19
- # The requested Organisation to which the data pertains
20
- attr_accessor :organisation_id
21
-
22
- # The start month of the report
23
- attr_accessor :start_month
24
-
25
- # The end month of the report
26
- attr_accessor :end_month
27
-
28
-
29
- attr_accessor :account_usage
18
+ class FeedConnectionToDelete
19
+ # The Feed Connection to terminate. Required; an all-zeros GUID is treated as though the field were absent. `accountToken`, `accountType` and `country`, which V1 accepted here, are not supported.
20
+ attr_accessor :id
30
21
 
31
22
  # Attribute mapping from ruby-style variable name to JSON key.
32
23
  def self.attribute_map
33
24
  {
34
- :'organisation_id' => :'organisationId',
35
- :'start_month' => :'startMonth',
36
- :'end_month' => :'endMonth',
37
- :'account_usage' => :'accountUsage'
25
+ :'id' => :'id'
38
26
  }
39
27
  end
40
28
 
41
29
  # Attribute type mapping.
42
30
  def self.openapi_types
43
31
  {
44
- :'organisation_id' => :'String',
45
- :'start_month' => :'String',
46
- :'end_month' => :'String',
47
- :'account_usage' => :'Array<AccountUsage>'
32
+ :'id' => :'String'
48
33
  }
49
34
  end
50
35
 
@@ -52,33 +37,19 @@ module XeroRuby::Finance
52
37
  # @param [Hash] attributes Model attributes in the form of hash
53
38
  def initialize(attributes = {})
54
39
  if (!attributes.is_a?(Hash))
55
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::AccountUsageResponse` initialize method"
40
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::BankfeedsV2::FeedConnectionToDelete` initialize method"
56
41
  end
57
42
 
58
43
  # check to see if the attribute exists and convert string to symbol for hash key
59
44
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
45
  if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::AccountUsageResponse`. 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::FeedConnectionToDelete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
47
  end
63
48
  h[k.to_sym] = v
64
49
  }
65
50
 
66
- if attributes.key?(:'organisation_id')
67
- self.organisation_id = attributes[:'organisation_id']
68
- end
69
-
70
- if attributes.key?(:'start_month')
71
- self.start_month = attributes[:'start_month']
72
- end
73
-
74
- if attributes.key?(:'end_month')
75
- self.end_month = attributes[:'end_month']
76
- end
77
-
78
- if attributes.key?(:'account_usage')
79
- if (value = attributes[:'account_usage']).is_a?(Array)
80
- self.account_usage = value
81
- end
51
+ if attributes.key?(:'id')
52
+ self.id = attributes[:'id']
82
53
  end
83
54
  end
84
55
 
@@ -86,12 +57,17 @@ module XeroRuby::Finance
86
57
  # @return Array for valid properties with the reasons
87
58
  def list_invalid_properties
88
59
  invalid_properties = Array.new
60
+ if @id.nil?
61
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
62
+ end
63
+
89
64
  invalid_properties
90
65
  end
91
66
 
92
67
  # Check to see if the all the properties in the model are valid
93
68
  # @return true if the model is valid
94
69
  def valid?
70
+ return false if @id.nil?
95
71
  true
96
72
  end
97
73
 
@@ -100,10 +76,7 @@ module XeroRuby::Finance
100
76
  def ==(o)
101
77
  return true if self.equal?(o)
102
78
  self.class == o.class &&
103
- organisation_id == o.organisation_id &&
104
- start_month == o.start_month &&
105
- end_month == o.end_month &&
106
- account_usage == o.account_usage
79
+ id == o.id
107
80
  end
108
81
 
109
82
  # @see the `==` method
@@ -115,7 +88,7 @@ module XeroRuby::Finance
115
88
  # Calculates hash code according to all attributes.
116
89
  # @return [Integer] Hash code
117
90
  def hash
118
- [organisation_id, start_month, end_month, account_usage].hash
91
+ [id].hash
119
92
  end
120
93
 
121
94
  # Builds the object from hash
@@ -184,7 +157,7 @@ module XeroRuby::Finance
184
157
  end
185
158
  end
186
159
  else # model
187
- XeroRuby::Finance.const_get(type).build_from_hash(value)
160
+ XeroRuby::BankfeedsV2.const_get(type).build_from_hash(value)
188
161
  end
189
162
  end
190
163