xero-ruby 9.0.0 → 9.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.
- checksums.yaml +4 -4
- data/lib/xero-ruby/api/payroll_nz_api.rb +330 -7
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +13 -1
- data/lib/xero-ruby/models/accounting/contacts.rb +13 -1
- data/lib/xero-ruby/models/accounting/credit_notes.rb +13 -1
- data/lib/xero-ruby/models/accounting/invoices.rb +13 -1
- data/lib/xero-ruby/models/accounting/journals.rb +13 -1
- data/lib/xero-ruby/models/accounting/manual_journals.rb +13 -1
- data/lib/xero-ruby/models/accounting/overpayments.rb +13 -1
- data/lib/xero-ruby/models/accounting/payments.rb +13 -1
- data/lib/xero-ruby/models/accounting/prepayments.rb +13 -1
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +13 -1
- data/lib/xero-ruby/models/payroll_nz/employee.rb +24 -4
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +24 -4
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +14 -4
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb +242 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb +254 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb +244 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb +244 -0
- data/lib/xero-ruby/models/payroll_nz/employment.rb +24 -4
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +28 -4
- data/lib/xero-ruby/models/payroll_nz/working_week.rb +317 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +6 -0
- metadata +8 -2
@@ -0,0 +1,317 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Payroll NZ
|
3
|
+
|
4
|
+
#This is the Xero Payroll API for orgs in the NZ region.
|
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::PayrollNz
|
16
|
+
require 'bigdecimal'
|
17
|
+
|
18
|
+
class WorkingWeek
|
19
|
+
# The number of hours worked on a Monday
|
20
|
+
attr_accessor :monday
|
21
|
+
|
22
|
+
# The number of hours worked on a Tuesday
|
23
|
+
attr_accessor :tuesday
|
24
|
+
|
25
|
+
# The number of hours worked on a Wednesday
|
26
|
+
attr_accessor :wednesday
|
27
|
+
|
28
|
+
# The number of hours worked on a Thursday
|
29
|
+
attr_accessor :thursday
|
30
|
+
|
31
|
+
# The number of hours worked on a Friday
|
32
|
+
attr_accessor :friday
|
33
|
+
|
34
|
+
# The number of hours worked on a Saturday
|
35
|
+
attr_accessor :saturday
|
36
|
+
|
37
|
+
# The number of hours worked on a Sunday
|
38
|
+
attr_accessor :sunday
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'monday' => :'monday',
|
44
|
+
:'tuesday' => :'tuesday',
|
45
|
+
:'wednesday' => :'wednesday',
|
46
|
+
:'thursday' => :'thursday',
|
47
|
+
:'friday' => :'friday',
|
48
|
+
:'saturday' => :'saturday',
|
49
|
+
:'sunday' => :'sunday'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.openapi_types
|
55
|
+
{
|
56
|
+
:'monday' => :'BigDecimal',
|
57
|
+
:'tuesday' => :'BigDecimal',
|
58
|
+
:'wednesday' => :'BigDecimal',
|
59
|
+
:'thursday' => :'BigDecimal',
|
60
|
+
:'friday' => :'BigDecimal',
|
61
|
+
:'saturday' => :'BigDecimal',
|
62
|
+
:'sunday' => :'BigDecimal'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::WorkingWeek` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::WorkingWeek`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'monday')
|
82
|
+
self.monday = attributes[:'monday']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'tuesday')
|
86
|
+
self.tuesday = attributes[:'tuesday']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'wednesday')
|
90
|
+
self.wednesday = attributes[:'wednesday']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'thursday')
|
94
|
+
self.thursday = attributes[:'thursday']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'friday')
|
98
|
+
self.friday = attributes[:'friday']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'saturday')
|
102
|
+
self.saturday = attributes[:'saturday']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'sunday')
|
106
|
+
self.sunday = attributes[:'sunday']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
111
|
+
# @return Array for valid properties with the reasons
|
112
|
+
def list_invalid_properties
|
113
|
+
invalid_properties = Array.new
|
114
|
+
if @monday.nil?
|
115
|
+
invalid_properties.push('invalid value for "monday", monday cannot be nil.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if @tuesday.nil?
|
119
|
+
invalid_properties.push('invalid value for "tuesday", tuesday cannot be nil.')
|
120
|
+
end
|
121
|
+
|
122
|
+
if @wednesday.nil?
|
123
|
+
invalid_properties.push('invalid value for "wednesday", wednesday cannot be nil.')
|
124
|
+
end
|
125
|
+
|
126
|
+
if @thursday.nil?
|
127
|
+
invalid_properties.push('invalid value for "thursday", thursday cannot be nil.')
|
128
|
+
end
|
129
|
+
|
130
|
+
if @friday.nil?
|
131
|
+
invalid_properties.push('invalid value for "friday", friday cannot be nil.')
|
132
|
+
end
|
133
|
+
|
134
|
+
if @saturday.nil?
|
135
|
+
invalid_properties.push('invalid value for "saturday", saturday cannot be nil.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if @sunday.nil?
|
139
|
+
invalid_properties.push('invalid value for "sunday", sunday cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
invalid_properties
|
143
|
+
end
|
144
|
+
|
145
|
+
# Check to see if the all the properties in the model are valid
|
146
|
+
# @return true if the model is valid
|
147
|
+
def valid?
|
148
|
+
return false if @monday.nil?
|
149
|
+
return false if @tuesday.nil?
|
150
|
+
return false if @wednesday.nil?
|
151
|
+
return false if @thursday.nil?
|
152
|
+
return false if @friday.nil?
|
153
|
+
return false if @saturday.nil?
|
154
|
+
return false if @sunday.nil?
|
155
|
+
true
|
156
|
+
end
|
157
|
+
|
158
|
+
# Checks equality by comparing each attribute.
|
159
|
+
# @param [Object] Object to be compared
|
160
|
+
def ==(o)
|
161
|
+
return true if self.equal?(o)
|
162
|
+
self.class == o.class &&
|
163
|
+
monday == o.monday &&
|
164
|
+
tuesday == o.tuesday &&
|
165
|
+
wednesday == o.wednesday &&
|
166
|
+
thursday == o.thursday &&
|
167
|
+
friday == o.friday &&
|
168
|
+
saturday == o.saturday &&
|
169
|
+
sunday == o.sunday
|
170
|
+
end
|
171
|
+
|
172
|
+
# @see the `==` method
|
173
|
+
# @param [Object] Object to be compared
|
174
|
+
def eql?(o)
|
175
|
+
self == o
|
176
|
+
end
|
177
|
+
|
178
|
+
# Calculates hash code according to all attributes.
|
179
|
+
# @return [Integer] Hash code
|
180
|
+
def hash
|
181
|
+
[monday, tuesday, wednesday, thursday, friday, saturday, sunday].hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Builds the object from hash
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
186
|
+
# @return [Object] Returns the model itself
|
187
|
+
def self.build_from_hash(attributes)
|
188
|
+
new.build_from_hash(attributes)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Builds the object from hash
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
193
|
+
# @return [Object] Returns the model itself
|
194
|
+
def build_from_hash(attributes)
|
195
|
+
return nil unless attributes.is_a?(Hash)
|
196
|
+
self.class.openapi_types.each_pair do |key, type|
|
197
|
+
if type =~ /\AArray<(.*)>/i
|
198
|
+
# check to ensure the input is an array given that the attribute
|
199
|
+
# is documented as an array but the input is not
|
200
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
201
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
202
|
+
end
|
203
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
204
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
205
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
206
|
+
end
|
207
|
+
|
208
|
+
self
|
209
|
+
end
|
210
|
+
|
211
|
+
# Deserializes the data based on type
|
212
|
+
# @param string type Data type
|
213
|
+
# @param string value Value to be deserialized
|
214
|
+
# @return [Object] Deserialized data
|
215
|
+
def _deserialize(type, value)
|
216
|
+
case type.to_sym
|
217
|
+
when :DateTime
|
218
|
+
DateTime.parse(parse_date(value))
|
219
|
+
when :Date
|
220
|
+
Date.parse(parse_date(value))
|
221
|
+
when :String
|
222
|
+
value.to_s
|
223
|
+
when :Integer
|
224
|
+
value.to_i
|
225
|
+
when :Float
|
226
|
+
value.to_f
|
227
|
+
when :BigDecimal
|
228
|
+
BigDecimal(value.to_s)
|
229
|
+
when :Boolean
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
XeroRuby::PayrollNz.const_get(type).build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash(downcase: false)
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
next if value.nil?
|
273
|
+
key = downcase ? attr : param
|
274
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
275
|
+
end
|
276
|
+
hash
|
277
|
+
end
|
278
|
+
|
279
|
+
# Returns the object in the form of hash with snake_case
|
280
|
+
def to_attributes
|
281
|
+
to_hash(downcase: true)
|
282
|
+
end
|
283
|
+
|
284
|
+
# Outputs non-array value in the form of hash
|
285
|
+
# For object, use to_hash. Otherwise, just return the value
|
286
|
+
# @param [Object] value Any valid value
|
287
|
+
# @return [Hash] Returns the value in the form of hash
|
288
|
+
def _to_hash(value, downcase: false)
|
289
|
+
if value.is_a?(Array)
|
290
|
+
value.map do |v|
|
291
|
+
v.to_hash(downcase: downcase)
|
292
|
+
end
|
293
|
+
elsif value.is_a?(Hash)
|
294
|
+
{}.tap do |hash|
|
295
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
296
|
+
end
|
297
|
+
elsif value.respond_to? :to_hash
|
298
|
+
value.to_hash(downcase: downcase)
|
299
|
+
else
|
300
|
+
value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def parse_date(datestring)
|
305
|
+
if datestring.include?('Date')
|
306
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
307
|
+
original, date, timezone = *date_pattern.match(datestring)
|
308
|
+
date = (date.to_i / 1000)
|
309
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
310
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
311
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
312
|
+
else # handle date 'types' for small subset of payroll API's
|
313
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
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: 6.
|
10
|
+
The version of the XeroOpenAPI document: 6.1.1
|
11
11
|
=end
|
12
12
|
|
13
13
|
module XeroRuby
|
14
|
-
VERSION = '9.
|
14
|
+
VERSION = '9.1.0'
|
15
15
|
end
|
data/lib/xero-ruby.rb
CHANGED
@@ -218,6 +218,11 @@ require 'xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object'
|
|
218
218
|
require 'xero-ruby/models/payroll_nz/employee_statutory_sick_leaves'
|
219
219
|
require 'xero-ruby/models/payroll_nz/employee_tax'
|
220
220
|
require 'xero-ruby/models/payroll_nz/employee_tax_object'
|
221
|
+
require 'xero-ruby/models/payroll_nz/employee_working_pattern'
|
222
|
+
require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks'
|
223
|
+
require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object'
|
224
|
+
require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request'
|
225
|
+
require 'xero-ruby/models/payroll_nz/employee_working_patterns_object'
|
221
226
|
require 'xero-ruby/models/payroll_nz/employees'
|
222
227
|
require 'xero-ruby/models/payroll_nz/employment'
|
223
228
|
require 'xero-ruby/models/payroll_nz/employment_object'
|
@@ -271,6 +276,7 @@ require 'xero-ruby/models/payroll_nz/timesheet_object'
|
|
271
276
|
require 'xero-ruby/models/payroll_nz/timesheets'
|
272
277
|
require 'xero-ruby/models/payroll_nz/tracking_categories'
|
273
278
|
require 'xero-ruby/models/payroll_nz/tracking_category'
|
279
|
+
require 'xero-ruby/models/payroll_nz/working_week'
|
274
280
|
require 'xero-ruby/models/payroll_au/api_exception'
|
275
281
|
require 'xero-ruby/models/payroll_au/account'
|
276
282
|
require 'xero-ruby/models/payroll_au/account_type'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xero-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xero API Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -464,6 +464,11 @@ files:
|
|
464
464
|
- lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb
|
465
465
|
- lib/xero-ruby/models/payroll_nz/employee_tax.rb
|
466
466
|
- lib/xero-ruby/models/payroll_nz/employee_tax_object.rb
|
467
|
+
- lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb
|
468
|
+
- lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb
|
469
|
+
- lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb
|
470
|
+
- lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb
|
471
|
+
- lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb
|
467
472
|
- lib/xero-ruby/models/payroll_nz/employees.rb
|
468
473
|
- lib/xero-ruby/models/payroll_nz/employment.rb
|
469
474
|
- lib/xero-ruby/models/payroll_nz/employment_object.rb
|
@@ -517,6 +522,7 @@ files:
|
|
517
522
|
- lib/xero-ruby/models/payroll_nz/timesheets.rb
|
518
523
|
- lib/xero-ruby/models/payroll_nz/tracking_categories.rb
|
519
524
|
- lib/xero-ruby/models/payroll_nz/tracking_category.rb
|
525
|
+
- lib/xero-ruby/models/payroll_nz/working_week.rb
|
520
526
|
- lib/xero-ruby/models/payroll_uk/account.rb
|
521
527
|
- lib/xero-ruby/models/payroll_uk/accounts.rb
|
522
528
|
- lib/xero-ruby/models/payroll_uk/address.rb
|