xero-ruby 18.3.0 → 18.4.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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/account_data_api.rb +419 -0
  3. data/lib/xero-ruby/api_client.rb +10 -0
  4. data/lib/xero-ruby/configuration.rb +2 -0
  5. data/lib/xero-ruby/models/account_data/account.rb +351 -0
  6. data/lib/xero-ruby/models/account_data/account_balance.rb +287 -0
  7. data/lib/xero-ruby/models/account_data/account_balances_response.rb +229 -0
  8. data/lib/xero-ruby/models/account_data/account_movement.rb +347 -0
  9. data/lib/xero-ruby/models/account_data/account_movements_response.rb +229 -0
  10. data/lib/xero-ruby/models/account_data/account_transaction_line.rb +359 -0
  11. data/lib/xero-ruby/models/account_data/account_transactions_response.rb +269 -0
  12. data/lib/xero-ruby/models/account_data/account_transactions_response_pagination.rb +243 -0
  13. data/lib/xero-ruby/models/account_data/accounting_date_range.rb +242 -0
  14. data/lib/xero-ruby/models/account_data/field_problem.rb +273 -0
  15. data/lib/xero-ruby/models/account_data/gateway_problem.rb +285 -0
  16. data/lib/xero-ruby/models/account_data/ledger_decimal.rb +278 -0
  17. data/lib/xero-ruby/models/account_data/line_source.rb +273 -0
  18. data/lib/xero-ruby/models/account_data/line_tax_rate.rb +243 -0
  19. data/lib/xero-ruby/models/account_data/problem_details.rb +273 -0
  20. data/lib/xero-ruby/models/account_data/tracking_item_details.rb +257 -0
  21. data/lib/xero-ruby/models/account_data/transaction_account.rb +366 -0
  22. data/lib/xero-ruby/models/account_data/validation_problem.rb +275 -0
  23. data/lib/xero-ruby/version.rb +2 -2
  24. data/lib/xero-ruby.rb +19 -0
  25. metadata +21 -2
