xero-ruby 4.0.0 → 4.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/files_api.rb +80 -2
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +14 -4
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +16 -4
- data/lib/xero-ruby/models/payroll_au/paid_leave_earnings_line.rb +272 -0
- data/lib/xero-ruby/models/payroll_au/pay_out_type.rb +36 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed0a9e18f21afd2a6efcb613ed308ac42c45894cd63589e250292975f967c648
|
4
|
+
data.tar.gz: 5e1b5fe861cd84754016b968b37164e437dd3e182ac95d8aec096629023ab81c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9210328dbff87fd961f36d96ceb39bbfd6fca07545d49d8e0bb1a54b92cde075cd602d8a5fc64dba0f6fa369278a6dff76e9e65feabc7119cf183f063129bf35
|
7
|
+
data.tar.gz: 8e81d3694e0608819c54a31129bcf786b611e04171f1908172e3053572e16857b9c06c2f759a4e085adf049183d6b70d611e4c5a673c8a8c3973c649976a040e
|
@@ -404,7 +404,7 @@ module XeroRuby
|
|
404
404
|
end
|
405
405
|
|
406
406
|
# Retrieves an association object using a unique object ID
|
407
|
-
# By passing in the appropriate options,
|
407
|
+
# By passing in the appropriate options, you can retrieve an association
|
408
408
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
409
409
|
# @param object_id [String] Object id for single object
|
410
410
|
# @param [Hash] opts the optional parameters
|
@@ -415,7 +415,7 @@ module XeroRuby
|
|
415
415
|
end
|
416
416
|
|
417
417
|
# Retrieves an association object using a unique object ID
|
418
|
-
# By passing in the appropriate options,
|
418
|
+
# By passing in the appropriate options, you can retrieve an association
|
419
419
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
420
420
|
# @param object_id [String] Object id for single object
|
421
421
|
# @param [Hash] opts the optional parameters
|
@@ -480,6 +480,84 @@ module XeroRuby
|
|
480
480
|
return data, status_code, headers
|
481
481
|
end
|
482
482
|
|
483
|
+
# Retrieves a count of associations for a list of objects.
|
484
|
+
# By passing in the appropriate options, you can retrieve the association count for objects
|
485
|
+
# @param xero_tenant_id [String] Xero identifier for Tenant
|
486
|
+
# @param object_ids [Array<String>] A comma-separated list of object ids
|
487
|
+
# @param [Hash] opts the optional parameters
|
488
|
+
# @return [Object]
|
489
|
+
def get_associations_count(xero_tenant_id, object_ids, opts = {})
|
490
|
+
data, _status_code, _headers = get_associations_count_with_http_info(xero_tenant_id, object_ids, opts)
|
491
|
+
data
|
492
|
+
end
|
493
|
+
|
494
|
+
# Retrieves a count of associations for a list of objects.
|
495
|
+
# By passing in the appropriate options, you can retrieve the association count for objects
|
496
|
+
# @param xero_tenant_id [String] Xero identifier for Tenant
|
497
|
+
# @param object_ids [Array<String>] A comma-separated list of object ids
|
498
|
+
# @param [Hash] opts the optional parameters
|
499
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
500
|
+
def get_associations_count_with_http_info(xero_tenant_id, object_ids, options = {})
|
501
|
+
opts = options.dup
|
502
|
+
if @api_client.config.debugging
|
503
|
+
@api_client.config.logger.debug 'Calling API: FilesApi.get_associations_count ...'
|
504
|
+
end
|
505
|
+
# verify the required parameter 'xero_tenant_id' is set
|
506
|
+
if @api_client.config.client_side_validation && xero_tenant_id.nil?
|
507
|
+
fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FilesApi.get_associations_count"
|
508
|
+
end
|
509
|
+
# verify the required parameter 'object_ids' is set
|
510
|
+
if @api_client.config.client_side_validation && object_ids.nil?
|
511
|
+
fail ArgumentError, "Missing the required parameter 'object_ids' when calling FilesApi.get_associations_count"
|
512
|
+
end
|
513
|
+
# resource path
|
514
|
+
local_var_path = '/Associations/Count'
|
515
|
+
|
516
|
+
# camelize keys of incoming `where` opts
|
517
|
+
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
|
518
|
+
|
519
|
+
# query parameters
|
520
|
+
query_params = opts[:query_params] || {}
|
521
|
+
query_params[:'ObjectIds'] = @api_client.build_collection_param(object_ids, :multi)
|
522
|
+
|
523
|
+
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
524
|
+
query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
|
525
|
+
query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
|
526
|
+
|
527
|
+
# header parameters
|
528
|
+
header_params = opts[:header_params] || {}
|
529
|
+
# HTTP header 'Accept' (if needed)
|
530
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
531
|
+
header_params[:'xero-tenant-id'] = xero_tenant_id
|
532
|
+
|
533
|
+
# form parameters
|
534
|
+
form_params = opts[:form_params] || {}
|
535
|
+
|
536
|
+
# http body (model)
|
537
|
+
post_body = opts[:body]
|
538
|
+
|
539
|
+
# return_type
|
540
|
+
return_type = opts[:return_type] || 'Object'
|
541
|
+
|
542
|
+
# auth_names
|
543
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
544
|
+
|
545
|
+
new_options = opts.merge(
|
546
|
+
:header_params => header_params,
|
547
|
+
:query_params => query_params,
|
548
|
+
:form_params => form_params,
|
549
|
+
:body => post_body,
|
550
|
+
:auth_names => auth_names,
|
551
|
+
:return_type => return_type
|
552
|
+
)
|
553
|
+
|
554
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FilesApi", new_options)
|
555
|
+
if @api_client.config.debugging
|
556
|
+
@api_client.config.logger.debug "API called: FilesApi#get_associations_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
557
|
+
end
|
558
|
+
return data, status_code, headers
|
559
|
+
end
|
560
|
+
|
483
561
|
# Retrieves a file by a unique file ID
|
484
562
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
485
563
|
# @param file_id [String] File id for single object
|
@@ -38,6 +38,9 @@ module XeroRuby::PayrollAu
|
|
38
38
|
attr_accessor :description
|
39
39
|
|
40
40
|
|
41
|
+
attr_accessor :pay_out_type
|
42
|
+
|
43
|
+
|
41
44
|
attr_accessor :leave_periods
|
42
45
|
|
43
46
|
# Last modified timestamp
|
@@ -56,6 +59,7 @@ module XeroRuby::PayrollAu
|
|
56
59
|
:'start_date' => :'StartDate',
|
57
60
|
:'end_date' => :'EndDate',
|
58
61
|
:'description' => :'Description',
|
62
|
+
:'pay_out_type' => :'PayOutType',
|
59
63
|
:'leave_periods' => :'LeavePeriods',
|
60
64
|
:'updated_date_utc' => :'UpdatedDateUTC',
|
61
65
|
:'validation_errors' => :'ValidationErrors'
|
@@ -72,6 +76,7 @@ module XeroRuby::PayrollAu
|
|
72
76
|
:'start_date' => :'Date',
|
73
77
|
:'end_date' => :'Date',
|
74
78
|
:'description' => :'String',
|
79
|
+
:'pay_out_type' => :'PayOutType',
|
75
80
|
:'leave_periods' => :'Array<LeavePeriod>',
|
76
81
|
:'updated_date_utc' => :'DateTime',
|
77
82
|
:'validation_errors' => :'Array<ValidationError>'
|
@@ -121,6 +126,10 @@ module XeroRuby::PayrollAu
|
|
121
126
|
self.description = attributes[:'description']
|
122
127
|
end
|
123
128
|
|
129
|
+
if attributes.key?(:'pay_out_type')
|
130
|
+
self.pay_out_type = attributes[:'pay_out_type']
|
131
|
+
end
|
132
|
+
|
124
133
|
if attributes.key?(:'leave_periods')
|
125
134
|
if (value = attributes[:'leave_periods']).is_a?(Array)
|
126
135
|
self.leave_periods = value
|
@@ -163,6 +172,7 @@ module XeroRuby::PayrollAu
|
|
163
172
|
start_date == o.start_date &&
|
164
173
|
end_date == o.end_date &&
|
165
174
|
description == o.description &&
|
175
|
+
pay_out_type == o.pay_out_type &&
|
166
176
|
leave_periods == o.leave_periods &&
|
167
177
|
updated_date_utc == o.updated_date_utc &&
|
168
178
|
validation_errors == o.validation_errors
|
@@ -177,7 +187,7 @@ module XeroRuby::PayrollAu
|
|
177
187
|
# Calculates hash code according to all attributes.
|
178
188
|
# @return [Integer] Hash code
|
179
189
|
def hash
|
180
|
-
[leave_application_id, employee_id, leave_type_id, title, start_date, end_date, description, leave_periods, updated_date_utc, validation_errors].hash
|
190
|
+
[leave_application_id, employee_id, leave_type_id, title, start_date, end_date, description, pay_out_type, leave_periods, updated_date_utc, validation_errors].hash
|
181
191
|
end
|
182
192
|
|
183
193
|
# Builds the object from hash
|
@@ -25,12 +25,16 @@ module XeroRuby::PayrollAu
|
|
25
25
|
# Earnings rate number of units.
|
26
26
|
attr_accessor :number_of_units
|
27
27
|
|
28
|
+
|
29
|
+
attr_accessor :pay_out_type
|
30
|
+
|
28
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
29
32
|
def self.attribute_map
|
30
33
|
{
|
31
34
|
:'earnings_rate_id' => :'EarningsRateID',
|
32
35
|
:'rate_per_unit' => :'RatePerUnit',
|
33
|
-
:'number_of_units' => :'NumberOfUnits'
|
36
|
+
:'number_of_units' => :'NumberOfUnits',
|
37
|
+
:'pay_out_type' => :'PayOutType'
|
34
38
|
}
|
35
39
|
end
|
36
40
|
|
@@ -39,7 +43,8 @@ module XeroRuby::PayrollAu
|
|
39
43
|
{
|
40
44
|
:'earnings_rate_id' => :'String',
|
41
45
|
:'rate_per_unit' => :'BigDecimal',
|
42
|
-
:'number_of_units' => :'BigDecimal'
|
46
|
+
:'number_of_units' => :'BigDecimal',
|
47
|
+
:'pay_out_type' => :'PayOutType'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -69,6 +74,10 @@ module XeroRuby::PayrollAu
|
|
69
74
|
if attributes.key?(:'number_of_units')
|
70
75
|
self.number_of_units = attributes[:'number_of_units']
|
71
76
|
end
|
77
|
+
|
78
|
+
if attributes.key?(:'pay_out_type')
|
79
|
+
self.pay_out_type = attributes[:'pay_out_type']
|
80
|
+
end
|
72
81
|
end
|
73
82
|
|
74
83
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -91,7 +100,8 @@ module XeroRuby::PayrollAu
|
|
91
100
|
self.class == o.class &&
|
92
101
|
earnings_rate_id == o.earnings_rate_id &&
|
93
102
|
rate_per_unit == o.rate_per_unit &&
|
94
|
-
number_of_units == o.number_of_units
|
103
|
+
number_of_units == o.number_of_units &&
|
104
|
+
pay_out_type == o.pay_out_type
|
95
105
|
end
|
96
106
|
|
97
107
|
# @see the `==` method
|
@@ -103,7 +113,7 @@ module XeroRuby::PayrollAu
|
|
103
113
|
# Calculates hash code according to all attributes.
|
104
114
|
# @return [Integer] Hash code
|
105
115
|
def hash
|
106
|
-
[earnings_rate_id, rate_per_unit, number_of_units].hash
|
116
|
+
[earnings_rate_id, rate_per_unit, number_of_units, pay_out_type].hash
|
107
117
|
end
|
108
118
|
|
109
119
|
# Builds the object from hash
|
@@ -37,6 +37,9 @@ module XeroRuby::PayrollAu
|
|
37
37
|
|
38
38
|
attr_accessor :leave_lines
|
39
39
|
|
40
|
+
|
41
|
+
attr_accessor :paid_leave_earnings_lines
|
42
|
+
|
40
43
|
# Attribute mapping from ruby-style variable name to JSON key.
|
41
44
|
def self.attribute_map
|
42
45
|
{
|
@@ -46,7 +49,8 @@ module XeroRuby::PayrollAu
|
|
46
49
|
:'deduction_lines' => :'DeductionLines',
|
47
50
|
:'super_lines' => :'SuperLines',
|
48
51
|
:'reimbursement_lines' => :'ReimbursementLines',
|
49
|
-
:'leave_lines' => :'LeaveLines'
|
52
|
+
:'leave_lines' => :'LeaveLines',
|
53
|
+
:'paid_leave_earnings_lines' => :'PaidLeaveEarningsLines'
|
50
54
|
}
|
51
55
|
end
|
52
56
|
|
@@ -59,7 +63,8 @@ module XeroRuby::PayrollAu
|
|
59
63
|
:'deduction_lines' => :'Array<DeductionLine>',
|
60
64
|
:'super_lines' => :'Array<SuperLine>',
|
61
65
|
:'reimbursement_lines' => :'Array<ReimbursementLine>',
|
62
|
-
:'leave_lines' => :'Array<LeaveLine>'
|
66
|
+
:'leave_lines' => :'Array<LeaveLine>',
|
67
|
+
:'paid_leave_earnings_lines' => :'Array<PaidLeaveEarningsLine>'
|
63
68
|
}
|
64
69
|
end
|
65
70
|
|
@@ -115,6 +120,12 @@ module XeroRuby::PayrollAu
|
|
115
120
|
self.leave_lines = value
|
116
121
|
end
|
117
122
|
end
|
123
|
+
|
124
|
+
if attributes.key?(:'paid_leave_earnings_lines')
|
125
|
+
if (value = attributes[:'paid_leave_earnings_lines']).is_a?(Array)
|
126
|
+
self.paid_leave_earnings_lines = value
|
127
|
+
end
|
128
|
+
end
|
118
129
|
end
|
119
130
|
|
120
131
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -141,7 +152,8 @@ module XeroRuby::PayrollAu
|
|
141
152
|
deduction_lines == o.deduction_lines &&
|
142
153
|
super_lines == o.super_lines &&
|
143
154
|
reimbursement_lines == o.reimbursement_lines &&
|
144
|
-
leave_lines == o.leave_lines
|
155
|
+
leave_lines == o.leave_lines &&
|
156
|
+
paid_leave_earnings_lines == o.paid_leave_earnings_lines
|
145
157
|
end
|
146
158
|
|
147
159
|
# @see the `==` method
|
@@ -153,7 +165,7 @@ module XeroRuby::PayrollAu
|
|
153
165
|
# Calculates hash code according to all attributes.
|
154
166
|
# @return [Integer] Hash code
|
155
167
|
def hash
|
156
|
-
[opening_balance_date, tax, earnings_lines, deduction_lines, super_lines, reimbursement_lines, leave_lines].hash
|
168
|
+
[opening_balance_date, tax, earnings_lines, deduction_lines, super_lines, reimbursement_lines, leave_lines, paid_leave_earnings_lines].hash
|
157
169
|
end
|
158
170
|
|
159
171
|
# Builds the object from hash
|
@@ -0,0 +1,272 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Payroll AU API
|
3
|
+
|
4
|
+
#This is the Xero Payroll API for orgs in Australia 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::PayrollAu
|
16
|
+
require 'bigdecimal'
|
17
|
+
|
18
|
+
class PaidLeaveEarningsLine
|
19
|
+
# Xero leave type identifier
|
20
|
+
attr_accessor :leave_type_id
|
21
|
+
|
22
|
+
# Paid leave amount
|
23
|
+
attr_accessor :amount
|
24
|
+
|
25
|
+
# The amount of leave loading applied for the leave type that is subject to Superannuation Guarantee Contributions. *Only applicable for Leave Types with Annual Leave Categories
|
26
|
+
attr_accessor :sgc_applied_leave_loading_amount
|
27
|
+
|
28
|
+
# The amount of leave loading applied for the leave type that is exempt from Superannuation Guarantee Contributions. *Only applicable for Leave Types with Annual Leave Categories
|
29
|
+
attr_accessor :sgc_exempted_leave_loading_amount
|
30
|
+
|
31
|
+
# Reset the STP categorisations for the leave type. *Only applicable for Leave Types with Annual Leave Categories
|
32
|
+
attr_accessor :reset_stp_categorisation
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'leave_type_id' => :'LeaveTypeID',
|
38
|
+
:'amount' => :'Amount',
|
39
|
+
:'sgc_applied_leave_loading_amount' => :'SGCAppliedLeaveLoadingAmount',
|
40
|
+
:'sgc_exempted_leave_loading_amount' => :'SGCExemptedLeaveLoadingAmount',
|
41
|
+
:'reset_stp_categorisation' => :'ResetSTPCategorisation'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Attribute type mapping.
|
46
|
+
def self.openapi_types
|
47
|
+
{
|
48
|
+
:'leave_type_id' => :'String',
|
49
|
+
:'amount' => :'BigDecimal',
|
50
|
+
:'sgc_applied_leave_loading_amount' => :'BigDecimal',
|
51
|
+
:'sgc_exempted_leave_loading_amount' => :'BigDecimal',
|
52
|
+
:'reset_stp_categorisation' => :'Boolean'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
if (!attributes.is_a?(Hash))
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollAu::PaidLeaveEarningsLine` initialize method"
|
61
|
+
end
|
62
|
+
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollAu::PaidLeaveEarningsLine`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
67
|
+
end
|
68
|
+
h[k.to_sym] = v
|
69
|
+
}
|
70
|
+
|
71
|
+
if attributes.key?(:'leave_type_id')
|
72
|
+
self.leave_type_id = attributes[:'leave_type_id']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'amount')
|
76
|
+
self.amount = attributes[:'amount']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'sgc_applied_leave_loading_amount')
|
80
|
+
self.sgc_applied_leave_loading_amount = attributes[:'sgc_applied_leave_loading_amount']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'sgc_exempted_leave_loading_amount')
|
84
|
+
self.sgc_exempted_leave_loading_amount = attributes[:'sgc_exempted_leave_loading_amount']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'reset_stp_categorisation')
|
88
|
+
self.reset_stp_categorisation = attributes[:'reset_stp_categorisation']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properties with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = Array.new
|
96
|
+
if @leave_type_id.nil?
|
97
|
+
invalid_properties.push('invalid value for "leave_type_id", leave_type_id cannot be nil.')
|
98
|
+
end
|
99
|
+
|
100
|
+
if @amount.nil?
|
101
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
return false if @leave_type_id.nil?
|
111
|
+
return false if @amount.nil?
|
112
|
+
true
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks equality by comparing each attribute.
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def ==(o)
|
118
|
+
return true if self.equal?(o)
|
119
|
+
self.class == o.class &&
|
120
|
+
leave_type_id == o.leave_type_id &&
|
121
|
+
amount == o.amount &&
|
122
|
+
sgc_applied_leave_loading_amount == o.sgc_applied_leave_loading_amount &&
|
123
|
+
sgc_exempted_leave_loading_amount == o.sgc_exempted_leave_loading_amount &&
|
124
|
+
reset_stp_categorisation == o.reset_stp_categorisation
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[leave_type_id, amount, sgc_applied_leave_loading_amount, sgc_exempted_leave_loading_amount, reset_stp_categorisation].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def self.build_from_hash(attributes)
|
143
|
+
new.build_from_hash(attributes)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.openapi_types.each_pair do |key, type|
|
152
|
+
if type =~ /\AArray<(.*)>/i
|
153
|
+
# check to ensure the input is an array given that the attribute
|
154
|
+
# is documented as an array but the input is not
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
157
|
+
end
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
|
163
|
+
self
|
164
|
+
end
|
165
|
+
|
166
|
+
# Deserializes the data based on type
|
167
|
+
# @param string type Data type
|
168
|
+
# @param string value Value to be deserialized
|
169
|
+
# @return [Object] Deserialized data
|
170
|
+
def _deserialize(type, value)
|
171
|
+
case type.to_sym
|
172
|
+
when :DateTime
|
173
|
+
DateTime.parse(parse_date(value))
|
174
|
+
when :Date
|
175
|
+
Date.parse(parse_date(value))
|
176
|
+
when :String
|
177
|
+
value.to_s
|
178
|
+
when :Integer
|
179
|
+
value.to_i
|
180
|
+
when :Float
|
181
|
+
value.to_f
|
182
|
+
when :BigDecimal
|
183
|
+
BigDecimal(value.to_s)
|
184
|
+
when :Boolean
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
when :Object
|
191
|
+
# generic object (usually a Hash), return directly
|
192
|
+
value
|
193
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
194
|
+
inner_type = Regexp.last_match[:inner_type]
|
195
|
+
value.map { |v| _deserialize(inner_type, v) }
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
|
+
k_type = Regexp.last_match[:k_type]
|
198
|
+
v_type = Regexp.last_match[:v_type]
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each do |k, v|
|
201
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else # model
|
205
|
+
XeroRuby::PayrollAu.const_get(type).build_from_hash(value)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the string representation of the object
|
210
|
+
# @return [String] String presentation of the object
|
211
|
+
def to_s
|
212
|
+
to_hash.to_s
|
213
|
+
end
|
214
|
+
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_body
|
218
|
+
to_hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the object in the form of hash
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_hash(downcase: false)
|
224
|
+
hash = {}
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
226
|
+
value = self.send(attr)
|
227
|
+
next if value.nil?
|
228
|
+
key = downcase ? attr : param
|
229
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Returns the object in the form of hash with snake_case
|
235
|
+
def to_attributes
|
236
|
+
to_hash(downcase: true)
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value, downcase: false)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.map do |v|
|
246
|
+
v.to_hash(downcase: downcase)
|
247
|
+
end
|
248
|
+
elsif value.is_a?(Hash)
|
249
|
+
{}.tap do |hash|
|
250
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
251
|
+
end
|
252
|
+
elsif value.respond_to? :to_hash
|
253
|
+
value.to_hash(downcase: downcase)
|
254
|
+
else
|
255
|
+
value
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def parse_date(datestring)
|
260
|
+
if datestring.include?('Date')
|
261
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
262
|
+
original, date, timezone = *date_pattern.match(datestring)
|
263
|
+
date = (date.to_i / 1000)
|
264
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
265
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
266
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
267
|
+
else # handle date 'types' for small subset of payroll API's
|
268
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Payroll AU API
|
3
|
+
|
4
|
+
#This is the Xero Payroll API for orgs in Australia 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::PayrollAu
|
16
|
+
class PayOutType
|
17
|
+
DEFAULT ||= "DEFAULT".freeze
|
18
|
+
CASHED_OUT ||= "CASHED_OUT".freeze
|
19
|
+
|
20
|
+
# Builds the enum from string
|
21
|
+
# @param [String] The enum value in the form of the string
|
22
|
+
# @return [String] The enum value
|
23
|
+
def self.build_from_hash(value)
|
24
|
+
new.build_from_hash(value)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Builds the enum from string
|
28
|
+
# @param [String] The enum value in the form of the string
|
29
|
+
# @return [String] The enum value
|
30
|
+
def build_from_hash(value)
|
31
|
+
constantValues = PayOutType.constants.select { |c| PayOutType::const_get(c) == value }
|
32
|
+
raise "Invalid ENUM value #{value} for class #PayOutType" if constantValues.empty?
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
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: 2.
|
10
|
+
The version of the XeroOpenAPI document: 2.36.0
|
11
11
|
=end
|
12
12
|
|
13
13
|
module XeroRuby
|
14
|
-
VERSION = '4.
|
14
|
+
VERSION = '4.1.0'
|
15
15
|
end
|
data/lib/xero-ruby.rb
CHANGED
@@ -310,8 +310,10 @@ require 'xero-ruby/models/payroll_au/leave_type'
|
|
310
310
|
require 'xero-ruby/models/payroll_au/leave_type_contribution_type'
|
311
311
|
require 'xero-ruby/models/payroll_au/manual_tax_type'
|
312
312
|
require 'xero-ruby/models/payroll_au/opening_balances'
|
313
|
+
require 'xero-ruby/models/payroll_au/paid_leave_earnings_line'
|
313
314
|
require 'xero-ruby/models/payroll_au/pay_item'
|
314
315
|
require 'xero-ruby/models/payroll_au/pay_items'
|
316
|
+
require 'xero-ruby/models/payroll_au/pay_out_type'
|
315
317
|
require 'xero-ruby/models/payroll_au/pay_run'
|
316
318
|
require 'xero-ruby/models/payroll_au/pay_run_status'
|
317
319
|
require 'xero-ruby/models/payroll_au/pay_runs'
|
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: 4.
|
4
|
+
version: 4.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:
|
11
|
+
date: 2023-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -368,8 +368,10 @@ files:
|
|
368
368
|
- lib/xero-ruby/models/payroll_au/leave_type_contribution_type.rb
|
369
369
|
- lib/xero-ruby/models/payroll_au/manual_tax_type.rb
|
370
370
|
- lib/xero-ruby/models/payroll_au/opening_balances.rb
|
371
|
+
- lib/xero-ruby/models/payroll_au/paid_leave_earnings_line.rb
|
371
372
|
- lib/xero-ruby/models/payroll_au/pay_item.rb
|
372
373
|
- lib/xero-ruby/models/payroll_au/pay_items.rb
|
374
|
+
- lib/xero-ruby/models/payroll_au/pay_out_type.rb
|
373
375
|
- lib/xero-ruby/models/payroll_au/pay_run.rb
|
374
376
|
- lib/xero-ruby/models/payroll_au/pay_run_status.rb
|
375
377
|
- lib/xero-ruby/models/payroll_au/pay_runs.rb
|