xero-ruby 17.0.0 → 18.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.
@@ -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.1.0
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '17.0.0'
14
+ VERSION = '18.0.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'