xero-ruby 17.0.0 → 18.1.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.
@@ -63,6 +63,9 @@ module XeroRuby::Accounting
63
63
  # UTC timestamp of last update to the credit note
64
64
  attr_accessor :updated_date_utc
65
65
 
66
+ # UTC ISO-8601 formatted timestamp of last update to the credit note
67
+ attr_accessor :updated_date_utc_string
68
+
66
69
 
67
70
  attr_accessor :currency_code
68
71
 
@@ -155,6 +158,7 @@ module XeroRuby::Accounting
155
158
  :'cis_deduction' => :'CISDeduction',
156
159
  :'cis_rate' => :'CISRate',
157
160
  :'updated_date_utc' => :'UpdatedDateUTC',
161
+ :'updated_date_utc_string' => :'UpdatedDateUTCString',
158
162
  :'currency_code' => :'CurrencyCode',
159
163
  :'fully_paid_on_date' => :'FullyPaidOnDate',
160
164
  :'credit_note_id' => :'CreditNoteID',
@@ -192,6 +196,7 @@ module XeroRuby::Accounting
192
196
  :'cis_deduction' => :'BigDecimal',
193
197
  :'cis_rate' => :'BigDecimal',
194
198
  :'updated_date_utc' => :'DateTime',
199
+ :'updated_date_utc_string' => :'String',
195
200
  :'currency_code' => :'CurrencyCode',
196
201
  :'fully_paid_on_date' => :'Date',
197
202
  :'credit_note_id' => :'String',
@@ -282,6 +287,10 @@ module XeroRuby::Accounting
282
287
  self.updated_date_utc = attributes[:'updated_date_utc']
283
288
  end
284
289
 
290
+ if attributes.key?(:'updated_date_utc_string')
291
+ self.updated_date_utc_string = attributes[:'updated_date_utc_string']
292
+ end
293
+
285
294
  if attributes.key?(:'currency_code')
286
295
  self.currency_code = attributes[:'currency_code']
287
296
  end
@@ -424,6 +433,7 @@ module XeroRuby::Accounting
424
433
  cis_deduction == o.cis_deduction &&
425
434
  cis_rate == o.cis_rate &&
426
435
  updated_date_utc == o.updated_date_utc &&
436
+ updated_date_utc_string == o.updated_date_utc_string &&
427
437
  currency_code == o.currency_code &&
428
438
  fully_paid_on_date == o.fully_paid_on_date &&
429
439
  credit_note_id == o.credit_note_id &&
@@ -453,7 +463,7 @@ module XeroRuby::Accounting
453
463
  # Calculates hash code according to all attributes.
454
464
  # @return [Integer] Hash code
455
465
  def hash
456
- [type, contact, date, due_date, status, line_amount_types, line_items, sub_total, total_tax, total, cis_deduction, cis_rate, updated_date_utc, currency_code, fully_paid_on_date, credit_note_id, credit_note_number, reference, sent_to_contact, currency_rate, remaining_credit, allocations, applied_amount, payments, branding_theme_id, status_attribute_string, has_attachments, has_errors, validation_errors, warnings, invoice_addresses].hash
466
+ [type, contact, date, due_date, status, line_amount_types, line_items, sub_total, total_tax, total, cis_deduction, cis_rate, updated_date_utc, updated_date_utc_string, currency_code, fully_paid_on_date, credit_note_id, credit_note_number, reference, sent_to_contact, currency_rate, remaining_credit, allocations, applied_amount, payments, branding_theme_id, status_attribute_string, has_attachments, has_errors, validation_errors, warnings, invoice_addresses].hash
457
467
  end
458
468
 
459
469
  # Builds the object from hash
@@ -129,9 +129,12 @@ module XeroRuby::Accounting
129
129
  # Sum of all credit notes, over-payments and pre-payments applied to invoice
130
130
  attr_accessor :amount_credited
131
131
 
132
- # Last modified date UTC format
132
+ # UTC timestamp of last update to the invoice
133
133
  attr_accessor :updated_date_utc
134
134
 
135
+ # UTC ISO-8601 formatted timestamp of last update to the invoice
136
+ attr_accessor :updated_date_utc_string
137
+
135
138
  # Details of credit notes that have been applied to an invoice
136
139
  attr_accessor :credit_notes
137
140
 
@@ -212,6 +215,7 @@ module XeroRuby::Accounting
212
215
  :'fully_paid_on_date' => :'FullyPaidOnDate',