@@ -0,0 +1,366 @@
1
+ =begin
2
+ #Xero Account Data API (Beta)
3
+
4
+ #**Beta:** this API is in beta. Endpoints, request parameters and response shapes may change before general availability. The Account Data API provides read access to general ledger account data for a Xero organisation: account balances as at a date, account movements over a date range, and the individual account transactions behind them.
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::AccountData
16
+ require 'bigdecimal'
17
+
18
+ class TransactionAccount
19
+
20
+ attr_accessor :id
21
+
22
+
23
+ attr_accessor :code
24
+
25
+
26
+ attr_accessor :name
27
+
28
+
29
+ attr_accessor :_class
30
+ ASSET ||= "ASSET".freeze
31
+ LIABILITY ||= "LIABILITY".freeze
32
+ EQUITY ||= "EQUITY".freeze
33
+ REVENUE ||= "REVENUE".freeze
34
+ EXPENSE ||= "EXPENSE".freeze
35
+
36
+ # Account type (e.g. `BANK`, `CURRENT`). Reported as `INVENTORY` for inventory asset accounts, regardless of the account's underlying type.
37
+ attr_accessor :type
38
+
39
+
40
+ attr_accessor :status
41
+ ACTIVE ||= "ACTIVE".freeze
42
+ ARCHIVED ||= "ARCHIVED".freeze
43
+ DELETED ||= "DELETED".freeze
44
+
45
+ # System account code, or `NONE` if the account has no system account code.
46
+ attr_accessor :system_account_code
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'id' => :'id',
74
+ :'code' => :'code',
75
+ :'name' => :'name',
76
+ :'_class' => :'class',
77
+ :'type' => :'type',
78
+ :'status' => :'status',
79
+ :'system_account_code' => :'systemAccountCode'
80
+ }
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'id' => :'String',
87
+ :'code' => :'String',
88
+ :'name' => :'String',
89
+ :'_class' => :'String',
90
+ :'type' => :'String',
91
+ :'status' => :'String',
92
+ :'system_account_code' => :'String'
93
+ }
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::AccountData::TransactionAccount` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::AccountData::TransactionAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'id')
112
+ self.id = attributes[:'id']
113
+ end
114
+
115
+ if attributes.key?(:'code')
116
+ self.code = attributes[:'code']
117
+ end
118
+
119
+ if attributes.key?(:'name')
120
+ self.name = attributes[:'name']
121
+ end
122
+
123
+ if attributes.key?(:'_class')
124
+ self._class = attributes[:'_class']
125
+ end
126
+
127
+ if attributes.key?(:'type')
128
+ self.type = attributes[:'type']
129
+ end
130
+
131
+ if attributes.key?(:'status')
132
+ self.status = attributes[:'status']
133
+ end
134
+
135
+ if attributes.key?(:'system_account_code')
136
+ self.system_account_code = attributes[:'system_account_code']
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ invalid_properties = Array.new
144
+ if @id.nil?
145
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
146
+ end
147
+
148
+ if @name.nil?
149
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
150
+ end
151
+
152
+ if @_class.nil?
153
+ invalid_properties.push('invalid value for "_class", _class cannot be nil.')
154
+ end
155
+
156
+ if @type.nil?
157
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
158
+ end
159
+
160
+ if @status.nil?
161
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
162
+ end
163
+
164
+ if @system_account_code.nil?
165
+ invalid_properties.push('invalid value for "system_account_code", system_account_code cannot be nil.')
166
+ end
167
+
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ return false if @id.nil?
175
+ return false if @name.nil?
176
+ return false if @_class.nil?
177
+ _class_validator = EnumAttributeValidator.new('String', ["ASSET", "LIABILITY", "EQUITY", "REVENUE", "EXPENSE"])
178
+ return false unless _class_validator.valid?(@_class)
179
+ return false if @type.nil?
180
+ return false if @status.nil?
181
+ status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "DELETED"])
182
+ return false unless status_validator.valid?(@status)
183
+ return false if @system_account_code.nil?
184
+ true
185
+ end
186
+
187
+ # Custom attribute writer method checking allowed values (enum).
188
+ # @param [Object] _class Object to be assigned
189
+ def _class=(_class)
190
+ validator = EnumAttributeValidator.new('String', ["ASSET", "LIABILITY", "EQUITY", "REVENUE", "EXPENSE"])
191
+ unless validator.valid?(_class)
192
+ fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
193
+ end
194
+ @_class = _class
195
+ end
196
+
197
+ # Custom attribute writer method checking allowed values (enum).
198
+ # @param [Object] status Object to be assigned
199
+ def status=(status)
200
+ validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "DELETED"])
201
+ unless validator.valid?(status)
202
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
203
+ end
204
+ @status = status
205
+ end
206
+
207
+ # Checks equality by comparing each attribute.
208
+ # @param [Object] Object to be compared
209
+ def ==(o)
210
+ return true if self.equal?(o)
211
+ self.class == o.class &&
212
+ id == o.id &&
213
+ code == o.code &&
214
+ name == o.name &&
215
+ _class == o._class &&
216
+ type == o.type &&
217
+ status == o.status &&
218
+ system_account_code == o.system_account_code
219
+ end
220
+
221
+ # @see the `==` method
222
+ # @param [Object] Object to be compared
223
+ def eql?(o)
224
+ self == o
225
+ end
226
+
227
+ # Calculates hash code according to all attributes.
228
+ # @return [Integer] Hash code
229
+ def hash
230
+ [id, code, name, _class, type, status, system_account_code].hash
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def self.build_from_hash(attributes)
237
+ new.build_from_hash(attributes)
238
+ end
239
+
240
+ # Builds the object from hash
241
+ # @param [Hash] attributes Model attributes in the form of hash
242
+ # @return [Object] Returns the model itself
243
+ def build_from_hash(attributes)
244
+ return nil unless attributes.is_a?(Hash)
245
+ self.class.openapi_types.each_pair do |key, type|
246
+ if type =~ /\AArray<(.*)>/i
247
+ # check to ensure the input is an array given that the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
250
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
251
+ end
252
+ elsif !attributes[self.class.attribute_map[key]].nil?
253
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
255
+ end
256
+
257
+ self
258
+ end
259
+
260
+ # Deserializes the data based on type
261
+ # @param string type Data type
262
+ # @param string value Value to be deserialized
263
+ # @return [Object] Deserialized data
264
+ def _deserialize(type, value)
265
+ case type.to_sym
266
+ when :DateTime
267
+ DateTime.parse(parse_date(value))
268
+ when :Date
269
+ Date.parse(parse_date(value))
270
+ when :String
271
+ value.to_s
272
+ when :Integer
273
+ value.to_i
274
+ when :Float
275
+ value.to_f
276
+ when :BigDecimal
277
+ BigDecimal(value.to_s)
278
+ when :Boolean
279
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
280
+ true
281
+ else
282
+ false
283
+ end
284
+ when :Object
285
+ # generic object (usually a Hash), return directly
286
+ value
287
+ when /\AArray<(?<inner_type>.+)>\z/
288
+ inner_type = Regexp.last_match[:inner_type]
289
+ value.map { |v| _deserialize(inner_type, v) }
290
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
291
+ k_type = Regexp.last_match[:k_type]
292
+ v_type = Regexp.last_match[:v_type]
293
+ {}.tap do |hash|
294
+ value.each do |k, v|
295
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
296
+ end
297
+ end
298
+ else # model
299
+ XeroRuby::AccountData.const_get(type).build_from_hash(value)
300
+ end
301
+ end
302
+
303
+ # Returns the string representation of the object
304
+ # @return [String] String presentation of the object
305
+ def to_s
306
+ to_hash.to_s
307
+ end
308
+
309
+ # to_body is an alias to to_hash (backward compatibility)
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_body
312
+ to_hash
313
+ end
314
+
315
+ # Returns the object in the form of hash
316
+ # @return [Hash] Returns the object in the form of hash
317
+ def to_hash(downcase: false)
318
+ hash = {}
319
+ self.class.attribute_map.each_pair do |attr, param|
320
+ value = self.send(attr)
321
+ next if value.nil?
322
+ key = downcase ? attr : param
323
+ hash[key] = _to_hash(value, downcase: downcase)
324
+ end
325
+ hash
326
+ end
327
+
328
+ # Returns the object in the form of hash with snake_case
329
+ def to_attributes
330
+ to_hash(downcase: true)
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value, downcase: false)
338
+ if value.is_a?(Array)
339
+ value.map do |v|
340
+ v.to_hash(downcase: downcase)
341
+ end
342
+ elsif value.is_a?(Hash)
343
+ {}.tap do |hash|
344
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
345
+ end
346
+ elsif value.respond_to? :to_hash
347
+ value.to_hash(downcase: downcase)
348
+ else
349
+ value
350
+ end
351
+ end
352
+
353
+ def parse_date(datestring)
354
+ if datestring.include?('Date')
355
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
356
+ original, date, timezone = *date_pattern.match(datestring)
357
+ date = (date.to_i / 1000)
358
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
359
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
360
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
361
+ else # handle date 'types' for small subset of payroll API's
362
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
363
+ end
364
+ end
365
+ end
366
+ end
@@ -0,0 +1,275 @@
1
+ =begin
2
+ #Xero Account Data API (Beta)
3
+
4
+ #**Beta:** this API is in beta. Endpoints, request parameters and response shapes may change before general availability. The Account Data API provides read access to general ledger account data for a Xero organisation: account balances as at a date, account movements over a date range, and the individual account transactions behind them.
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::AccountData
16
+ # Returned with `400 Bad Request` when the request fails validation.
17
+ require 'bigdecimal'
18
+
19
+ class ValidationProblem
20
+ # URI reference identifying the problem type.
21
+ attr_accessor :type
22
+
23
+ # Short, human-readable summary.
24
+ attr_accessor :title
25
+
26
+ # HTTP status code.
27
+ attr_accessor :status
28
+
29
+ # Detailed explanation of the problem.
30
+ attr_accessor :detail
31
+
32
+ # URI reference identifying the specific occurrence.
33
+ attr_accessor :instance
34
+
35
+
36
+ attr_accessor :field_validation_errors
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'type' => :'type',
42
+ :'title' => :'title',
43
+ :'status' => :'status',
44
+ :'detail' => :'detail',
45
+ :'instance' => :'instance',
46
+ :'field_validation_errors' => :'fieldValidationErrors'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'type' => :'String',
54
+ :'title' => :'String',
55
+ :'status' => :'Integer',
56
+ :'detail' => :'String',
57
+ :'instance' => :'String',
58
+ :'field_validation_errors' => :'Array<FieldProblem>'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::AccountData::ValidationProblem` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::AccountData::ValidationProblem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'type')
78
+ self.type = attributes[:'type']
79
+ end
80
+
81
+ if attributes.key?(:'title')
82
+ self.title = attributes[:'title']
83
+ end
84
+
85
+ if attributes.key?(:'status')
86
+ self.status = attributes[:'status']
87
+ end
88
+
89
+ if attributes.key?(:'detail')
90
+ self.detail = attributes[:'detail']
91
+ end
92
+
93
+ if attributes.key?(:'instance')
94
+ self.instance = attributes[:'instance']
95
+ end
96
+
97
+ if attributes.key?(:'field_validation_errors')
98
+ if (value = attributes[:'field_validation_errors']).is_a?(Array)
99
+ self.field_validation_errors = value
100
+ end
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ type == o.type &&
123
+ title == o.title &&
124
+ status == o.status &&
125
+ detail == o.detail &&
126
+ instance == o.instance &&
127
+ field_validation_errors == o.field_validation_errors
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [type, title, status, detail, instance, field_validation_errors].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ new.build_from_hash(attributes)
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.openapi_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :DateTime
176
+ DateTime.parse(parse_date(value))
177
+ when :Date
178
+ Date.parse(parse_date(value))
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :BigDecimal
186
+ BigDecimal(value.to_s)
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ XeroRuby::AccountData.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash(downcase: false)
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ next if value.nil?
231
+ key = downcase ? attr : param
232
+ hash[key] = _to_hash(value, downcase: downcase)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Returns the object in the form of hash with snake_case
238
+ def to_attributes
239
+ to_hash(downcase: true)
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value, downcase: false)
247
+ if value.is_a?(Array)
248
+ value.map do |v|
249
+ v.to_hash(downcase: downcase)
250
+ end
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash(downcase: downcase)
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ def parse_date(datestring)
263
+ if datestring.include?('Date')
264
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
265
+ original, date, timezone = *date_pattern.match(datestring)
266
+ date = (date.to_i / 1000)
267
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
268
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
269
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
270
+ else # handle date 'types' for small subset of payroll API's
271
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
272
+ end
273
+ end
274
+ end
275
+ end
@@ -7,9 +7,9 @@ Contact: api@xero.com
7
7
  Generated by: https://openapi-generator.tech
