xero-ruby 12.4.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xero-ruby/api/accounting_api.rb +3 -0
- data/lib/xero-ruby/api/finance_api.rb +0 -299
- data/lib/xero-ruby/api/payroll_au_v2_api.rb +751 -0
- data/lib/xero-ruby/models/accounting/prepayment.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/employee.rb +1 -13
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +14 -4
- data/lib/xero-ruby/models/payroll_au/opening_balance_leave_line.rb +232 -0
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +1 -1
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +14 -4
- data/lib/xero-ruby/models/payroll_au_v2/invalid_field.rb +232 -0
- data/lib/xero-ruby/models/payroll_au_v2/pagination.rb +252 -0
- data/lib/xero-ruby/models/payroll_au_v2/problem.rb +275 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet.rb +361 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_line.rb +277 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_line_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheets.rb +244 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +3 -2
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +3 -2
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +10 -10
- data/spec/finance/api/finance_api_spec.rb +0 -53
- metadata +386 -396
- data/spec/finance/models/account_usage_response_spec.rb +0 -58
- data/spec/finance/models/account_usage_spec.rb +0 -112
- data/spec/finance/models/history_record_response_spec.rb +0 -64
- data/spec/finance/models/lock_history_model_spec.rb +0 -52
- data/spec/finance/models/lock_history_response_spec.rb +0 -52
- data/spec/finance/models/practice_response_spec.rb +0 -64
- data/spec/finance/models/report_history_model_spec.rb +0 -52
- data/spec/finance/models/report_history_response_spec.rb +0 -52
- data/spec/finance/models/user_activities_response_spec.rb +0 -52
- data/spec/finance/models/user_response_spec.rb +0 -106
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll AU API 2.0
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API 2.0 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::PayrollAuV2
|
|
16
|
+
require 'bigdecimal'
|
|
17
|
+
|
|
18
|
+
class TimesheetObject
|
|
19
|
+
|
|
20
|
+
attr_accessor :pagination
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
attr_accessor :problem
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
attr_accessor :timesheet
|
|
27
|
+
|
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
|
+
def self.attribute_map
|
|
30
|
+
{
|
|
31
|
+
:'pagination' => :'pagination',
|
|
32
|
+
:'problem' => :'problem',
|
|
33
|
+
:'timesheet' => :'timesheet'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Attribute type mapping.
|
|
38
|
+
def self.openapi_types
|
|
39
|
+
{
|
|
40
|
+
:'pagination' => :'Pagination',
|
|
41
|
+
:'problem' => :'Problem',
|
|
42
|
+
:'timesheet' => :'Timesheet'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollAuV2::TimesheetObject` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollAuV2::TimesheetObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'pagination')
|
|
62
|
+
self.pagination = attributes[:'pagination']
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if attributes.key?(:'problem')
|
|
66
|
+
self.problem = attributes[:'problem']
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
if attributes.key?(:'timesheet')
|
|
70
|
+
self.timesheet = attributes[:'timesheet']
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
75
|
+
# @return Array for valid properties with the reasons
|
|
76
|
+
def list_invalid_properties
|
|
77
|
+
invalid_properties = Array.new
|
|
78
|
+
invalid_properties
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Check to see if the all the properties in the model are valid
|
|
82
|
+
# @return true if the model is valid
|
|
83
|
+
def valid?
|
|
84
|
+
true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Checks equality by comparing each attribute.
|
|
88
|
+
# @param [Object] Object to be compared
|
|
89
|
+
def ==(o)
|
|
90
|
+
return true if self.equal?(o)
|
|
91
|
+
self.class == o.class &&
|
|
92
|
+
pagination == o.pagination &&
|
|
93
|
+
problem == o.problem &&
|
|
94
|
+
timesheet == o.timesheet
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# @see the `==` method
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def eql?(o)
|
|
100
|
+
self == o
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Calculates hash code according to all attributes.
|
|
104
|
+
# @return [Integer] Hash code
|
|
105
|
+
def hash
|
|
106
|
+
[pagination, problem, timesheet].hash
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Builds the object from hash
|
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
111
|
+
# @return [Object] Returns the model itself
|
|
112
|
+
def self.build_from_hash(attributes)
|
|
113
|
+
new.build_from_hash(attributes)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Builds the object from hash
|
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
118
|
+
# @return [Object] Returns the model itself
|
|
119
|
+
def build_from_hash(attributes)
|
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
|
121
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
|
123
|
+
# check to ensure the input is an array given that the attribute
|
|
124
|
+
# is documented as an array but the input is not
|
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
127
|
+
end
|
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
self
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Deserializes the data based on type
|
|
137
|
+
# @param string type Data type
|
|
138
|
+
# @param string value Value to be deserialized
|
|
139
|
+
# @return [Object] Deserialized data
|
|
140
|
+
def _deserialize(type, value)
|
|
141
|
+
case type.to_sym
|
|
142
|
+
when :DateTime
|
|
143
|
+
DateTime.parse(parse_date(value))
|
|
144
|
+
when :Date
|
|
145
|
+
Date.parse(parse_date(value))
|
|
146
|
+
when :String
|
|
147
|
+
value.to_s
|
|
148
|
+
when :Integer
|
|
149
|
+
value.to_i
|
|
150
|
+
when :Float
|
|
151
|
+
value.to_f
|
|
152
|
+
when :BigDecimal
|
|
153
|
+
BigDecimal(value.to_s)
|
|
154
|
+
when :Boolean
|
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
156
|
+
true
|
|
157
|
+
else
|
|
158
|
+
false
|
|
159
|
+
end
|
|
160
|
+
when :Object
|
|
161
|
+
# generic object (usually a Hash), return directly
|
|
162
|
+
value
|
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
|
169
|
+
{}.tap do |hash|
|
|
170
|
+
value.each do |k, v|
|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
else # model
|
|
175
|
+
XeroRuby::PayrollAuV2.const_get(type).build_from_hash(value)
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Returns the string representation of the object
|
|
180
|
+
# @return [String] String presentation of the object
|
|
181
|
+
def to_s
|
|
182
|
+
to_hash.to_s
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
|
187
|
+
def to_body
|
|
188
|
+
to_hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the object in the form of hash
|
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
|
193
|
+
def to_hash(downcase: false)
|
|
194
|
+
hash = {}
|
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
196
|
+
value = self.send(attr)
|
|
197
|
+
next if value.nil?
|
|
198
|
+
key = downcase ? attr : param
|
|
199
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
200
|
+
end
|
|
201
|
+
hash
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Returns the object in the form of hash with snake_case
|
|
205
|
+
def to_attributes
|
|
206
|
+
to_hash(downcase: true)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Outputs non-array value in the form of hash
|
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
211
|
+
# @param [Object] value Any valid value
|
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
|
213
|
+
def _to_hash(value, downcase: false)
|
|
214
|
+
if value.is_a?(Array)
|
|
215
|
+
value.map do |v|
|
|
216
|
+
v.to_hash(downcase: downcase)
|
|
217
|
+
end
|
|
218
|
+
elsif value.is_a?(Hash)
|
|
219
|
+
{}.tap do |hash|
|
|
220
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
221
|
+
end
|
|
222
|
+
elsif value.respond_to? :to_hash
|
|
223
|
+
value.to_hash(downcase: downcase)
|
|
224
|
+
else
|
|
225
|
+
value
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def parse_date(datestring)
|
|
230
|
+
if datestring.include?('Date')
|
|
231
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
232
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
233
|
+
date = (date.to_i / 1000)
|
|
234
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
235
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
236
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
237
|
+
else # handle date 'types' for small subset of payroll API's
|
|
238
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero Payroll AU API 2.0
|
|
3
|
+
|
|
4
|
+
#This is the Xero Payroll API 2.0 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::PayrollAuV2
|
|
16
|
+
require 'bigdecimal'
|
|
17
|
+
|
|
18
|
+
class Timesheets
|
|
19
|
+
|
|
20
|
+
attr_accessor :pagination
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
attr_accessor :problem
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
attr_accessor :timesheets
|
|
27
|
+
|
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
|
+
def self.attribute_map
|
|
30
|
+
{
|
|
31
|
+
:'pagination' => :'pagination',
|
|
32
|
+
:'problem' => :'problem',
|
|
33
|
+
:'timesheets' => :'timesheets'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Attribute type mapping.
|
|
38
|
+
def self.openapi_types
|
|
39
|
+
{
|
|
40
|
+
:'pagination' => :'Pagination',
|
|
41
|
+
:'problem' => :'Problem',
|
|
42
|
+
:'timesheets' => :'Array<Timesheet>'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollAuV2::Timesheets` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollAuV2::Timesheets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'pagination')
|
|
62
|
+
self.pagination = attributes[:'pagination']
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if attributes.key?(:'problem')
|
|
66
|
+
self.problem = attributes[:'problem']
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
if attributes.key?(:'timesheets')
|
|
70
|
+
if (value = attributes[:'timesheets']).is_a?(Array)
|
|
71
|
+
self.timesheets = value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
77
|
+
# @return Array for valid properties with the reasons
|
|
78
|
+
def list_invalid_properties
|
|
79
|
+
invalid_properties = Array.new
|
|
80
|
+
invalid_properties
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Check to see if the all the properties in the model are valid
|
|
84
|
+
# @return true if the model is valid
|
|
85
|
+
def valid?
|
|
86
|
+
true
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Checks equality by comparing each attribute.
|
|
90
|
+
# @param [Object] Object to be compared
|
|
91
|
+
def ==(o)
|
|
92
|
+
return true if self.equal?(o)
|
|
93
|
+
self.class == o.class &&
|
|
94
|
+
pagination == o.pagination &&
|
|
95
|
+
problem == o.problem &&
|
|
96
|
+
timesheets == o.timesheets
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @see the `==` method
|
|
100
|
+
# @param [Object] Object to be compared
|
|
101
|
+
def eql?(o)
|
|
102
|
+
self == o
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Calculates hash code according to all attributes.
|
|
106
|
+
# @return [Integer] Hash code
|
|
107
|
+
def hash
|
|
108
|
+
[pagination, problem, timesheets].hash
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Builds the object from hash
|
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
113
|
+
# @return [Object] Returns the model itself
|
|
114
|
+
def self.build_from_hash(attributes)
|
|
115
|
+
new.build_from_hash(attributes)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Builds the object from hash
|
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
120
|
+
# @return [Object] Returns the model itself
|
|
121
|
+
def build_from_hash(attributes)
|
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
|
125
|
+
# check to ensure the input is an array given that the attribute
|
|
126
|
+
# is documented as an array but the input is not
|
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
129
|
+
end
|
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
self
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Deserializes the data based on type
|
|
139
|
+
# @param string type Data type
|
|
140
|
+
# @param string value Value to be deserialized
|
|
141
|
+
# @return [Object] Deserialized data
|
|
142
|
+
def _deserialize(type, value)
|
|
143
|
+
case type.to_sym
|
|
144
|
+
when :DateTime
|
|
145
|
+
DateTime.parse(parse_date(value))
|
|
146
|
+
when :Date
|
|
147
|
+
Date.parse(parse_date(value))
|
|
148
|
+
when :String
|
|
149
|
+
value.to_s
|
|
150
|
+
when :Integer
|
|
151
|
+
value.to_i
|
|
152
|
+
when :Float
|
|
153
|
+
value.to_f
|
|
154
|
+
when :BigDecimal
|
|
155
|
+
BigDecimal(value.to_s)
|
|
156
|
+
when :Boolean
|
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
158
|
+
true
|
|
159
|
+
else
|
|
160
|
+
false
|
|
161
|
+
end
|
|
162
|
+
when :Object
|
|
163
|
+
# generic object (usually a Hash), return directly
|
|
164
|
+
value
|
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
|
171
|
+
{}.tap do |hash|
|
|
172
|
+
value.each do |k, v|
|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
else # model
|
|
177
|
+
XeroRuby::PayrollAuV2.const_get(type).build_from_hash(value)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Returns the string representation of the object
|
|
182
|
+
# @return [String] String presentation of the object
|
|
183
|
+
def to_s
|
|
184
|
+
to_hash.to_s
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
|
189
|
+
def to_body
|
|
190
|
+
to_hash
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the object in the form of hash
|
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
|
195
|
+
def to_hash(downcase: false)
|
|
196
|
+
hash = {}
|
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
198
|
+
value = self.send(attr)
|
|
199
|
+
next if value.nil?
|
|
200
|
+
key = downcase ? attr : param
|
|
201
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
202
|
+
end
|
|
203
|
+
hash
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Returns the object in the form of hash with snake_case
|
|
207
|
+
def to_attributes
|
|
208
|
+
to_hash(downcase: true)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Outputs non-array value in the form of hash
|
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
213
|
+
# @param [Object] value Any valid value
|
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
|
215
|
+
def _to_hash(value, downcase: false)
|
|
216
|
+
if value.is_a?(Array)
|
|
217
|
+
value.map do |v|
|
|
218
|
+
v.to_hash(downcase: downcase)
|
|
219
|
+
end
|
|
220
|
+
elsif value.is_a?(Hash)
|
|
221
|
+
{}.tap do |hash|
|
|
222
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
223
|
+
end
|
|
224
|
+
elsif value.respond_to? :to_hash
|
|
225
|
+
value.to_hash(downcase: downcase)
|
|
226
|
+
else
|
|
227
|
+
value
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def parse_date(datestring)
|
|
232
|
+
if datestring.include?('Date')
|
|
233
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
234
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
235
|
+
date = (date.to_i / 1000)
|
|
236
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
237
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
238
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
239
|
+
else # handle date 'types' for small subset of payroll API's
|
|
240
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
@@ -49,6 +49,7 @@ module XeroRuby::PayrollUk
|
|
|
49
49
|
TERMINATION_PAY ||= "TerminationPay".freeze
|
|
50
50
|
STATUTORY_NEONATAL_CARE_PAY ||= "StatutoryNeonatalCarePay".freeze
|
|
51
51
|
STATUTORY_NEONATAL_CARE_PAY_NON_PENSIONABLE ||= "StatutoryNeonatalCarePayNonPensionable".freeze
|
|
52
|
+
STATUTORY_BEREAVEMENT_PAY_NORTHERN_IRELAND ||= "StatutoryBereavementPayNorthernIreland".freeze
|
|
52
53
|
|
|
53
54
|
# Indicates the type of the earning rate
|
|
54
55
|
attr_accessor :rate_type
|
|
@@ -216,7 +217,7 @@ module XeroRuby::PayrollUk
|
|
|
216
217
|
def valid?
|
|
217
218
|
return false if @name.nil?
|
|
218
219
|
return false if @earnings_type.nil?
|
|
219
|
-
earnings_type_validator = EnumAttributeValidator.new('String', ["Allowance", "BackPay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "TipsNonDirect", "TipsDirect", "TerminationPay", "StatutoryNeonatalCarePay", "StatutoryNeonatalCarePayNonPensionable"])
|
|
220
|
+
earnings_type_validator = EnumAttributeValidator.new('String', ["Allowance", "BackPay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "TipsNonDirect", "TipsDirect", "TerminationPay", "StatutoryNeonatalCarePay", "StatutoryNeonatalCarePayNonPensionable", "StatutoryBereavementPayNorthernIreland"])
|
|
220
221
|
return false unless earnings_type_validator.valid?(@earnings_type)
|
|
221
222
|
return false if @rate_type.nil?
|
|
222
223
|
rate_type_validator = EnumAttributeValidator.new('String', ["RatePerUnit", "MultipleOfOrdinaryEarningsRate", "FixedAmount"])
|
|
@@ -229,7 +230,7 @@ module XeroRuby::PayrollUk
|
|
|
229
230
|
# Custom attribute writer method checking allowed values (enum).
|
|
230
231
|
# @param [Object] earnings_type Object to be assigned
|
|
231
232
|
def earnings_type=(earnings_type)
|
|
232
|
-
validator = EnumAttributeValidator.new('String', ["Allowance", "BackPay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "TipsNonDirect", "TipsDirect", "TerminationPay", "StatutoryNeonatalCarePay", "StatutoryNeonatalCarePayNonPensionable"])
|
|
233
|
+
validator = EnumAttributeValidator.new('String', ["Allowance", "BackPay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "TipsNonDirect", "TipsDirect", "TerminationPay", "StatutoryNeonatalCarePay", "StatutoryNeonatalCarePayNonPensionable", "StatutoryBereavementPayNorthernIreland"])
|
|
233
234
|
unless validator.valid?(earnings_type)
|
|
234
235
|
fail ArgumentError, "invalid value for \"earnings_type\", must be one of #{validator.allowable_values}."
|
|
235
236
|
end
|
|
@@ -31,6 +31,7 @@ module XeroRuby::PayrollUk
|
|
|
31
31
|
SHAREDPARENTAL ||= "Sharedparental".freeze
|
|
32
32
|
BEREAVEMENT ||= "Bereavement".freeze
|
|
33
33
|
NEONATAL_CARE ||= "NeonatalCare".freeze
|
|
34
|
+
BEREAVEMENT_NIRE ||= "BereavementNire".freeze
|
|
34
35
|
|
|
35
36
|
# The date when the leave starts
|
|
36
37
|
attr_accessor :start_date
|
|
@@ -149,7 +150,7 @@ module XeroRuby::PayrollUk
|
|
|
149
150
|
# Check to see if the all the properties in the model are valid
|
|
150
151
|
# @return true if the model is valid
|
|
151
152
|
def valid?
|
|
152
|
-
type_validator = EnumAttributeValidator.new('String', ["Sick", "Adoption", "Maternity", "Paternity", "Sharedparental", "Bereavement", "NeonatalCare"])
|
|
153
|
+
type_validator = EnumAttributeValidator.new('String', ["Sick", "Adoption", "Maternity", "Paternity", "Sharedparental", "Bereavement", "NeonatalCare", "BereavementNire"])
|
|
153
154
|
return false unless type_validator.valid?(@type)
|
|
154
155
|
status_validator = EnumAttributeValidator.new('String', ["Pending", "In-Progress", "Completed"])
|
|
155
156
|
return false unless status_validator.valid?(@status)
|
|
@@ -159,7 +160,7 @@ module XeroRuby::PayrollUk
|
|
|
159
160
|
# Custom attribute writer method checking allowed values (enum).
|
|
160
161
|
# @param [Object] type Object to be assigned
|
|
161
162
|
def type=(type)
|
|
162
|
-
validator = EnumAttributeValidator.new('String', ["Sick", "Adoption", "Maternity", "Paternity", "Sharedparental", "Bereavement", "NeonatalCare"])
|
|
163
|
+
validator = EnumAttributeValidator.new('String', ["Sick", "Adoption", "Maternity", "Paternity", "Sharedparental", "Bereavement", "NeonatalCare", "BereavementNire"])
|
|
163
164
|
unless validator.valid?(type)
|
|
164
165
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
165
166
|
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:
|
|
10
|
+
The version of the XeroOpenAPI document: 12.0.0
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module XeroRuby
|
|
14
|
-
VERSION = '
|
|
14
|
+
VERSION = '14.0.0'
|
|
15
15
|
end
|
data/lib/xero-ruby.rb
CHANGED
|
@@ -18,8 +18,6 @@ require 'xero-ruby/version'
|
|
|
18
18
|
require 'xero-ruby/configuration'
|
|
19
19
|
|
|
20
20
|
# Models
|
|
21
|
-
require 'xero-ruby/models/finance/account_usage'
|
|
22
|
-
require 'xero-ruby/models/finance/account_usage_response'
|
|
23
21
|
require 'xero-ruby/models/finance/balance_sheet_account_detail'
|
|
24
22
|
require 'xero-ruby/models/finance/balance_sheet_account_group'
|
|
25
23
|
require 'xero-ruby/models/finance/balance_sheet_account_type'
|
|
@@ -41,25 +39,19 @@ require 'xero-ruby/models/finance/contact_total_other'
|
|
|
41
39
|
require 'xero-ruby/models/finance/credit_note_response'
|
|
42
40
|
require 'xero-ruby/models/finance/current_statement_response'
|
|
43
41
|
require 'xero-ruby/models/finance/data_source_response'
|
|
44
|
-
require 'xero-ruby/models/finance/history_record_response'
|
|
45
42
|
require 'xero-ruby/models/finance/income_by_contact_response'
|
|
46
43
|
require 'xero-ruby/models/finance/invoice_response'
|
|
47
44
|
require 'xero-ruby/models/finance/line_item_response'
|
|
48
|
-
require 'xero-ruby/models/finance/lock_history_model'
|
|
49
|
-
require 'xero-ruby/models/finance/lock_history_response'
|
|
50
45
|
require 'xero-ruby/models/finance/manual_journal_total'
|
|
51
46
|
require 'xero-ruby/models/finance/overpayment_response'
|
|
52
47
|
require 'xero-ruby/models/finance/payment_response'
|
|
53
48
|
require 'xero-ruby/models/finance/pnl_account'
|
|
54
49
|
require 'xero-ruby/models/finance/pnl_account_class'
|
|
55
50
|
require 'xero-ruby/models/finance/pnl_account_type'
|
|
56
|
-
require 'xero-ruby/models/finance/practice_response'
|
|
57
51
|
require 'xero-ruby/models/finance/prepayment_response'
|
|
58
52
|
require 'xero-ruby/models/finance/problem'
|
|
59
53
|
require 'xero-ruby/models/finance/problem_type'
|
|
60
54
|
require 'xero-ruby/models/finance/profit_and_loss_response'
|
|
61
|
-
require 'xero-ruby/models/finance/report_history_model'
|
|
62
|
-
require 'xero-ruby/models/finance/report_history_response'
|
|
63
55
|
require 'xero-ruby/models/finance/statement_balance_response'
|
|
64
56
|
require 'xero-ruby/models/finance/statement_line_response'
|
|
65
57
|
require 'xero-ruby/models/finance/statement_lines_response'
|
|
@@ -70,8 +62,6 @@ require 'xero-ruby/models/finance/trial_balance_account'
|
|
|
70
62
|
require 'xero-ruby/models/finance/trial_balance_entry'
|
|
71
63
|
require 'xero-ruby/models/finance/trial_balance_movement'
|
|
72
64
|
require 'xero-ruby/models/finance/trial_balance_response'
|
|
73
|
-
require 'xero-ruby/models/finance/user_activities_response'
|
|
74
|
-
require 'xero-ruby/models/finance/user_response'
|
|
75
65
|
require 'xero-ruby/models/app_store/create_usage_record'
|
|
76
66
|
require 'xero-ruby/models/app_store/plan'
|
|
77
67
|
require 'xero-ruby/models/app_store/price'
|
|
@@ -285,6 +275,14 @@ require 'xero-ruby/models/payroll_nz/timesheets'
|
|
|
285
275
|
require 'xero-ruby/models/payroll_nz/tracking_categories'
|
|
286
276
|
require 'xero-ruby/models/payroll_nz/tracking_category'
|
|
287
277
|
require 'xero-ruby/models/payroll_nz/working_week'
|
|
278
|
+
require 'xero-ruby/models/payroll_au_v2/invalid_field'
|
|
279
|
+
require 'xero-ruby/models/payroll_au_v2/pagination'
|
|
280
|
+
require 'xero-ruby/models/payroll_au_v2/problem'
|
|
281
|
+
require 'xero-ruby/models/payroll_au_v2/timesheet'
|
|
282
|
+
require 'xero-ruby/models/payroll_au_v2/timesheet_line'
|
|
283
|
+
require 'xero-ruby/models/payroll_au_v2/timesheet_line_object'
|
|
284
|
+
require 'xero-ruby/models/payroll_au_v2/timesheet_object'
|
|
285
|
+
require 'xero-ruby/models/payroll_au_v2/timesheets'
|
|
288
286
|
require 'xero-ruby/models/payroll_au/api_exception'
|
|
289
287
|
require 'xero-ruby/models/payroll_au/account'
|
|
290
288
|
require 'xero-ruby/models/payroll_au/account_type'
|
|
@@ -323,6 +321,7 @@ require 'xero-ruby/models/payroll_au/leave_period_status'
|
|
|
323
321
|
require 'xero-ruby/models/payroll_au/leave_type'
|
|
324
322
|
require 'xero-ruby/models/payroll_au/leave_type_contribution_type'
|
|
325
323
|
require 'xero-ruby/models/payroll_au/manual_tax_type'
|
|
324
|
+
require 'xero-ruby/models/payroll_au/opening_balance_leave_line'
|
|
326
325
|
require 'xero-ruby/models/payroll_au/opening_balances'
|
|
327
326
|
require 'xero-ruby/models/payroll_au/paid_leave_earnings_line'
|
|
328
327
|
require 'xero-ruby/models/payroll_au/pay_item'
|
|
@@ -554,6 +553,7 @@ require 'xero-ruby/api/finance_api'
|
|
|
554
553
|
require 'xero-ruby/api/app_store_api'
|
|
555
554
|
require 'xero-ruby/api/payroll_uk_api'
|
|
556
555
|
require 'xero-ruby/api/payroll_nz_api'
|
|
556
|
+
require 'xero-ruby/api/payroll_au_v2_api'
|
|
557
557
|
require 'xero-ruby/api/payroll_au_api'
|
|
558
558
|
require 'xero-ruby/api/files_api'
|
|
559
559
|
require 'xero-ruby/api/project_api'
|