213
216
  :'amount_credited' => :'AmountCredited',
214
217
  :'updated_date_utc' => :'UpdatedDateUTC',
218
+ :'updated_date_utc_string' => :'UpdatedDateUTCString',
215
219
  :'credit_notes' => :'CreditNotes',
216
220
  :'attachments' => :'Attachments',
217
221
  :'has_errors' => :'HasErrors',
@@ -259,6 +263,7 @@ module XeroRuby::Accounting
259
263
  :'fully_paid_on_date' => :'Date',
260
264
  :'amount_credited' => :'BigDecimal',
261
265
  :'updated_date_utc' => :'DateTime',
266
+ :'updated_date_utc_string' => :'String',
262
267
  :'credit_notes' => :'Array<CreditNote>',
263
268
  :'attachments' => :'Array<Attachment>',
264
269
  :'has_errors' => :'Boolean',
@@ -430,6 +435,10 @@ module XeroRuby::Accounting
430
435
  self.updated_date_utc = attributes[:'updated_date_utc']
431
436
  end
432
437
 
438
+ if attributes.key?(:'updated_date_utc_string')
439
+ self.updated_date_utc_string = attributes[:'updated_date_utc_string']
440
+ end
441
+
433
442
  if attributes.key?(:'credit_notes')
434
443
  if (value = attributes[:'credit_notes']).is_a?(Array)
435
444
  self.credit_notes = value
@@ -562,6 +571,7 @@ module XeroRuby::Accounting
562
571
  fully_paid_on_date == o.fully_paid_on_date &&
563
572
  amount_credited == o.amount_credited &&
564
573
  updated_date_utc == o.updated_date_utc &&
574
+ updated_date_utc_string == o.updated_date_utc_string &&
565
575
  credit_notes == o.credit_notes &&
566
576
  attachments == o.attachments &&
567
577
  has_errors == o.has_errors &&
@@ -580,7 +590,7 @@ module XeroRuby::Accounting
580
590
  # Calculates hash code according to all attributes.
581
591
  # @return [Integer] Hash code
582
592
  def hash
583
- [type, contact, line_items, date, due_date, line_amount_types, invoice_number, reference, branding_theme_id, url, currency_code, currency_rate, status, sent_to_contact, expected_payment_date, planned_payment_date, cis_deduction, cis_rate, sub_total, total_tax, total, total_discount, invoice_id, repeating_invoice_id, has_attachments, is_discounted, payments, prepayments, overpayments, amount_due, amount_paid, fully_paid_on_date, amount_credited, updated_date_utc, credit_notes, attachments, has_errors, status_attribute_string, validation_errors, warnings, invoice_addresses].hash
593
+ [type, contact, line_items, date, due_date, line_amount_types, invoice_number, reference, branding_theme_id, url, currency_code, currency_rate, status, sent_to_contact, expected_payment_date, planned_payment_date, cis_deduction, cis_rate, sub_total, total_tax, total, total_discount, invoice_id, repeating_invoice_id, has_attachments, is_discounted, payments, prepayments, overpayments, amount_due, amount_paid, fully_paid_on_date, amount_credited, updated_date_utc, updated_date_utc_string, credit_notes, attachments, has_errors, status_attribute_string, validation_errors, warnings, invoice_addresses].hash
584
594
  end
585
595
 
586
596
  # Builds the object from hash
@@ -49,9 +49,15 @@ module XeroRuby::Accounting
49
49
  # The value of the item on hand. Calculated using average cost accounting.
50
50
  attr_accessor :total_cost_pool
51
51
 
52
- # The quantity of the item on hand
52
+ # The quantity of the item on hand. This will be 0 if `QuantityOnBackOrder` is greater than 0.
53
53
  attr_accessor :quantity_on_hand
54
54
 
55
+ # The quantity of the item available. This is equal to `QuantityOnHand` - `QuantityOnBackOrder`. This value will be negative if `QuantityOnBackOrder` is greater than 0.
56
+ attr_accessor :quantity_available
57
+
58
+ # The quantity of the item on backorder. This will be 0 if `QuantityOnHand` is greater than 0.
59
+ attr_accessor :quantity_on_back_order
60
+
55
61
  # Last modified date in UTC format
56
62
  attr_accessor :updated_date_utc
57
63
 
@@ -79,6 +85,8 @@ module XeroRuby::Accounting
79
85
  :'is_tracked_as_inventory' => :'IsTrackedAsInventory',
