xero-ruby 12.2.0 → 12.3.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/models/payroll_uk/contract_type.rb +38 -0
- data/lib/xero-ruby/models/payroll_uk/contracts.rb +297 -0
- data/lib/xero-ruby/models/payroll_uk/developmental_role_details.rb +267 -0
- data/lib/xero-ruby/models/payroll_uk/employee.rb +16 -4
- data/lib/xero-ruby/models/payroll_uk/employment.rb +16 -4
- data/lib/xero-ruby/models/payroll_uk/employment_status.rb +37 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed19b96582ad3c96a1154ae2e19aa8f0d385cca2d2f577b027e485100aba9034
|
|
4
|
+
data.tar.gz: 5b2bdc6302be1144075cbbd27f8d587b4a18151013676ea85065ab2e6f3e3cc1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3749eac943f2fc868d09e9842d2c436a9699df00ceac496f2de05f79892c9fd128e7cf76ebf2e26deded7579a23969dccbf4a05bb1f8240e2f98c4b735322a7e
|
|
7
|
+
data.tar.gz: de3e5c5b9fc310ba1987753ada7988500680c7079a1f5f6bce4ab31e41f1871872dca7970e036efa0a9e070345b0a224ef4b555b04d4c66beadb22b39f8c8dc9
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll UK
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API for orgs in the UK 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::PayrollUk
|
|
16
|
+
class ContractType
|
|
17
|
+
FULL_TIME ||= "FullTime".freeze
|
|
18
|
+
PART_TIME ||= "PartTime".freeze
|
|
19
|
+
ZERO_HOUR ||= "ZeroHour".freeze
|
|
20
|
+
UNSPECIFIED ||= "Unspecified".freeze
|
|
21
|
+
|
|
22
|
+
# Builds the enum from string
|
|
23
|
+
# @param [String] The enum value in the form of the string
|
|
24
|
+
# @return [String] The enum value
|
|
25
|
+
def self.build_from_hash(value)
|
|
26
|
+
new.build_from_hash(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds the enum from string
|
|
30
|
+
# @param [String] The enum value in the form of the string
|
|
31
|
+
# @return [String] The enum value
|
|
32
|
+
def build_from_hash(value)
|
|
33
|
+
constantValues = ContractType.constants.select { |c| ContractType::const_get(c) == value }
|
|
34
|
+
raise "Invalid ENUM value #{value} for class #ContractType" if constantValues.empty?
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll UK
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API for orgs in the UK 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::PayrollUk
|
|
16
|
+
require 'bigdecimal'
|
|
17
|
+
|
|
18
|
+
class Contracts
|
|
19
|
+
# The contract start date of the employee. This will be locked once an employee has been paid and cannot be changed (YYYY-MM-DD)
|
|
20
|
+
attr_accessor :start_date
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
attr_accessor :employment_status
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
attr_accessor :contract_type
|
|
27
|
+
|
|
28
|
+
# The public key of the contract. Public key is required if the intention is to edit an existing contract. If no key is supplied a new contract will be created
|
|
29
|
+
attr_accessor :public_key
|
|
30
|
+
|
|
31
|
+
# describes whether the contract is fixed term (required if trying to create Fixed term contract)
|
|
32
|
+
attr_accessor :is_fixed_term
|
|
33
|
+
|
|
34
|
+
# The fixed term end date of the employee. Not required if isFixedTerm is false or not provided (required if trying to create Fixed term contract)
|
|
35
|
+
attr_accessor :fixed_term_end_date
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
attr_accessor :developmental_role_details
|
|
39
|
+
|
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
|
+
def self.attribute_map
|
|
42
|
+
{
|
|
43
|
+
:'start_date' => :'startDate',
|
|
44
|
+
:'employment_status' => :'employmentStatus',
|
|
45
|
+
:'contract_type' => :'contractType',
|
|
46
|
+
:'public_key' => :'publicKey',
|
|
47
|
+
:'is_fixed_term' => :'isFixedTerm',
|
|
48
|
+
:'fixed_term_end_date' => :'fixedTermEndDate',
|
|
49
|
+
:'developmental_role_details' => :'developmentalRoleDetails'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute type mapping.
|
|
54
|
+
def self.openapi_types
|
|
55
|
+
{
|
|
56
|
+
:'start_date' => :'Date',
|
|
57
|
+
:'employment_status' => :'EmploymentStatus',
|
|
58
|
+
:'contract_type' => :'ContractType',
|
|
59
|
+
:'public_key' => :'String',
|
|
60
|
+
:'is_fixed_term' => :'Boolean',
|
|
61
|
+
:'fixed_term_end_date' => :'Date',
|
|
62
|
+
:'developmental_role_details' => :'DevelopmentalRoleDetails'
|
|
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::PayrollUk::Contracts` 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::PayrollUk::Contracts`. 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?(:'start_date')
|
|
82
|
+
self.start_date = attributes[:'start_date']
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'employment_status')
|
|
86
|
+
self.employment_status = attributes[:'employment_status']
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'contract_type')
|
|
90
|
+
self.contract_type = attributes[:'contract_type']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'public_key')
|
|
94
|
+
self.public_key = attributes[:'public_key']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'is_fixed_term')
|
|
98
|
+
self.is_fixed_term = attributes[:'is_fixed_term']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'fixed_term_end_date')
|
|
102
|
+
self.fixed_term_end_date = attributes[:'fixed_term_end_date']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'developmental_role_details')
|
|
106
|
+
self.developmental_role_details = attributes[:'developmental_role_details']
|
|
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 @start_date.nil?
|
|
115
|
+
invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if @employment_status.nil?
|
|
119
|
+
invalid_properties.push('invalid value for "employment_status", employment_status cannot be nil.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if @contract_type.nil?
|
|
123
|
+
invalid_properties.push('invalid value for "contract_type", contract_type cannot be nil.')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
invalid_properties
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Check to see if the all the properties in the model are valid
|
|
130
|
+
# @return true if the model is valid
|
|
131
|
+
def valid?
|
|
132
|
+
return false if @start_date.nil?
|
|
133
|
+
return false if @employment_status.nil?
|
|
134
|
+
return false if @contract_type.nil?
|
|
135
|
+
true
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Checks equality by comparing each attribute.
|
|
139
|
+
# @param [Object] Object to be compared
|
|
140
|
+
def ==(o)
|
|
141
|
+
return true if self.equal?(o)
|
|
142
|
+
self.class == o.class &&
|
|
143
|
+
start_date == o.start_date &&
|
|
144
|
+
employment_status == o.employment_status &&
|
|
145
|
+
contract_type == o.contract_type &&
|
|
146
|
+
public_key == o.public_key &&
|
|
147
|
+
is_fixed_term == o.is_fixed_term &&
|
|
148
|
+
fixed_term_end_date == o.fixed_term_end_date &&
|
|
149
|
+
developmental_role_details == o.developmental_role_details
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# @see the `==` method
|
|
153
|
+
# @param [Object] Object to be compared
|
|
154
|
+
def eql?(o)
|
|
155
|
+
self == o
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Calculates hash code according to all attributes.
|
|
159
|
+
# @return [Integer] Hash code
|
|
160
|
+
def hash
|
|
161
|
+
[start_date, employment_status, contract_type, public_key, is_fixed_term, fixed_term_end_date, developmental_role_details].hash
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Builds the object from hash
|
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
166
|
+
# @return [Object] Returns the model itself
|
|
167
|
+
def self.build_from_hash(attributes)
|
|
168
|
+
new.build_from_hash(attributes)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Builds the object from hash
|
|
172
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
173
|
+
# @return [Object] Returns the model itself
|
|
174
|
+
def build_from_hash(attributes)
|
|
175
|
+
return nil unless attributes.is_a?(Hash)
|
|
176
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
177
|
+
if type =~ /\AArray<(.*)>/i
|
|
178
|
+
# check to ensure the input is an array given that the attribute
|
|
179
|
+
# is documented as an array but the input is not
|
|
180
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
181
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
182
|
+
end
|
|
183
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
184
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
185
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
self
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Deserializes the data based on type
|
|
192
|
+
# @param string type Data type
|
|
193
|
+
# @param string value Value to be deserialized
|
|
194
|
+
# @return [Object] Deserialized data
|
|
195
|
+
def _deserialize(type, value)
|
|
196
|
+
case type.to_sym
|
|
197
|
+
when :DateTime
|
|
198
|
+
DateTime.parse(parse_date(value))
|
|
199
|
+
when :Date
|
|
200
|
+
Date.parse(parse_date(value))
|
|
201
|
+
when :String
|
|
202
|
+
value.to_s
|
|
203
|
+
when :Integer
|
|
204
|
+
value.to_i
|
|
205
|
+
when :Float
|
|
206
|
+
value.to_f
|
|
207
|
+
when :BigDecimal
|
|
208
|
+
BigDecimal(value.to_s)
|
|
209
|
+
when :Boolean
|
|
210
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
211
|
+
true
|
|
212
|
+
else
|
|
213
|
+
false
|
|
214
|
+
end
|
|
215
|
+
when :Object
|
|
216
|
+
# generic object (usually a Hash), return directly
|
|
217
|
+
value
|
|
218
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
219
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
220
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
221
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
222
|
+
k_type = Regexp.last_match[:k_type]
|
|
223
|
+
v_type = Regexp.last_match[:v_type]
|
|
224
|
+
{}.tap do |hash|
|
|
225
|
+
value.each do |k, v|
|
|
226
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
else # model
|
|
230
|
+
XeroRuby::PayrollUk.const_get(type).build_from_hash(value)
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Returns the string representation of the object
|
|
235
|
+
# @return [String] String presentation of the object
|
|
236
|
+
def to_s
|
|
237
|
+
to_hash.to_s
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
|
242
|
+
def to_body
|
|
243
|
+
to_hash
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Returns the object in the form of hash
|
|
247
|
+
# @return [Hash] Returns the object in the form of hash
|
|
248
|
+
def to_hash(downcase: false)
|
|
249
|
+
hash = {}
|
|
250
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
251
|
+
value = self.send(attr)
|
|
252
|
+
next if value.nil?
|
|
253
|
+
key = downcase ? attr : param
|
|
254
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
255
|
+
end
|
|
256
|
+
hash
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Returns the object in the form of hash with snake_case
|
|
260
|
+
def to_attributes
|
|
261
|
+
to_hash(downcase: true)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Outputs non-array value in the form of hash
|
|
265
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
266
|
+
# @param [Object] value Any valid value
|
|
267
|
+
# @return [Hash] Returns the value in the form of hash
|
|
268
|
+
def _to_hash(value, downcase: false)
|
|
269
|
+
if value.is_a?(Array)
|
|
270
|
+
value.map do |v|
|
|
271
|
+
v.to_hash(downcase: downcase)
|
|
272
|
+
end
|
|
273
|
+
elsif value.is_a?(Hash)
|
|
274
|
+
{}.tap do |hash|
|
|
275
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
276
|
+
end
|
|
277
|
+
elsif value.respond_to? :to_hash
|
|
278
|
+
value.to_hash(downcase: downcase)
|
|
279
|
+
else
|
|
280
|
+
value
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def parse_date(datestring)
|
|
285
|
+
if datestring.include?('Date')
|
|
286
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
287
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
288
|
+
date = (date.to_i / 1000)
|
|
289
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
290
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
291
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
292
|
+
else # handle date 'types' for small subset of payroll API's
|
|
293
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
end
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll UK
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API for orgs in the UK 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::PayrollUk
|
|
16
|
+
require 'bigdecimal'
|
|
17
|
+
|
|
18
|
+
class DevelopmentalRoleDetails
|
|
19
|
+
# The start date of the developmental role
|
|
20
|
+
attr_accessor :start_date
|
|
21
|
+
|
|
22
|
+
# The end date of the developmental role
|
|
23
|
+
attr_accessor :end_date
|
|
24
|
+
|
|
25
|
+
# The developmental role type - \"Apprentice\" is the only supported role currently
|
|
26
|
+
attr_accessor :developmental_role
|
|
27
|
+
|
|
28
|
+
# The public key of the developmental role. Public key is required if the intention is to edit an existing developmental role. If no key is supplied a new developmental role will be created
|
|
29
|
+
attr_accessor :public_key
|
|
30
|
+
|
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
|
+
def self.attribute_map
|
|
33
|
+
{
|
|
34
|
+
:'start_date' => :'startDate',
|
|
35
|
+
:'end_date' => :'endDate',
|
|
36
|
+
:'developmental_role' => :'developmentalRole',
|
|
37
|
+
:'public_key' => :'publicKey'
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute type mapping.
|
|
42
|
+
def self.openapi_types
|
|
43
|
+
{
|
|
44
|
+
:'start_date' => :'Date',
|
|
45
|
+
:'end_date' => :'Date',
|
|
46
|
+
:'developmental_role' => :'String',
|
|
47
|
+
:'public_key' => :'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::PayrollUk::DevelopmentalRoleDetails` 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::PayrollUk::DevelopmentalRoleDetails`. 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?(:'start_date')
|
|
67
|
+
self.start_date = attributes[:'start_date']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'end_date')
|
|
71
|
+
self.end_date = attributes[:'end_date']
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'developmental_role')
|
|
75
|
+
self.developmental_role = attributes[:'developmental_role']
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'public_key')
|
|
79
|
+
self.public_key = attributes[:'public_key']
|
|
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 @start_date.nil?
|
|
88
|
+
invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if @end_date.nil?
|
|
92
|
+
invalid_properties.push('invalid value for "end_date", end_date cannot be nil.')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if @developmental_role.nil?
|
|
96
|
+
invalid_properties.push('invalid value for "developmental_role", developmental_role cannot be nil.')
|
|
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 @start_date.nil?
|
|
106
|
+
return false if @end_date.nil?
|
|
107
|
+
return false if @developmental_role.nil?
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Checks equality by comparing each attribute.
|
|
112
|
+
# @param [Object] Object to be compared
|
|
113
|
+
def ==(o)
|
|
114
|
+
return true if self.equal?(o)
|
|
115
|
+
self.class == o.class &&
|
|
116
|
+
start_date == o.start_date &&
|
|
117
|
+
end_date == o.end_date &&
|
|
118
|
+
developmental_role == o.developmental_role &&
|
|
119
|
+
public_key == o.public_key
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# @see the `==` method
|
|
123
|
+
# @param [Object] Object to be compared
|
|
124
|
+
def eql?(o)
|
|
125
|
+
self == o
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Calculates hash code according to all attributes.
|
|
129
|
+
# @return [Integer] Hash code
|
|
130
|
+
def hash
|
|
131
|
+
[start_date, end_date, developmental_role, public_key].hash
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Builds the object from hash
|
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
136
|
+
# @return [Object] Returns the model itself
|
|
137
|
+
def self.build_from_hash(attributes)
|
|
138
|
+
new.build_from_hash(attributes)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Builds the object from hash
|
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
143
|
+
# @return [Object] Returns the model itself
|
|
144
|
+
def build_from_hash(attributes)
|
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
|
146
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
147
|
+
if type =~ /\AArray<(.*)>/i
|
|
148
|
+
# check to ensure the input is an array given that the attribute
|
|
149
|
+
# is documented as an array but the input is not
|
|
150
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
151
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
152
|
+
end
|
|
153
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
154
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
155
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
self
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Deserializes the data based on type
|
|
162
|
+
# @param string type Data type
|
|
163
|
+
# @param string value Value to be deserialized
|
|
164
|
+
# @return [Object] Deserialized data
|
|
165
|
+
def _deserialize(type, value)
|
|
166
|
+
case type.to_sym
|
|
167
|
+
when :DateTime
|
|
168
|
+
DateTime.parse(parse_date(value))
|
|
169
|
+
when :Date
|
|
170
|
+
Date.parse(parse_date(value))
|
|
171
|
+
when :String
|
|
172
|
+
value.to_s
|
|
173
|
+
when :Integer
|
|
174
|
+
value.to_i
|
|
175
|
+
when :Float
|
|
176
|
+
value.to_f
|
|
177
|
+
when :BigDecimal
|
|
178
|
+
BigDecimal(value.to_s)
|
|
179
|
+
when :Boolean
|
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
181
|
+
true
|
|
182
|
+
else
|
|
183
|
+
false
|
|
184
|
+
end
|
|
185
|
+
when :Object
|
|
186
|
+
# generic object (usually a Hash), return directly
|
|
187
|
+
value
|
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
|
194
|
+
{}.tap do |hash|
|
|
195
|
+
value.each do |k, v|
|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
else # model
|
|
200
|
+
XeroRuby::PayrollUk.const_get(type).build_from_hash(value)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Returns the string representation of the object
|
|
205
|
+
# @return [String] String presentation of the object
|
|
206
|
+
def to_s
|
|
207
|
+
to_hash.to_s
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
|
212
|
+
def to_body
|
|
213
|
+
to_hash
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Returns the object in the form of hash
|
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
|
218
|
+
def to_hash(downcase: false)
|
|
219
|
+
hash = {}
|
|
220
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
221
|
+
value = self.send(attr)
|
|
222
|
+
next if value.nil?
|
|
223
|
+
key = downcase ? attr : param
|
|
224
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
225
|
+
end
|
|
226
|
+
hash
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Returns the object in the form of hash with snake_case
|
|
230
|
+
def to_attributes
|
|
231
|
+
to_hash(downcase: true)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Outputs non-array value in the form of hash
|
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
236
|
+
# @param [Object] value Any valid value
|
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
|
238
|
+
def _to_hash(value, downcase: false)
|
|
239
|
+
if value.is_a?(Array)
|
|
240
|
+
value.map do |v|
|
|
241
|
+
v.to_hash(downcase: downcase)
|
|
242
|
+
end
|
|
243
|
+
elsif value.is_a?(Hash)
|
|
244
|
+
{}.tap do |hash|
|
|
245
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
246
|
+
end
|
|
247
|
+
elsif value.respond_to? :to_hash
|
|
248
|
+
value.to_hash(downcase: downcase)
|
|
249
|
+
else
|
|
250
|
+
value
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def parse_date(datestring)
|
|
255
|
+
if datestring.include?('Date')
|
|
256
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
257
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
258
|
+
date = (date.to_i / 1000)
|
|
259
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
260
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
261
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
262
|
+
else # handle date 'types' for small subset of payroll API's
|
|
263
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
end
|
|
@@ -72,6 +72,9 @@ module XeroRuby::PayrollUk
|
|
|
72
72
|
# Whether the employee is an off payroll worker
|
|
73
73
|
attr_accessor :is_off_payroll_worker
|
|
74
74
|
|
|
75
|
+
# The employee's contracts
|
|
76
|
+
attr_accessor :contracts
|
|
77
|
+
|
|
75
78
|
class EnumAttributeValidator
|
|
76
79
|
attr_reader :datatype
|
|
77
80
|
attr_reader :allowable_values
|
|
@@ -114,7 +117,8 @@ module XeroRuby::PayrollUk
|
|
|
114
117
|
:'ni_category' => :'niCategory',
|
|
115
118
|
:'ni_categories' => :'niCategories',
|
|
116
119
|
:'national_insurance_number' => :'nationalInsuranceNumber',
|
|
117
|
-
:'is_off_payroll_worker' => :'isOffPayrollWorker'
|
|
120
|
+
:'is_off_payroll_worker' => :'isOffPayrollWorker',
|
|
121
|
+
:'contracts' => :'contracts'
|
|
118
122
|
}
|
|
119
123
|
end
|
|
120
124
|
|
|
@@ -138,7 +142,8 @@ module XeroRuby::PayrollUk
|
|
|
138
142
|
:'ni_category' => :'NICategoryLetter',
|
|
139
143
|
:'ni_categories' => :'Array<NICategory>',
|
|
140
144
|
:'national_insurance_number' => :'String',
|
|
141
|
-
:'is_off_payroll_worker' => :'Boolean'
|
|
145
|
+
:'is_off_payroll_worker' => :'Boolean',
|
|
146
|
+
:'contracts' => :'Array<Contracts>'
|
|
142
147
|
}
|
|
143
148
|
end
|
|
144
149
|
|
|
@@ -230,6 +235,12 @@ module XeroRuby::PayrollUk
|
|
|
230
235
|
if attributes.key?(:'is_off_payroll_worker')
|
|
231
236
|
self.is_off_payroll_worker = attributes[:'is_off_payroll_worker']
|
|
232
237
|
end
|
|
238
|
+
|
|
239
|
+
if attributes.key?(:'contracts')
|
|
240
|
+
if (value = attributes[:'contracts']).is_a?(Array)
|
|
241
|
+
self.contracts = value
|
|
242
|
+
end
|
|
243
|
+
end
|
|
233
244
|
end
|
|
234
245
|
|
|
235
246
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -309,7 +320,8 @@ module XeroRuby::PayrollUk
|
|
|
309
320
|
ni_category == o.ni_category &&
|
|
310
321
|
ni_categories == o.ni_categories &&
|
|
311
322
|
national_insurance_number == o.national_insurance_number &&
|
|
312
|
-
is_off_payroll_worker == o.is_off_payroll_worker
|
|
323
|
+
is_off_payroll_worker == o.is_off_payroll_worker &&
|
|
324
|
+
contracts == o.contracts
|
|
313
325
|
end
|
|
314
326
|
|
|
315
327
|
# @see the `==` method
|
|
@@ -321,7 +333,7 @@ module XeroRuby::PayrollUk
|
|
|
321
333
|
# Calculates hash code according to all attributes.
|
|
322
334
|
# @return [Integer] Hash code
|
|
323
335
|
def hash
|
|
324
|
-
[employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, ni_category, ni_categories, national_insurance_number, is_off_payroll_worker].hash
|
|
336
|
+
[employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, ni_category, ni_categories, national_insurance_number, is_off_payroll_worker, contracts].hash
|
|
325
337
|
end
|
|
326
338
|
|
|
327
339
|
# Builds the object from hash
|
|
@@ -31,6 +31,9 @@ module XeroRuby::PayrollUk
|
|
|
31
31
|
# The employee's NI categories
|
|
32
32
|
attr_accessor :ni_categories
|
|
33
33
|
|
|
34
|
+
# The employee's contracts
|
|
35
|
+
attr_accessor :contracts
|
|
36
|
+
|
|
34
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
38
|
def self.attribute_map
|
|
36
39
|
{
|
|
@@ -38,7 +41,8 @@ module XeroRuby::PayrollUk
|
|
|
38
41
|
:'start_date' => :'startDate',
|
|
39
42
|
:'employee_number' => :'employeeNumber',
|
|
40
43
|
:'ni_category' => :'niCategory',
|
|
41
|
-
:'ni_categories' => :'niCategories'
|
|
44
|
+
:'ni_categories' => :'niCategories',
|
|
45
|
+
:'contracts' => :'contracts'
|
|
42
46
|
}
|
|
43
47
|
end
|
|
44
48
|
|
|
@@ -49,7 +53,8 @@ module XeroRuby::PayrollUk
|
|
|
49
53
|
:'start_date' => :'Date',
|
|
50
54
|
:'employee_number' => :'String',
|
|
51
55
|
:'ni_category' => :'NICategoryLetter',
|
|
52
|
-
:'ni_categories' => :'Array<NICategory>'
|
|
56
|
+
:'ni_categories' => :'Array<NICategory>',
|
|
57
|
+
:'contracts' => :'Array<Contracts>'
|
|
53
58
|
}
|
|
54
59
|
end
|
|
55
60
|
|
|
@@ -89,6 +94,12 @@ module XeroRuby::PayrollUk
|
|
|
89
94
|
self.ni_categories = value
|
|
90
95
|
end
|
|
91
96
|
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'contracts')
|
|
99
|
+
if (value = attributes[:'contracts']).is_a?(Array)
|
|
100
|
+
self.contracts = value
|
|
101
|
+
end
|
|
102
|
+
end
|
|
92
103
|
end
|
|
93
104
|
|
|
94
105
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -133,7 +144,8 @@ module XeroRuby::PayrollUk
|
|
|
133
144
|
start_date == o.start_date &&
|
|
134
145
|
employee_number == o.employee_number &&
|
|
135
146
|
ni_category == o.ni_category &&
|
|
136
|
-
ni_categories == o.ni_categories
|
|
147
|
+
ni_categories == o.ni_categories &&
|
|
148
|
+
contracts == o.contracts
|
|
137
149
|
end
|
|
138
150
|
|
|
139
151
|
# @see the `==` method
|
|
@@ -145,7 +157,7 @@ module XeroRuby::PayrollUk
|
|
|
145
157
|
# Calculates hash code according to all attributes.
|
|
146
158
|
# @return [Integer] Hash code
|
|
147
159
|
def hash
|
|
148
|
-
[payroll_calendar_id, start_date, employee_number, ni_category, ni_categories].hash
|
|
160
|
+
[payroll_calendar_id, start_date, employee_number, ni_category, ni_categories, contracts].hash
|
|
149
161
|
end
|
|
150
162
|
|
|
151
163
|
# Builds the object from hash
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll UK
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API for orgs in the UK 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::PayrollUk
|
|
16
|
+
class EmploymentStatus
|
|
17
|
+
EMPLOYEE ||= "Employee".freeze
|
|
18
|
+
WORKER ||= "Worker".freeze
|
|
19
|
+
UNSPECIFIED ||= "Unspecified".freeze
|
|
20
|
+
|
|
21
|
+
# Builds the enum from string
|
|
22
|
+
# @param [String] The enum value in the form of the string
|
|
23
|
+
# @return [String] The enum value
|
|
24
|
+
def self.build_from_hash(value)
|
|
25
|
+
new.build_from_hash(value)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the enum from string
|
|
29
|
+
# @param [String] The enum value in the form of the string
|
|
30
|
+
# @return [String] The enum value
|
|
31
|
+
def build_from_hash(value)
|
|
32
|
+
constantValues = EmploymentStatus.constants.select { |c| EmploymentStatus::const_get(c) == value }
|
|
33
|
+
raise "Invalid ENUM value #{value} for class #EmploymentStatus" if constantValues.empty?
|
|
34
|
+
value
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
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: 9.
|
|
10
|
+
The version of the XeroOpenAPI document: 9.3.0
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module XeroRuby
|
|
14
|
-
VERSION = '12.
|
|
14
|
+
VERSION = '12.3.0'
|
|
15
15
|
end
|
data/lib/xero-ruby.rb
CHANGED
|
@@ -90,11 +90,14 @@ require 'xero-ruby/models/payroll_uk/benefit'
|
|
|
90
90
|
require 'xero-ruby/models/payroll_uk/benefit_line'
|
|
91
91
|
require 'xero-ruby/models/payroll_uk/benefit_object'
|
|
92
92
|
require 'xero-ruby/models/payroll_uk/benefits'
|
|
93
|
+
require 'xero-ruby/models/payroll_uk/contract_type'
|
|
94
|
+
require 'xero-ruby/models/payroll_uk/contracts'
|
|
93
95
|
require 'xero-ruby/models/payroll_uk/court_order_line'
|
|
94
96
|
require 'xero-ruby/models/payroll_uk/deduction'
|
|
95
97
|
require 'xero-ruby/models/payroll_uk/deduction_line'
|
|
96
98
|
require 'xero-ruby/models/payroll_uk/deduction_object'
|
|
97
99
|
require 'xero-ruby/models/payroll_uk/deductions'
|
|
100
|
+
require 'xero-ruby/models/payroll_uk/developmental_role_details'
|
|
98
101
|
require 'xero-ruby/models/payroll_uk/earnings_line'
|
|
99
102
|
require 'xero-ruby/models/payroll_uk/earnings_order'
|
|
100
103
|
require 'xero-ruby/models/payroll_uk/earnings_order_object'
|
|
@@ -131,6 +134,7 @@ require 'xero-ruby/models/payroll_uk/employee_tax_object'
|
|
|
131
134
|
require 'xero-ruby/models/payroll_uk/employees'
|
|
132
135
|
require 'xero-ruby/models/payroll_uk/employment'
|
|
133
136
|
require 'xero-ruby/models/payroll_uk/employment_object'
|
|
137
|
+
require 'xero-ruby/models/payroll_uk/employment_status'
|
|
134
138
|
require 'xero-ruby/models/payroll_uk/invalid_field'
|
|
135
139
|
require 'xero-ruby/models/payroll_uk/leave_accrual_line'
|
|
136
140
|
require 'xero-ruby/models/payroll_uk/leave_earnings_line'
|
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: 12.
|
|
4
|
+
version: 12.3.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: 2025-11-
|
|
11
|
+
date: 2025-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -533,11 +533,14 @@ files:
|
|
|
533
533
|
- lib/xero-ruby/models/payroll_uk/benefit_line.rb
|
|
534
534
|
- lib/xero-ruby/models/payroll_uk/benefit_object.rb
|
|
535
535
|
- lib/xero-ruby/models/payroll_uk/benefits.rb
|
|
536
|
+
- lib/xero-ruby/models/payroll_uk/contract_type.rb
|
|
537
|
+
- lib/xero-ruby/models/payroll_uk/contracts.rb
|
|
536
538
|
- lib/xero-ruby/models/payroll_uk/court_order_line.rb
|
|
537
539
|
- lib/xero-ruby/models/payroll_uk/deduction.rb
|
|
538
540
|
- lib/xero-ruby/models/payroll_uk/deduction_line.rb
|
|
539
541
|
- lib/xero-ruby/models/payroll_uk/deduction_object.rb
|
|
540
542
|
- lib/xero-ruby/models/payroll_uk/deductions.rb
|
|
543
|
+
- lib/xero-ruby/models/payroll_uk/developmental_role_details.rb
|
|
541
544
|
- lib/xero-ruby/models/payroll_uk/earnings_line.rb
|
|
542
545
|
- lib/xero-ruby/models/payroll_uk/earnings_order.rb
|
|
543
546
|
- lib/xero-ruby/models/payroll_uk/earnings_order_object.rb
|
|
@@ -574,6 +577,7 @@ files:
|
|
|
574
577
|
- lib/xero-ruby/models/payroll_uk/employees.rb
|
|
575
578
|
- lib/xero-ruby/models/payroll_uk/employment.rb
|
|
576
579
|
- lib/xero-ruby/models/payroll_uk/employment_object.rb
|
|
580
|
+
- lib/xero-ruby/models/payroll_uk/employment_status.rb
|
|
577
581
|
- lib/xero-ruby/models/payroll_uk/invalid_field.rb
|
|
578
582
|
- lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb
|
|
579
583
|
- lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb
|