8
8
  OpenAPI Generator version: 4.3.1
9
9
 
10
- The version of the XeroOpenAPI document: 20.0.0
10
+ The version of the XeroOpenAPI document: 20.0.1
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '18.3.0'
14
+ VERSION = '18.4.0'
15
15
  end
data/lib/xero-ruby.rb CHANGED
@@ -18,6 +18,24 @@ require 'xero-ruby/version'
18
18
  require 'xero-ruby/configuration'
19
19
 
20
20
  # Models
21
+ require 'xero-ruby/models/account_data/account'
22
+ require 'xero-ruby/models/account_data/account_balance'
23
+ require 'xero-ruby/models/account_data/account_balances_response'
24
+ require 'xero-ruby/models/account_data/account_movement'
25
+ require 'xero-ruby/models/account_data/account_movements_response'
26
+ require 'xero-ruby/models/account_data/account_transaction_line'
27
+ require 'xero-ruby/models/account_data/account_transactions_response'
28
+ require 'xero-ruby/models/account_data/account_transactions_response_pagination'
29
+ require 'xero-ruby/models/account_data/accounting_date_range'
30
+ require 'xero-ruby/models/account_data/field_problem'
31
+ require 'xero-ruby/models/account_data/gateway_problem'
32
+ require 'xero-ruby/models/account_data/ledger_decimal'
33
+ require 'xero-ruby/models/account_data/line_source'
34
+ require 'xero-ruby/models/account_data/line_tax_rate'
35
+ require 'xero-ruby/models/account_data/problem_details'
36
+ require 'xero-ruby/models/account_data/tracking_item_details'
37
+ require 'xero-ruby/models/account_data/transaction_account'
38
+ require 'xero-ruby/models/account_data/validation_problem'
21
39
  require 'xero-ruby/models/finance/balance_sheet_account_detail'
22
40
  require 'xero-ruby/models/finance/balance_sheet_account_group'
23
41
  require 'xero-ruby/models/finance/balance_sheet_account_type'
@@ -553,6 +571,7 @@ require 'xero-ruby/models/accounting/users'
553
571
  require 'xero-ruby/models/accounting/validation_error'
554
572
 
555
573
  # APIs
574
+ require 'xero-ruby/api/account_data_api'
556
575
  require 'xero-ruby/api/finance_api'
557
576
  require 'xero-ruby/api/app_store_api'
558
577
  require 'xero-ruby/api/payroll_uk_api'