80
86
  :'total_cost_pool' => :'TotalCostPool',
81
87
  :'quantity_on_hand' => :'QuantityOnHand',
88
+ :'quantity_available' => :'QuantityAvailable',
89
+ :'quantity_on_back_order' => :'QuantityOnBackOrder',
82
90
  :'updated_date_utc' => :'UpdatedDateUTC',
83
91
  :'item_id' => :'ItemID',
84
92
  :'status_attribute_string' => :'StatusAttributeString',
@@ -101,6 +109,8 @@ module XeroRuby::Accounting
101
109
  :'is_tracked_as_inventory' => :'Boolean',
102
110
  :'total_cost_pool' => :'BigDecimal',
103
111
  :'quantity_on_hand' => :'BigDecimal',
112
+ :'quantity_available' => :'Float',
113
+ :'quantity_on_back_order' => :'Float',
104
114
  :'updated_date_utc' => :'DateTime',
105
115
  :'item_id' => :'String',
106
116
  :'status_attribute_string' => :'String',
@@ -171,6 +181,14 @@ module XeroRuby::Accounting
171
181
  self.quantity_on_hand = attributes[:'quantity_on_hand']
172
182
  end
173
183
 
184
+ if attributes.key?(:'quantity_available')
185
+ self.quantity_available = attributes[:'quantity_available']
186
+ end
187
+
188
+ if attributes.key?(:'quantity_on_back_order')
189
+ self.quantity_on_back_order = attributes[:'quantity_on_back_order']
190
+ end
191
+
174
192
  if attributes.key?(:'updated_date_utc')
175
193
  self.updated_date_utc = attributes[:'updated_date_utc']
176
194
  end
@@ -289,6 +307,8 @@ module XeroRuby::Accounting
289
307
  is_tracked_as_inventory == o.is_tracked_as_inventory &&
290
308
  total_cost_pool == o.total_cost_pool &&
291
309
  quantity_on_hand == o.quantity_on_hand &&
310
+ quantity_available == o.quantity_available &&
311
+ quantity_on_back_order == o.quantity_on_back_order &&
292
312
  updated_date_utc == o.updated_date_utc &&
293
313
  item_id == o.item_id &&
294
314
  status_attribute_string == o.status_attribute_string &&
@@ -304,7 +324,7 @@ module XeroRuby::Accounting
304
324
  # Calculates hash code according to all attributes.
305
325
  # @return [Integer] Hash code
306
326
  def hash
307
- [code, inventory_asset_account_code, name, is_sold, is_purchased, description, purchase_description, purchase_details, sales_details, is_tracked_as_inventory, total_cost_pool, quantity_on_hand, updated_date_utc, item_id, status_attribute_string, validation_errors].hash
327
+ [code, inventory_asset_account_code, name, is_sold, is_purchased, description, purchase_description, purchase_details, sales_details, is_tracked_as_inventory, total_cost_pool, quantity_on_hand, quantity_available, quantity_on_back_order, updated_date_utc, item_id, status_attribute_string, validation_errors].hash
308
328
  end
309
329
 
310
330
  # Builds the object from hash
@@ -52,6 +52,9 @@ module XeroRuby::Accounting
52
52
  # UTC timestamp of last update to the overpayment
53
53
  attr_accessor :updated_date_utc
54
54
 
55
+ # UTC ISO-8601 formatted timestamp of last update to the overpayment
56
+ attr_accessor :updated_date_utc_string
57
+
55
58
 
56
59
  attr_accessor :currency_code
57
60
 
@@ -117,6 +120,7 @@ module XeroRuby::Accounting
117
120
  :'total_tax' => :'TotalTax',
118
121
  :'total' => :'Total',
119
122
  :'updated_date_utc' => :'UpdatedDateUTC',
123
+ :'updated_date_utc_string' => :'UpdatedDateUTCString',
120
124
  :'currency_code' => :'CurrencyCode',
121
125
  :'overpayment_id' => :'OverpaymentID',
122
126
  :'currency_rate' => :'CurrencyRate',
@@ -143,6 +147,7 @@ module XeroRuby::Accounting
143
147
  :'total_tax' => :'BigDecimal',
144
148
  :'total' => :'BigDecimal',
145
149
  :'updated_date_utc' => :'DateTime',
150
+ :'updated_date_utc_string' => :'String',
146
151
  :'currency_code' => :'CurrencyCode',
147
152
  :'overpayment_id' => :'String',
