xero-ruby 16.0.0 → 18.2.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.
- checksums.yaml +4 -4
- data/lib/xero-ruby/api/accounting_api.rb +189 -2
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +71 -1
- data/lib/xero-ruby/models/accounting/bank_transfer_delete.rb +244 -0
- data/lib/xero-ruby/models/accounting/bank_transfer_delete_by_url_param.rb +229 -0
- data/lib/xero-ruby/models/accounting/bank_transfers_delete.rb +224 -0
- data/lib/xero-ruby/models/accounting/credit_note.rb +11 -1
- data/lib/xero-ruby/models/accounting/invoice.rb +35 -5
- data/lib/xero-ruby/models/accounting/item.rb +22 -2
- data/lib/xero-ruby/models/accounting/organisation.rb +3 -2
- data/lib/xero-ruby/models/accounting/overpayment.rb +11 -1
- data/lib/xero-ruby/models/accounting/payment.rb +11 -1
- data/lib/xero-ruby/models/accounting/prepayment.rb +11 -1
- data/lib/xero-ruby/models/accounting/tracking_reference.rb +277 -0
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +6 -1
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +6 -1
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +6 -1
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +1 -1
- data/lib/xero-ruby/models/payroll_uk/employment_status.rb +1 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +4 -0
- metadata +378 -374
|
@@ -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
|
|
@@ -34,7 +34,7 @@ module XeroRuby::PayrollAu
|
|
|
34
34
|
# Boolean to determine if the earnings rate is reportable or exempt from W1
|
|
35
35
|
attr_accessor :is_reportable_as_w1
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# Boolean to determine if the earnings rate is considered as qualifying earnings for superannuation guarantee calculations
|
|
38
38
|
attr_accessor :is_qualifying_earnings
|
|
39
39
|
|
|
40
40
|
# Boolean to determine if the allowance earnings rate contributes towards annual leave rate. Only applicable if EarningsType is ALLOWANCE and RateType is RATEPERUNIT
|
|
@@ -245,6 +245,10 @@ module XeroRuby::PayrollAu
|
|
|
245
245
|
invalid_properties.push('invalid value for "type_of_units", the character length must be smaller than or equal to 50.')
|
|
246
246
|
end
|
|
247
247
|
|
|
248
|
+
if @is_qualifying_earnings.nil?
|
|
249
|
+
invalid_properties.push('invalid value for "is_qualifying_earnings", is_qualifying_earnings cannot be nil.')
|
|
250
|
+
end
|
|
251
|
+
|
|
248
252
|
invalid_properties
|
|
249
253
|
end
|
|
250
254
|
|
|
@@ -253,6 +257,7 @@ module XeroRuby::PayrollAu
|
|
|
253
257
|
def valid?
|
|
254
258
|
return false if !@name.nil? && @name.to_s.length > 100
|
|
255
259
|
return false if !@type_of_units.nil? && @type_of_units.to_s.length > 50
|
|
260
|
+
return false if @is_qualifying_earnings.nil?
|
|
256
261
|
true
|
|
257
262
|
end
|
|
258
263
|
|
|
@@ -31,7 +31,7 @@ module XeroRuby::PayrollAu
|
|
|
31
31
|
# amount of leave line
|
|
32
32
|
attr_accessor :include_superannuation_guarantee_contribution
|
|
33
33
|
|
|
34
|
-
#
|
|
34
|
+
# Boolean to determine if the leave line is considered as qualifying earnings for superannuation guarantee calculations
|
|
35
35
|
attr_accessor :is_qualifying_earnings
|
|
36
36
|
|
|
37
37
|
# Number of units for leave line.
|
|
@@ -129,12 +129,17 @@ module XeroRuby::PayrollAu
|
|
|
129
129
|
# @return Array for valid properties with the reasons
|
|
130
130
|
def list_invalid_properties
|
|
131
131
|
invalid_properties = Array.new
|
|
132
|
+
if @is_qualifying_earnings.nil?
|
|
133
|
+
invalid_properties.push('invalid value for "is_qualifying_earnings", is_qualifying_earnings cannot be nil.')
|
|
134
|
+
end
|
|
135
|
+
|
|
132
136
|
invalid_properties
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
# Check to see if the all the properties in the model are valid
|
|
136
140
|
# @return true if the model is valid
|
|
137
141
|
def valid?
|
|
142
|
+
return false if @is_qualifying_earnings.nil?
|
|
138
143
|
true
|
|
139
144
|
end
|
|
140
145
|
|
|
@@ -49,7 +49,7 @@ module XeroRuby::PayrollAu
|
|
|
49
49
|
# Set this to indicate that the leave type is exempt from superannuation guarantee contribution
|
|
50
50
|
attr_accessor :sgc_exempt
|
|
51
51
|
|
|
52
|
-
#
|
|
52
|
+
# Boolean to determine if the leave type is considered as qualifying earnings for superannuation guarantee calculations
|
|
53
53
|
attr_accessor :is_qualifying_earnings
|
|
54
54
|
|
|
55
55
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -160,6 +160,10 @@ module XeroRuby::PayrollAu
|
|
|
160
160
|
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
+
if @is_qualifying_earnings.nil?
|
|
164
|
+
invalid_properties.push('invalid value for "is_qualifying_earnings", is_qualifying_earnings cannot be nil.')
|
|
165
|
+
end
|
|
166
|
+
|
|
163
167
|
invalid_properties
|
|
164
168
|
end
|
|
165
169
|
|
|
@@ -167,6 +171,7 @@ module XeroRuby::PayrollAu
|
|
|
167
171
|
# @return true if the model is valid
|
|
168
172
|
def valid?
|
|
169
173
|
return false if !@name.nil? && @name.to_s.length > 100
|
|
174
|
+
return false if @is_qualifying_earnings.nil?
|
|
170
175
|
true
|
|
171
176
|
end
|
|
172
177
|
|
|
@@ -79,7 +79,7 @@ module XeroRuby::PayrollAu
|
|
|
79
79
|
# Last modified timestamp
|
|
80
80
|
attr_accessor :updated_date_utc
|
|
81
81
|
|
|
82
|
-
#
|
|
82
|
+
# Boolean to determine if leave loading is considered as qualifying earnings for superannuation guarantee calculations. Required when IncludeLeaveLoadingInSGC is specified in the payload
|
|
83
83
|
attr_accessor :include_leave_loading_in_qualifying_earnings
|
|
84
84
|
|
|
85
85
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -17,6 +17,7 @@ module XeroRuby::PayrollUk
|
|
|
17
17
|
EMPLOYEE ||= "Employee".freeze
|
|
18
18
|
WORKER ||= "Worker".freeze
|
|
19
19
|
UNSPECIFIED ||= "Unspecified".freeze
|
|
20
|
+
OFF_PAYROLL_WORKER ||= "OffPayrollWorker".freeze
|
|
20
21
|
|
|
21
22
|
# Builds the enum from string
|
|
22
23
|
# @param [String] The enum value in the form of the string
|
data/lib/xero-ruby/version.rb
CHANGED
|
@@ -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:
|
|
10
|
+
The version of the XeroOpenAPI document: 19.0.0
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module XeroRuby
|
|
14
|
-
VERSION = '
|
|
14
|
+
VERSION = '18.2.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'
|