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
@@ -1,242 +0,0 @@
1
- =begin
2
- #Xero Finance API
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.
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::Finance
16
- require 'bigdecimal'
17
-
18
- class ReportHistoryModel
19
- # Report code or report title
20
- attr_accessor :report_name
21
-
22
- # The date or date range of the report
23
- attr_accessor :report_date_text
24
-
25
- # The system date time that the report was published
26
- attr_accessor :published_date_utc
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'report_name' => :'reportName',
32
- :'report_date_text' => :'reportDateText',
33
- :'published_date_utc' => :'publishedDateUtc'
34
- }
35
- end
36
-
37
- # Attribute type mapping.
38
- def self.openapi_types
39
- {
40
- :'report_name' => :'String',
41
- :'report_date_text' => :'String',
42
- :'published_date_utc' => :'DateTime'
43
- }
44
- end
45
-
46
- # Initializes the object
47
- # @param [Hash] attributes Model attributes in the form of hash
48
- def initialize(attributes = {})
49
- if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::ReportHistoryModel` initialize method"
51
- end
52
-
53
- # check to see if the attribute exists and convert string to symbol for hash key
54
- attributes = attributes.each_with_object({}) { |(k, v), h|
55
- if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::ReportHistoryModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
- end
58
- h[k.to_sym] = v
59
- }
60
-
61
- if attributes.key?(:'report_name')
62
- self.report_name = attributes[:'report_name']
63
- end
64
-
65
- if attributes.key?(:'report_date_text')
66
- self.report_date_text = attributes[:'report_date_text']
67
- end
68
-
69
- if attributes.key?(:'published_date_utc')
70
- self.published_date_utc = attributes[:'published_date_utc']
71
- end
72
- end
73
-
74
- # Show invalid properties with the reasons. Usually used together with valid?
75
- # @return Array for valid properties with the reasons
76
- def list_invalid_properties
77
- invalid_properties = Array.new
78
- invalid_properties
79
- end
80
-
81
- # Check to see if the all the properties in the model are valid
82
- # @return true if the model is valid
83
- def valid?
84
- true
85
- end
86
-
87
- # Checks equality by comparing each attribute.
88
- # @param [Object] Object to be compared
89
- def ==(o)
90
- return true if self.equal?(o)
91
- self.class == o.class &&
92
- report_name == o.report_name &&
93
- report_date_text == o.report_date_text &&
94
- published_date_utc == o.published_date_utc
95
- end
96
-
97
- # @see the `==` method
98
- # @param [Object] Object to be compared
99
- def eql?(o)
100
- self == o
101
- end
102
-
103
- # Calculates hash code according to all attributes.
104
- # @return [Integer] Hash code
105
- def hash
106
- [report_name, report_date_text, published_date_utc].hash
107
- end
108
-
109
- # Builds the object from hash
110
- # @param [Hash] attributes Model attributes in the form of hash
111
- # @return [Object] Returns the model itself
112
- def self.build_from_hash(attributes)
113
- new.build_from_hash(attributes)
114
- end
115
-
116
- # Builds the object from hash
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- # @return [Object] Returns the model itself
119
- def build_from_hash(attributes)
120
- return nil unless attributes.is_a?(Hash)
121
- self.class.openapi_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
123
- # check to ensure the input is an array given that the attribute
124
- # is documented as an array but the input is not
125
- if attributes[self.class.attribute_map[key]].is_a?(Array)
126
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
- end
128
- elsif !attributes[self.class.attribute_map[key]].nil?
129
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
131
- end
132
-
133
- self
134
- end
135
-
136
- # Deserializes the data based on type
137
- # @param string type Data type
138
- # @param string value Value to be deserialized
139
- # @return [Object] Deserialized data
140
- def _deserialize(type, value)
141
- case type.to_sym
142
- when :DateTime
143
- DateTime.parse(parse_date(value))
144
- when :Date
145
- Date.parse(parse_date(value))
146
- when :String
147
- value.to_s
148
- when :Integer
149
- value.to_i
150
- when :Float
151
- value.to_f
152
- when :BigDecimal
153
- BigDecimal(value.to_s)
154
- when :Boolean
155
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
- true
157
- else
158
- false
159
- end
160
- when :Object
161
- # generic object (usually a Hash), return directly
162
- value
163
- when /\AArray<(?<inner_type>.+)>\z/
164
- inner_type = Regexp.last_match[:inner_type]
165
- value.map { |v| _deserialize(inner_type, v) }
166
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
- k_type = Regexp.last_match[:k_type]
168
- v_type = Regexp.last_match[:v_type]
169
- {}.tap do |hash|
170
- value.each do |k, v|
171
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
- end
173
- end
174
- else # model
175
- XeroRuby::Finance.const_get(type).build_from_hash(value)
176
- end
177
- end
178
-
179
- # Returns the string representation of the object
180
- # @return [String] String presentation of the object
181
- def to_s
182
- to_hash.to_s
183
- end
184
-
185
- # to_body is an alias to to_hash (backward compatibility)
186
- # @return [Hash] Returns the object in the form of hash
187
- def to_body
188
- to_hash
189
- end
190
-
191
- # Returns the object in the form of hash
192
- # @return [Hash] Returns the object in the form of hash
193
- def to_hash(downcase: false)
194
- hash = {}
195
- self.class.attribute_map.each_pair do |attr, param|
196
- value = self.send(attr)
197
- next if value.nil?
198
- key = downcase ? attr : param
199
- hash[key] = _to_hash(value, downcase: downcase)
200
- end
201
- hash
202
- end
203
-
204
- # Returns the object in the form of hash with snake_case
205
- def to_attributes
206
- to_hash(downcase: true)
207
- end
208
-
209
- # Outputs non-array value in the form of hash
210
- # For object, use to_hash. Otherwise, just return the value
211
- # @param [Object] value Any valid value
212
- # @return [Hash] Returns the value in the form of hash
213
- def _to_hash(value, downcase: false)
214
- if value.is_a?(Array)
215
- value.map do |v|
216
- v.to_hash(downcase: downcase)
217
- end
218
- elsif value.is_a?(Hash)
219
- {}.tap do |hash|
220
- value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
221
- end
222
- elsif value.respond_to? :to_hash
223
- value.to_hash(downcase: downcase)
224
- else
225
- value
226
- end
227
- end
228
-
229
- def parse_date(datestring)
230
- if datestring.include?('Date')
231
- date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
232
- original, date, timezone = *date_pattern.match(datestring)
233
- date = (date.to_i / 1000)
234
- Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
235
- elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
236
- Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
237
- else # handle date 'types' for small subset of payroll API's
238
- Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
239
- end
240
- end
241
- end
242
- end
@@ -1,336 +0,0 @@
1
- =begin
2
- #Xero Finance API
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.
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::Finance
16
- require 'bigdecimal'
17
-
18
- class UserResponse
19
- # The Xero identifier for the user
20
- attr_accessor :user_id
21
-
22
- # Timestamp of user creation.
23
- attr_accessor :user_created_date_utc
24
-
25
- # Timestamp of user last login
26
- attr_accessor :last_login_date_utc
27
-
28
- # User is external partner.
29
- attr_accessor :is_external_partner
30
-
31
- # User has Accountant role.
32
- attr_accessor :has_accountant_role
33
-
34
- # Month period in format yyyy-MM.
35
- attr_accessor :month_period
36
-
37
- # Number of times the user has logged in.
38
- attr_accessor :number_of_logins
39
-
40
- # Number of documents created.
41
- attr_accessor :number_of_documents_created
42
-
43
- # Net value of documents created.
44
- attr_accessor :net_value_documents_created
45
-
46
- # Absolute value of documents created.
47
- attr_accessor :absolute_value_documents_created
48
-
49
-
50
- attr_accessor :attached_practices
51
-
52
-
53
- attr_accessor :history_records
54
-
55
- # Attribute mapping from ruby-style variable name to JSON key.
56
- def self.attribute_map
57
- {
58
- :'user_id' => :'userId',
59
- :'user_created_date_utc' => :'userCreatedDateUtc',
60
- :'last_login_date_utc' => :'lastLoginDateUtc',
61
- :'is_external_partner' => :'isExternalPartner',
62
- :'has_accountant_role' => :'hasAccountantRole',
63
- :'month_period' => :'monthPeriod',
64
- :'number_of_logins' => :'numberOfLogins',
65
- :'number_of_documents_created' => :'numberOfDocumentsCreated',
66
- :'net_value_documents_created' => :'netValueDocumentsCreated',
67
- :'absolute_value_documents_created' => :'absoluteValueDocumentsCreated',
68
- :'attached_practices' => :'attachedPractices',
69
- :'history_records' => :'historyRecords'
70
- }
71
- end
72
-
73
- # Attribute type mapping.
74
- def self.openapi_types
75
- {
76
- :'user_id' => :'String',
77
- :'user_created_date_utc' => :'DateTime',
78
- :'last_login_date_utc' => :'DateTime',
79
- :'is_external_partner' => :'Boolean',
80
- :'has_accountant_role' => :'Boolean',
81
- :'month_period' => :'String',
82
- :'number_of_logins' => :'Integer',
83
- :'number_of_documents_created' => :'Integer',
84
- :'net_value_documents_created' => :'BigDecimal',
85
- :'absolute_value_documents_created' => :'BigDecimal',
86
- :'attached_practices' => :'Array<PracticeResponse>',
87
- :'history_records' => :'Array<HistoryRecordResponse>'
88
- }
89
- end
90
-
91
- # Initializes the object
92
- # @param [Hash] attributes Model attributes in the form of hash
93
- def initialize(attributes = {})
94
- if (!attributes.is_a?(Hash))
95
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::UserResponse` initialize method"
96
- end
97
-
98
- # check to see if the attribute exists and convert string to symbol for hash key
99
- attributes = attributes.each_with_object({}) { |(k, v), h|
100
- if (!self.class.attribute_map.key?(k.to_sym))
101
- fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::UserResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
- end
103
- h[k.to_sym] = v
104
- }
105
-
106
- if attributes.key?(:'user_id')
107
- self.user_id = attributes[:'user_id']
108
- end
109
-
110
- if attributes.key?(:'user_created_date_utc')
111
- self.user_created_date_utc = attributes[:'user_created_date_utc']
112
- end
113
-
114
- if attributes.key?(:'last_login_date_utc')
115
- self.last_login_date_utc = attributes[:'last_login_date_utc']
116
- end
117
-
118
- if attributes.key?(:'is_external_partner')
119
- self.is_external_partner = attributes[:'is_external_partner']
120
- end
121
-
122
- if attributes.key?(:'has_accountant_role')
123
- self.has_accountant_role = attributes[:'has_accountant_role']
124
- end
125
-
126
- if attributes.key?(:'month_period')
127
- self.month_period = attributes[:'month_period']
128
- end
129
-
130
- if attributes.key?(:'number_of_logins')
131
- self.number_of_logins = attributes[:'number_of_logins']
132
- end
133
-
134
- if attributes.key?(:'number_of_documents_created')
135
- self.number_of_documents_created = attributes[:'number_of_documents_created']
136
- end
137
-
138
- if attributes.key?(:'net_value_documents_created')
139
- self.net_value_documents_created = attributes[:'net_value_documents_created']
140
- end
141
-
142
- if attributes.key?(:'absolute_value_documents_created')
143
- self.absolute_value_documents_created = attributes[:'absolute_value_documents_created']
144
- end
145
-
146
- if attributes.key?(:'attached_practices')
147
- if (value = attributes[:'attached_practices']).is_a?(Array)
148
- self.attached_practices = value
149
- end
150
- end
151
-
152
- if attributes.key?(:'history_records')
153
- if (value = attributes[:'history_records']).is_a?(Array)
154
- self.history_records = value
155
- end
156
- end
157
- end
158
-
159
- # Show invalid properties with the reasons. Usually used together with valid?
160
- # @return Array for valid properties with the reasons
161
- def list_invalid_properties
162
- invalid_properties = Array.new
163
- invalid_properties
164
- end
165
-
166
- # Check to see if the all the properties in the model are valid
167
- # @return true if the model is valid
168
- def valid?
169
- true
170
- end
171
-
172
- # Checks equality by comparing each attribute.
173
- # @param [Object] Object to be compared
174
- def ==(o)
175
- return true if self.equal?(o)
176
- self.class == o.class &&
177
- user_id == o.user_id &&
178
- user_created_date_utc == o.user_created_date_utc &&
179
- last_login_date_utc == o.last_login_date_utc &&
180
- is_external_partner == o.is_external_partner &&
181
- has_accountant_role == o.has_accountant_role &&
182
- month_period == o.month_period &&
183
- number_of_logins == o.number_of_logins &&
184
- number_of_documents_created == o.number_of_documents_created &&
185
- net_value_documents_created == o.net_value_documents_created &&
186
- absolute_value_documents_created == o.absolute_value_documents_created &&
187
- attached_practices == o.attached_practices &&
188
- history_records == o.history_records
189
- end
190
-
191
- # @see the `==` method
192
- # @param [Object] Object to be compared
193
- def eql?(o)
194
- self == o
195
- end
196
-
197
- # Calculates hash code according to all attributes.
198
- # @return [Integer] Hash code
199
- def hash
200
- [user_id, user_created_date_utc, last_login_date_utc, is_external_partner, has_accountant_role, month_period, number_of_logins, number_of_documents_created, net_value_documents_created, absolute_value_documents_created, attached_practices, history_records].hash
201
- end
202
-
203
- # Builds the object from hash
204
- # @param [Hash] attributes Model attributes in the form of hash
205
- # @return [Object] Returns the model itself
206
- def self.build_from_hash(attributes)
207
- new.build_from_hash(attributes)
208
- end
209
-
210
- # Builds the object from hash
211
- # @param [Hash] attributes Model attributes in the form of hash
212
- # @return [Object] Returns the model itself
213
- def build_from_hash(attributes)
214
- return nil unless attributes.is_a?(Hash)
215
- self.class.openapi_types.each_pair do |key, type|
216
- if type =~ /\AArray<(.*)>/i
217
- # check to ensure the input is an array given that the attribute
218
- # is documented as an array but the input is not
219
- if attributes[self.class.attribute_map[key]].is_a?(Array)
220
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
- end
222
- elsif !attributes[self.class.attribute_map[key]].nil?
223
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
- end # or else data not found in attributes(hash), not an issue as the data can be optional
225
- end
226
-
227
- self
228
- end
229
-
230
- # Deserializes the data based on type
231
- # @param string type Data type
232
- # @param string value Value to be deserialized
233
- # @return [Object] Deserialized data
234
- def _deserialize(type, value)
235
- case type.to_sym
236
- when :DateTime
237
- DateTime.parse(parse_date(value))
238
- when :Date
239
- Date.parse(parse_date(value))
240
- when :String
241
- value.to_s
242
- when :Integer
243
- value.to_i
244
- when :Float
245
- value.to_f
246
- when :BigDecimal
247
- BigDecimal(value.to_s)
248
- when :Boolean
249
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
- true
251
- else
252
- false
253
- end
254
- when :Object
255
- # generic object (usually a Hash), return directly
256
- value
257
- when /\AArray<(?<inner_type>.+)>\z/
258
- inner_type = Regexp.last_match[:inner_type]
259
- value.map { |v| _deserialize(inner_type, v) }
260
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
- k_type = Regexp.last_match[:k_type]
262
- v_type = Regexp.last_match[:v_type]
263
- {}.tap do |hash|
264
- value.each do |k, v|
265
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
- end
267
- end
268
- else # model
269
- XeroRuby::Finance.const_get(type).build_from_hash(value)
270
- end
271
- end
272
-
273
- # Returns the string representation of the object
274
- # @return [String] String presentation of the object
275
- def to_s
276
- to_hash.to_s
277
- end
278
-
279
- # to_body is an alias to to_hash (backward compatibility)
280
- # @return [Hash] Returns the object in the form of hash
281
- def to_body
282
- to_hash
283
- end
284
-
285
- # Returns the object in the form of hash
286
- # @return [Hash] Returns the object in the form of hash
287
- def to_hash(downcase: false)
288
- hash = {}
289
- self.class.attribute_map.each_pair do |attr, param|
290
- value = self.send(attr)
291
- next if value.nil?
292
- key = downcase ? attr : param
293
- hash[key] = _to_hash(value, downcase: downcase)
294
- end
295
- hash
296
- end
297
-
298
- # Returns the object in the form of hash with snake_case
299
- def to_attributes
300
- to_hash(downcase: true)
301
- end
302
-
303
- # Outputs non-array value in the form of hash
304
- # For object, use to_hash. Otherwise, just return the value
305
- # @param [Object] value Any valid value
306
- # @return [Hash] Returns the value in the form of hash
307
- def _to_hash(value, downcase: false)
308
- if value.is_a?(Array)
309
- value.map do |v|
310
- v.to_hash(downcase: downcase)
311
- end
312
- elsif value.is_a?(Hash)
313
- {}.tap do |hash|
314
- value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
315
- end
316
- elsif value.respond_to? :to_hash
317
- value.to_hash(downcase: downcase)
318
- else
319
- value
320
- end
321
- end
322
-
323
- def parse_date(datestring)
324
- if datestring.include?('Date')
325
- date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
326
- original, date, timezone = *date_pattern.match(datestring)
327
- date = (date.to_i / 1000)
328
- Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
329
- elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
330
- Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
331
- else # handle date 'types' for small subset of payroll API's
332
- Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
333
- end
334
- end
335
- end
336
- end