148
153
  :'currency_rate' => :'BigDecimal',
@@ -213,6 +218,10 @@ module XeroRuby::Accounting
213
218
  self.updated_date_utc = attributes[:'updated_date_utc']
214
219
  end
215
220
 
221
+ if attributes.key?(:'updated_date_utc_string')
222
+ self.updated_date_utc_string = attributes[:'updated_date_utc_string']
223
+ end
224
+
216
225
  if attributes.key?(:'currency_code')
217
226
  self.currency_code = attributes[:'currency_code']
218
227
  end
@@ -314,6 +323,7 @@ module XeroRuby::Accounting
314
323
  total_tax == o.total_tax &&
315
324
  total == o.total &&
316
325
  updated_date_utc == o.updated_date_utc &&
326
+ updated_date_utc_string == o.updated_date_utc_string &&
317
327
  currency_code == o.currency_code &&
318
328
  overpayment_id == o.overpayment_id &&
319
329
  currency_rate == o.currency_rate &&
@@ -335,7 +345,7 @@ module XeroRuby::Accounting
335
345
  # Calculates hash code according to all attributes.
336
346
  # @return [Integer] Hash code
337
347
  def hash
338
- [type, contact, date, status, line_amount_types, line_items, sub_total, total_tax, total, updated_date_utc, currency_code, overpayment_id, currency_rate, remaining_credit, allocations, applied_amount, payments, has_attachments, reference, attachments].hash
348
+ [type, contact, date, status, line_amount_types, line_items, sub_total, total_tax, total, updated_date_utc, updated_date_utc_string, currency_code, overpayment_id, currency_rate, remaining_credit, allocations, applied_amount, payments, has_attachments, reference, attachments].hash
339
349
  end
340
350
 
341
351
  # Builds the object from hash
@@ -80,6 +80,9 @@ module XeroRuby::Accounting
80
80
  # UTC timestamp of last update to the payment
81
81
  attr_accessor :updated_date_utc
82
82
 
83
+ # UTC ISO-8601 formatted timestamp of last update to the payment
84
+ attr_accessor :updated_date_utc_string
85
+
83
86
  # The Xero identifier for an Payment e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9
84
87
  attr_accessor :payment_id
85
88
 
@@ -153,6 +156,7 @@ module XeroRuby::Accounting
153
156
  :'status' => :'Status',
154
157
  :'payment_type' => :'PaymentType',
155
158
  :'updated_date_utc' => :'UpdatedDateUTC',
159
+ :'updated_date_utc_string' => :'UpdatedDateUTCString',
156
160
  :'payment_id' => :'PaymentID',
157
161
  :'batch_payment_id' => :'BatchPaymentID',
158
162
  :'bank_account_number' => :'BankAccountNumber',
@@ -187,6 +191,7 @@ module XeroRuby::Accounting
187
191
  :'status' => :'String',
188
192
  :'payment_type' => :'String',
189
193
  :'updated_date_utc' => :'DateTime',
194
+ :'updated_date_utc_string' => :'String',
190
195
  :'payment_id' => :'String',
191
196
  :'batch_payment_id' => :'String',
192
197
  :'bank_account_number' => :'String',
@@ -287,6 +292,10 @@ module XeroRuby::Accounting
287
292
  self.updated_date_utc = attributes[:'updated_date_utc']
288
293
  end
289
294
 
295
+ if attributes.key?(:'updated_date_utc_string')
296
+ self.updated_date_utc_string = attributes[:'updated_date_utc_string']
297
+ end
298
+
290
299
  if attributes.key?(:'payment_id')
291
300
  self.payment_id = attributes[:'payment_id']
292
301
  end
@@ -396,6 +405,7 @@ module XeroRuby::Accounting
396
405
  status == o.status &&
397
406
  payment_type == o.payment_type &&
398
407
  updated_date_utc == o.updated_date_utc &&
408
+ updated_date_utc_string == o.updated_date_utc_string &&
399
409
  payment_id == o.payment_id &&
400
410
  batch_payment_id == o.batch_payment_id &&
401
411
  bank_account_number == o.bank_account_number &&
@@ -417,7 +427,7 @@ module XeroRuby::Accounting
417
427
  # Calculates hash code according to all attributes.
418
428
  # @return [Integer] Hash code
419
429
  def hash
420
- [invoice, credit_note, prepayment, overpayment, invoice_number, credit_note_number, batch_payment, account, code, date, currency_rate, amount, bank_amount, reference, is_reconciled, status, payment_type, updated_date_utc, payment_id, batch_payment_id, bank_account_number, particulars, details, has_account, has_validation_errors, status_attribute_string, validation_errors, warnings].hash
430
+ [invoice, credit_note, prepayment, overpayment, invoice_number, credit_note_number, batch_payment, account, code, date, currency_rate, amount, bank_amount, reference, is_reconciled, status, payment_type, updated_date_utc, updated_date_utc_string, payment_id, batch_payment_id, bank_account_number, particulars, details, has_account, has_validation_errors, status_attribute_string, validation_errors, warnings].hash
421
431
  end
422
432
 
423
433
  # Builds the object from hash
@@ -59,6 +59,9 @@ module XeroRuby::Accounting
59
59
  # UTC timestamp of last update to the prepayment
60
60
  attr_accessor :updated_date_utc
61
61
 
62
+ # UTC ISO-8601 formatted timestamp of last update to the prepayment
63
+ attr_accessor :updated_date_utc_string
64
+
62
65
 
63
66
  attr_accessor :currency_code
64
67
 
@@ -126,6 +129,7 @@ module XeroRuby::Accounting
126
129
  :'reference' => :'Reference',
127
130
  :'invoice_number' => :'InvoiceNumber',
128
131
  :'updated_date_utc' => :'UpdatedDateUTC',
132
+ :'updated_date_utc_string' => :'UpdatedDateUTCString',
129
133
  :'currency_code' => :'CurrencyCode',
130
134
  :'prepayment_id' => :'PrepaymentID',
131
135
  :'branding_theme_id' => :'BrandingThemeID',
@@ -154,6 +158,7 @@ module XeroRuby::Accounting
154
158
  :'reference' => :'String',
155
159
  :'invoice_number' => :'String',
156
160
  :'updated_date_utc' => :'DateTime',
161
+ :'updated_date_utc_string' => :'String',
157
162
  :'currency_code' => :'CurrencyCode',
158
163
  :'prepayment_id' => :'String',
159
164
  :'branding_theme_id' => :'String',
@@ -232,6 +237,10 @@ module XeroRuby::Accounting
232
237
  self.updated_date_utc = attributes[:'updated_date_utc']
233
238
  end
234
239
 
240
+ if attributes.key?(:'updated_date_utc_string')
241
+ self.updated_date_utc_string = attributes[:'updated_date_utc_string']
242
+ end
243
+
235
244
  if attributes.key?(:'currency_code')
236
245
  self.currency_code = attributes[:'currency_code']
237
246
  end
@@ -335,6 +344,7 @@ module XeroRuby::Accounting
335
344
  reference == o.reference &&
336
345
  invoice_number == o.invoice_number &&
337
346
  updated_date_utc == o.updated_date_utc &&
347
+ updated_date_utc_string == o.updated_date_utc_string &&
338
348
  currency_code == o.currency_code &&
339
349
  prepayment_id == o.prepayment_id &&
340
350
  branding_theme_id == o.branding_theme_id &&
@@ -356,7 +366,7 @@ module XeroRuby::Accounting
356
366
  # Calculates hash code according to all attributes.
357
367
  # @return [Integer] Hash code
358
368
  def hash
359
- [type, contact, date, status, line_amount_types, line_items, sub_total, total_tax, total, reference, invoice_number, updated_date_utc, currency_code, prepayment_id, branding_theme_id, currency_rate, remaining_credit, allocations, payments, applied_amount, has_attachments, attachments].hash
369
+ [type, contact, date, status, line_amount_types, line_items, sub_total, total_tax, total, reference, invoice_number, updated_date_utc, updated_date_utc_string, currency_code, prepayment_id, branding_theme_id, currency_rate, remaining_credit, allocations, payments, applied_amount, has_attachments, attachments].hash
360
370
  end
361
371
 
362
372
  # Builds the object from hash
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #Xero Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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::Accounting
16
+ require 'bigdecimal'
17
+
18
+ class TrackingReference
19
+ # The Xero identifier for a tracking category
20
+ attr_accessor :tracking_category_id
21
+
22
+ # The Xero identifier for a tracking category option
23
+ attr_accessor :tracking_option_id
24
+
25
+ # The name of the tracking category
26
+ attr_accessor :name
27
+
28
+ # See Tracking Options
29
+ attr_accessor :option
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'tracking_category_id' => :'TrackingCategoryID',
35
+ :'tracking_option_id' => :'TrackingOptionID',
36
+ :'name' => :'Name',
37
+ :'option' => :'Option'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'tracking_category_id' => :'String',
45
+ :'tracking_option_id' => :'String',
46
+ :'name' => :'String',
47
+ :'option' => :'String'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::TrackingReference` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::TrackingReference`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'tracking_category_id')
67
+ self.tracking_category_id = attributes[:'tracking_category_id']
68
+ end
69
+
70
+ if attributes.key?(:'tracking_option_id')
71
+ self.tracking_option_id = attributes[:'tracking_option_id']
72
+ end
73
+
74
+ if attributes.key?(:'name')
75
+ self.name = attributes[:'name']
76
+ end
77
+
78
+ if attributes.key?(:'option')
79
+ self.option = attributes[:'option']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @tracking_category_id.nil?
88
+ invalid_properties.push('invalid value for "tracking_category_id", tracking_category_id cannot be nil.')
89
+ end
90
+
91
+ if @tracking_option_id.nil?
92
+ invalid_properties.push('invalid value for "tracking_option_id", tracking_option_id cannot be nil.')
93
+ end
94
+
95
+ if !@name.nil? && @name.to_s.length > 100
96
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return false if @tracking_category_id.nil?
106
+ return false if @tracking_option_id.nil?
107
+ return false if !@name.nil? && @name.to_s.length > 100
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] name Value to be assigned
113
+ def name=(name)
114
+ if !name.nil? && name.to_s.length > 100
115
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
116
+ end
117
+
118
+ @name = name
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ tracking_category_id == o.tracking_category_id &&
127
+ tracking_option_id == o.tracking_option_id &&
128
+ name == o.name &&
129
+ option == o.option
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [tracking_category_id, tracking_option_id, name, option].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(parse_date(value))
179
+ when :Date
180
+ Date.parse(parse_date(value))
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :BigDecimal
188
+ BigDecimal(value.to_s)
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ XeroRuby::Accounting.const_get(type).build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash(downcase: false)
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ key = downcase ? attr : param
234
+ hash[key] = _to_hash(value, downcase: downcase)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Returns the object in the form of hash with snake_case
240
+ def to_attributes
241
+ to_hash(downcase: true)
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value, downcase: false)
249
+ if value.is_a?(Array)
250
+ value.map do |v|
251
+ v.to_hash(downcase: downcase)
252
+ end
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash(downcase: downcase)
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ def parse_date(datestring)
265
+ if datestring.include?('Date')
266
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
267
+ original, date, timezone = *date_pattern.match(datestring)
268
+ date = (date.to_i / 1000)
269
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
270
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
271
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
272
+ else # handle date 'types' for small subset of payroll API's
273
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
274
+ end
275
+ end
276
+ end
277
+ 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: 16.0.0
10
+ The version of the XeroOpenAPI document: 16.2.0
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '17.0.0'
14
+ VERSION = '18.1.0'
15
15
  end
data/lib/xero-ruby.rb CHANGED
@@ -429,7 +429,10 @@ require 'xero-ruby/models/accounting/balances'
429
429
  require 'xero-ruby/models/accounting/bank_transaction'
430
430
  require 'xero-ruby/models/accounting/bank_transactions'
431
431
  require 'xero-ruby/models/accounting/bank_transfer'
432
+ require 'xero-ruby/models/accounting/bank_transfer_delete'
433
+ require 'xero-ruby/models/accounting/bank_transfer_delete_by_url_param'
432
434
  require 'xero-ruby/models/accounting/bank_transfers'
435
+ require 'xero-ruby/models/accounting/bank_transfers_delete'
433
436
  require 'xero-ruby/models/accounting/batch_payment'
434
437
  require 'xero-ruby/models/accounting/batch_payment_delete'
435
438
  require 'xero-ruby/models/accounting/batch_payment_delete_by_url_param'
@@ -544,6 +547,7 @@ require 'xero-ruby/models/accounting/tracking_categories'
544
547
  require 'xero-ruby/models/accounting/tracking_category'
545
548
  require 'xero-ruby/models/accounting/tracking_option'
546
549
  require 'xero-ruby/models/accounting/tracking_options'
550
+ require 'xero-ruby/models/accounting/tracking_reference'
547
551
  require 'xero-ruby/models/accounting/user'
548
552
  require 'xero-ruby/models/accounting/users'
549
553
  require 'xero-ruby/models/accounting/validation_error'