xero-ruby 9.3.0 → 18.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/accounting_api.rb +178 -319
  3. data/lib/xero-ruby/api/files_api.rb +9 -2
  4. data/lib/xero-ruby/api/finance_api.rb +0 -299
  5. data/lib/xero-ruby/api/payroll_au_v2_api.rb +751 -0
  6. data/lib/xero-ruby/api/payroll_nz_api.rb +0 -86
  7. data/lib/xero-ruby/api/payroll_uk_api.rb +0 -86
  8. data/lib/xero-ruby/models/accounting/bank_transfer.rb +71 -1
  9. data/lib/xero-ruby/models/accounting/bank_transfer_delete.rb +244 -0
  10. data/lib/xero-ruby/models/accounting/bank_transfer_delete_by_url_param.rb +229 -0
  11. data/lib/xero-ruby/models/accounting/bank_transfers_delete.rb +224 -0
  12. data/lib/xero-ruby/models/accounting/contact.rb +27 -1
  13. data/lib/xero-ruby/models/accounting/credit_note.rb +11 -1
  14. data/lib/xero-ruby/models/accounting/invoice.rb +12 -2
  15. data/lib/xero-ruby/models/accounting/organisation.rb +25 -6
  16. data/lib/xero-ruby/models/accounting/overpayment.rb +21 -1
  17. data/lib/xero-ruby/models/accounting/payment.rb +11 -1
  18. data/lib/xero-ruby/models/accounting/prepayment.rb +31 -1
  19. data/lib/xero-ruby/models/accounting/tracking_reference.rb +277 -0
  20. data/lib/xero-ruby/models/accounting/user.rb +3 -2
  21. data/lib/xero-ruby/models/app_store/product.rb +4 -3
  22. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +54 -4
  23. data/lib/xero-ruby/models/files/association.rb +21 -1
  24. data/lib/xero-ruby/models/finance/current_statement_response.rb +1 -1
  25. data/lib/xero-ruby/models/finance/data_source_response.rb +1 -31
  26. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +16 -1
  27. data/lib/xero-ruby/models/payroll_au/employee.rb +1 -13
  28. data/lib/xero-ruby/models/payroll_au/leave_line.rb +16 -1
  29. data/lib/xero-ruby/models/payroll_au/leave_type.rb +19 -4
  30. data/lib/xero-ruby/models/payroll_au/opening_balance_leave_line.rb +232 -0
  31. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +1 -1
  32. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +14 -4
  33. data/lib/xero-ruby/models/payroll_au_v2/invalid_field.rb +232 -0
  34. data/lib/xero-ruby/models/payroll_au_v2/pagination.rb +252 -0
  35. data/lib/xero-ruby/models/payroll_au_v2/problem.rb +275 -0
  36. data/lib/xero-ruby/models/payroll_au_v2/timesheet.rb +361 -0
  37. data/lib/xero-ruby/models/payroll_au_v2/timesheet_line.rb +277 -0
  38. data/lib/xero-ruby/models/payroll_au_v2/timesheet_line_object.rb +242 -0
  39. data/lib/xero-ruby/models/payroll_au_v2/timesheet_object.rb +242 -0
  40. data/lib/xero-ruby/models/payroll_au_v2/timesheets.rb +244 -0
  41. data/lib/xero-ruby/models/payroll_nz/employee.rb +20 -0
  42. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +29 -19
  43. data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +31 -11
  44. data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +5 -0
  45. data/lib/xero-ruby/models/payroll_nz/employment.rb +15 -0
  46. data/lib/xero-ruby/models/payroll_nz/leave_period.rb +35 -4
  47. data/lib/xero-ruby/models/payroll_nz/leave_type.rb +24 -4
  48. data/lib/xero-ruby/models/payroll_uk/contract_type.rb +38 -0
  49. data/lib/xero-ruby/models/payroll_uk/contracts.rb +297 -0
  50. data/lib/xero-ruby/models/payroll_uk/developmental_role_details.rb +267 -0
  51. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +5 -2
  52. data/lib/xero-ruby/models/payroll_uk/employee.rb +68 -4
  53. data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +5 -0
  54. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +4 -2
  55. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +5 -2
  56. data/lib/xero-ruby/models/payroll_uk/employment.rb +49 -52
  57. data/lib/xero-ruby/models/payroll_uk/employment_status.rb +37 -0
  58. data/lib/xero-ruby/models/payroll_uk/ni_category.rb +318 -0
  59. data/lib/xero-ruby/models/payroll_uk/ni_category_letter.rb +51 -0
  60. data/lib/xero-ruby/models/payroll_uk/ni_category_one_of.rb +264 -0
  61. data/lib/xero-ruby/models/payroll_uk/ni_category_one_of1.rb +257 -0
  62. data/lib/xero-ruby/version.rb +2 -2
  63. data/lib/xero-ruby.rb +22 -10
  64. data/spec/finance/api/finance_api_spec.rb +0 -53
  65. metadata +393 -391
  66. data/spec/finance/models/account_usage_response_spec.rb +0 -58
  67. data/spec/finance/models/account_usage_spec.rb +0 -112
  68. data/spec/finance/models/history_record_response_spec.rb +0 -64
  69. data/spec/finance/models/lock_history_model_spec.rb +0 -52
  70. data/spec/finance/models/lock_history_response_spec.rb +0 -52
  71. data/spec/finance/models/practice_response_spec.rb +0 -64
  72. data/spec/finance/models/report_history_model_spec.rb +0 -52
  73. data/spec/finance/models/report_history_response_spec.rb +0 -52
  74. data/spec/finance/models/user_activities_response_spec.rb +0 -52
  75. data/spec/finance/models/user_response_spec.rb +0 -106
@@ -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
@@ -225,12 +225,32 @@ module XeroRuby::PayrollNz
225
225
  # @return Array for valid properties with the reasons
226
226
  def list_invalid_properties
227
227
  invalid_properties = Array.new
228
+ if @first_name.nil?
229
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
230
+ end
231
+
232
+ if @last_name.nil?
233
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
234
+ end
235
+
236
+ if @date_of_birth.nil?
237
+ invalid_properties.push('invalid value for "date_of_birth", date_of_birth cannot be nil.')
238
+ end
239
+
240
+ if @address.nil?
241
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
242
+ end
243
+
228
244
  invalid_properties
229
245
  end
230
246
 
231
247
  # Check to see if the all the properties in the model are valid
232
248
  # @return true if the model is valid
233
249
  def valid?
250
+ return false if @first_name.nil?
251
+ return false if @last_name.nil?
252
+ return false if @date_of_birth.nil?
253
+ return false if @address.nil?
234
254
  gender_validator = EnumAttributeValidator.new('String', ["M", "F"])
235
255
  return false unless gender_validator.valid?(@gender)
236
256
  true
@@ -28,11 +28,11 @@ module XeroRuby::PayrollNz
28
28
  # The dollar value of annual leave opening balance if negative.
29
29
  attr_accessor :negative_annual_leave_balance_paid_amount
30
30
 
31
- # Number of hours accrued annually for sick leave. Multiply the number of days they're entitled to by the hours worked per day
32
- attr_accessor :sick_leave_hours_to_accrue_annually
31
+ # Number of units accrued annually for sick leave. The type of units is determined by the property \"TypeOfUnitsToAccrue\" on the \"Sick Leave\" leave type
32
+ attr_accessor :sick_leave_to_accrue_annually
33
33
 
34
- # Maximum number of hours accrued annually for sick leave. Multiply the maximum days they can accrue by the hours worked per day
35
- attr_accessor :sick_leave_maximum_hours_to_accrue
34
+ # Maximum number of units accrued annually for sick leave. The type of units is determined by the property \"TypeOfUnitsToAccrue\" on the \"Sick Leave\" leave type
35
+ attr_accessor :sick_leave_maximum_to_accrue
36
36
 
37
37
  # Initial sick leave balance. This will be positive unless they've taken sick leave in advance
38
38
  attr_accessor :sick_leave_opening_balance
@@ -40,9 +40,12 @@ module XeroRuby::PayrollNz
40
40
  # Set Schedule of Accrual Type for Sick Leave
41
41
  attr_accessor :sick_leave_schedule_of_accrual
42
42
 
43
- # If Sick Leave Schedule of Accrual is \"OnAnniversaryDate\", this is the date when entitled to Sick Leave
43
+ # If Sick Leave Schedule of Accrual is \"OnAnniversaryDate\", this is the date when entitled to Sick Leave. When null the Employee's start date is used as the anniversary date
44
44
  attr_accessor :sick_leave_anniversary_date
45
45
 
46
+ # The first date the employee will accrue Annual Leave. When null the Employee's start date is used as the anniversary date
47
+ attr_accessor :annual_leave_anniversary_date
48
+
46
49
  # Attribute mapping from ruby-style variable name to JSON key.
47
50
  def self.attribute_map
48
51
  {
@@ -50,11 +53,12 @@ module XeroRuby::PayrollNz
50
53
  :'holiday_pay_opening_balance' => :'holidayPayOpeningBalance',
51
54
  :'annual_leave_opening_balance' => :'annualLeaveOpeningBalance',
52
55
  :'negative_annual_leave_balance_paid_amount' => :'negativeAnnualLeaveBalancePaidAmount',
53
- :'sick_leave_hours_to_accrue_annually' => :'sickLeaveHoursToAccrueAnnually',
54
- :'sick_leave_maximum_hours_to_accrue' => :'sickLeaveMaximumHoursToAccrue',
56
+ :'sick_leave_to_accrue_annually' => :'SickLeaveToAccrueAnnually',
57
+ :'sick_leave_maximum_to_accrue' => :'SickLeaveMaximumToAccrue',
55
58
  :'sick_leave_opening_balance' => :'sickLeaveOpeningBalance',
56
59
  :'sick_leave_schedule_of_accrual' => :'SickLeaveScheduleOfAccrual',
57
- :'sick_leave_anniversary_date' => :'SickLeaveAnniversaryDate'
60
+ :'sick_leave_anniversary_date' => :'SickLeaveAnniversaryDate',
61
+ :'annual_leave_anniversary_date' => :'AnnualLeaveAnniversaryDate'
58
62
  }
59
63
  end
60
64
 
@@ -65,11 +69,12 @@ module XeroRuby::PayrollNz
65
69
  :'holiday_pay_opening_balance' => :'BigDecimal',
66
70
  :'annual_leave_opening_balance' => :'BigDecimal',
67
71
  :'negative_annual_leave_balance_paid_amount' => :'BigDecimal',
68
- :'sick_leave_hours_to_accrue_annually' => :'BigDecimal',
69
- :'sick_leave_maximum_hours_to_accrue' => :'BigDecimal',
72
+ :'sick_leave_to_accrue_annually' => :'BigDecimal',
73
+ :'sick_leave_maximum_to_accrue' => :'BigDecimal',
70
74
  :'sick_leave_opening_balance' => :'BigDecimal',
71
75
  :'sick_leave_schedule_of_accrual' => :'String',
72
- :'sick_leave_anniversary_date' => :'Date'
76
+ :'sick_leave_anniversary_date' => :'Date',
77
+ :'annual_leave_anniversary_date' => :'Date'
73
78
  }
74
79
  end
75
80
 
@@ -104,12 +109,12 @@ module XeroRuby::PayrollNz
104
109
  self.negative_annual_leave_balance_paid_amount = attributes[:'negative_annual_leave_balance_paid_amount']
105
110
  end
106
111
 
107
- if attributes.key?(:'sick_leave_hours_to_accrue_annually')
108
- self.sick_leave_hours_to_accrue_annually = attributes[:'sick_leave_hours_to_accrue_annually']
112
+ if attributes.key?(:'sick_leave_to_accrue_annually')
113
+ self.sick_leave_to_accrue_annually = attributes[:'sick_leave_to_accrue_annually']
109
114
  end
110
115
 
111
- if attributes.key?(:'sick_leave_maximum_hours_to_accrue')
112
- self.sick_leave_maximum_hours_to_accrue = attributes[:'sick_leave_maximum_hours_to_accrue']
116
+ if attributes.key?(:'sick_leave_maximum_to_accrue')
117
+ self.sick_leave_maximum_to_accrue = attributes[:'sick_leave_maximum_to_accrue']
113
118
  end
114
119
 
115
120
  if attributes.key?(:'sick_leave_opening_balance')
@@ -123,6 +128,10 @@ module XeroRuby::PayrollNz
123
128
  if attributes.key?(:'sick_leave_anniversary_date')
124
129
  self.sick_leave_anniversary_date = attributes[:'sick_leave_anniversary_date']
125
130
  end
131
+
132
+ if attributes.key?(:'annual_leave_anniversary_date')
133
+ self.annual_leave_anniversary_date = attributes[:'annual_leave_anniversary_date']
134
+ end
126
135
  end
127
136
 
128
137
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -147,11 +156,12 @@ module XeroRuby::PayrollNz
147
156
  holiday_pay_opening_balance == o.holiday_pay_opening_balance &&
148
157
  annual_leave_opening_balance == o.annual_leave_opening_balance &&
149
158
  negative_annual_leave_balance_paid_amount == o.negative_annual_leave_balance_paid_amount &&
150
- sick_leave_hours_to_accrue_annually == o.sick_leave_hours_to_accrue_annually &&
151
- sick_leave_maximum_hours_to_accrue == o.sick_leave_maximum_hours_to_accrue &&
159
+ sick_leave_to_accrue_annually == o.sick_leave_to_accrue_annually &&
160
+ sick_leave_maximum_to_accrue == o.sick_leave_maximum_to_accrue &&
152
161
  sick_leave_opening_balance == o.sick_leave_opening_balance &&
153
162
  sick_leave_schedule_of_accrual == o.sick_leave_schedule_of_accrual &&
154
- sick_leave_anniversary_date == o.sick_leave_anniversary_date
163
+ sick_leave_anniversary_date == o.sick_leave_anniversary_date &&
164
+ annual_leave_anniversary_date == o.annual_leave_anniversary_date
155
165
  end
156
166
 
157
167
  # @see the `==` method
@@ -163,7 +173,7 @@ module XeroRuby::PayrollNz
163
173
  # Calculates hash code according to all attributes.
164
174
  # @return [Integer] Hash code
165
175
  def hash
166
- [include_holiday_pay, holiday_pay_opening_balance, annual_leave_opening_balance, negative_annual_leave_balance_paid_amount, sick_leave_hours_to_accrue_annually, sick_leave_maximum_hours_to_accrue, sick_leave_opening_balance, sick_leave_schedule_of_accrual, sick_leave_anniversary_date].hash
176
+ [include_holiday_pay, holiday_pay_opening_balance, annual_leave_opening_balance, negative_annual_leave_balance_paid_amount, sick_leave_to_accrue_annually, sick_leave_maximum_to_accrue, sick_leave_opening_balance, sick_leave_schedule_of_accrual, sick_leave_anniversary_date, annual_leave_anniversary_date].hash
167
177
  end
168
178
 
169
179
  # Builds the object from hash
@@ -26,16 +26,22 @@ module XeroRuby::PayrollNz
26
26
  PERCENTAGE_OF_GROSS_EARNINGS ||= "PercentageOfGrossEarnings".freeze
27
27
  NO_ACCRUALS ||= "NoAccruals".freeze
28
28
 
29
- # The number of hours accrued for the leave annually. This is 0 when the scheduleOfAccrual chosen is \"OnHourWorked\"
30
- attr_accessor :hours_accrued_annually
29
+ # The number of units accrued for the leave annually. This is 0 when the ScheduleOfAccrual chosen is \"NoAccruals\"
30
+ attr_accessor :units_accrued_annually
31
31
 
32
- # The maximum number of hours that can be accrued for the leave
32
+ # The type of units accrued for the leave annually
33
+ attr_accessor :type_of_units_to_accrue
34
+
35
+ # The maximum number of units that can be accrued for the leave
33
36
  attr_accessor :maximum_to_accrue
34
37
 
35
- # The initial number of hours assigned when the leave was added to the employee
38
+ # The initial number of units assigned when the leave was added to the employee
36
39
  attr_accessor :opening_balance
37
40
 
38
- # The number of hours added to the leave balance for every hour worked by the employee. This is normally 0, unless the scheduleOfAccrual chosen is \"OnHourWorked\"
41
+ # The type of units for the opening balance
42
+ attr_accessor :opening_balance_type_of_units
43
+
44
+ # not supported in Payroll NZ
39
45
  attr_accessor :rate_accrued_hourly
40
46
 
41
47
  # Specific for scheduleOfAccrual having percentage of gross earnings. Identifies how much percentage of gross earnings is accrued per pay period.
@@ -80,9 +86,11 @@ module XeroRuby::PayrollNz
80
86
  {
81
87
  :'leave_type_id' => :'leaveTypeID',
82
88
  :'schedule_of_accrual' => :'scheduleOfAccrual',
83
- :'hours_accrued_annually' => :'hoursAccruedAnnually',
89
+ :'units_accrued_annually' => :'unitsAccruedAnnually',
90
+ :'type_of_units_to_accrue' => :'typeOfUnitsToAccrue',
84
91
  :'maximum_to_accrue' => :'maximumToAccrue',
85
92
  :'opening_balance' => :'openingBalance',
93
+ :'opening_balance_type_of_units' => :'openingBalanceTypeOfUnits',
86
94
  :'rate_accrued_hourly' => :'rateAccruedHourly',
87
95
  :'percentage_of_gross_earnings' => :'percentageOfGrossEarnings',
88
96
  :'include_holiday_pay_every_pay' => :'includeHolidayPayEveryPay',
@@ -97,9 +105,11 @@ module XeroRuby::PayrollNz
97
105
  {
98
106
  :'leave_type_id' => :'String',
99
107
  :'schedule_of_accrual' => :'String',
100
- :'hours_accrued_annually' => :'BigDecimal',
108
+ :'units_accrued_annually' => :'BigDecimal',
109
+ :'type_of_units_to_accrue' => :'String',
101
110
  :'maximum_to_accrue' => :'BigDecimal',
102
111
  :'opening_balance' => :'BigDecimal',
112
+ :'opening_balance_type_of_units' => :'String',
103
113
  :'rate_accrued_hourly' => :'BigDecimal',
104
114
  :'percentage_of_gross_earnings' => :'BigDecimal',
105
115
  :'include_holiday_pay_every_pay' => :'Boolean',
@@ -132,8 +142,12 @@ module XeroRuby::PayrollNz
132
142
  self.schedule_of_accrual = attributes[:'schedule_of_accrual']
133
143
  end
134
144
 
135
- if attributes.key?(:'hours_accrued_annually')
136
- self.hours_accrued_annually = attributes[:'hours_accrued_annually']
145
+ if attributes.key?(:'units_accrued_annually')
146
+ self.units_accrued_annually = attributes[:'units_accrued_annually']
147
+ end
148
+
149
+ if attributes.key?(:'type_of_units_to_accrue')
150
+ self.type_of_units_to_accrue = attributes[:'type_of_units_to_accrue']
137
151
  end
138
152
 
139
153
  if attributes.key?(:'maximum_to_accrue')
@@ -144,6 +158,10 @@ module XeroRuby::PayrollNz
144
158
  self.opening_balance = attributes[:'opening_balance']
145
159
  end
146
160
 
161
+ if attributes.key?(:'opening_balance_type_of_units')
162
+ self.opening_balance_type_of_units = attributes[:'opening_balance_type_of_units']
163
+ end
164
+
147
165
  if attributes.key?(:'rate_accrued_hourly')
148
166
  self.rate_accrued_hourly = attributes[:'rate_accrued_hourly']
149
167
  end
@@ -201,9 +219,11 @@ module XeroRuby::PayrollNz
201
219
  self.class == o.class &&
202
220
  leave_type_id == o.leave_type_id &&
203
221
  schedule_of_accrual == o.schedule_of_accrual &&
204
- hours_accrued_annually == o.hours_accrued_annually &&
222
+ units_accrued_annually == o.units_accrued_annually &&
223
+ type_of_units_to_accrue == o.type_of_units_to_accrue &&
205
224
  maximum_to_accrue == o.maximum_to_accrue &&
206
225
  opening_balance == o.opening_balance &&
226
+ opening_balance_type_of_units == o.opening_balance_type_of_units &&
207
227
  rate_accrued_hourly == o.rate_accrued_hourly &&
208
228
  percentage_of_gross_earnings == o.percentage_of_gross_earnings &&
209
229
  include_holiday_pay_every_pay == o.include_holiday_pay_every_pay &&
@@ -221,7 +241,7 @@ module XeroRuby::PayrollNz
221
241
  # Calculates hash code according to all attributes.
222
242
  # @return [Integer] Hash code
223
243
  def hash
224
- [leave_type_id, schedule_of_accrual, hours_accrued_annually, maximum_to_accrue, opening_balance, rate_accrued_hourly, percentage_of_gross_earnings, include_holiday_pay_every_pay, show_annual_leave_in_advance, annual_leave_total_amount_paid, schedule_of_accrual_date].hash
244
+ [leave_type_id, schedule_of_accrual, units_accrued_annually, type_of_units_to_accrue, maximum_to_accrue, opening_balance, opening_balance_type_of_units, rate_accrued_hourly, percentage_of_gross_earnings, include_holiday_pay_every_pay, show_annual_leave_in_advance, annual_leave_total_amount_paid, schedule_of_accrual_date].hash
225
245
  end
226
246
 
227
247
  # Builds the object from hash
@@ -68,12 +68,17 @@ module XeroRuby::PayrollNz
68
68
  # @return Array for valid properties with the reasons
69
69
  def list_invalid_properties
70
70
  invalid_properties = Array.new
71
+ if @earning_templates.nil?
72
+ invalid_properties.push('invalid value for "earning_templates", earning_templates cannot be nil.')
73
+ end
74
+
71
75
  invalid_properties
72
76
  end
73
77
 
74
78
  # Check to see if the all the properties in the model are valid
75
79
  # @return true if the model is valid
76
80
  def valid?
81
+ return false if @earning_templates.nil?
77
82
  true
78
83
  end
79
84
 
@@ -93,12 +93,27 @@ module XeroRuby::PayrollNz
93
93
  # @return Array for valid properties with the reasons
94
94
  def list_invalid_properties
95
95
  invalid_properties = Array.new
96
+ if @payroll_calendar_id.nil?
97
+ invalid_properties.push('invalid value for "payroll_calendar_id", payroll_calendar_id cannot be nil.')
98
+ end
99
+
100
+ if @start_date.nil?
101
+ invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
102
+ end
103
+
104
+ if @engagement_type.nil?
105
+ invalid_properties.push('invalid value for "engagement_type", engagement_type cannot be nil.')
106
+ end
107
+
96
108
  invalid_properties
97
109
  end
98
110
 
99
111
  # Check to see if the all the properties in the model are valid
100
112
  # @return true if the model is valid
101
113
  def valid?
114
+ return false if @payroll_calendar_id.nil?
115
+ return false if @start_date.nil?
116
+ return false if @engagement_type.nil?
102
117
  true
103
118
  end
104
119
 
@@ -25,10 +25,20 @@ module XeroRuby::PayrollNz
25
25
  # The Number of Units for the leave
26
26
  attr_accessor :number_of_units
27
27
 
28
- # Period Status
28
+ # The number of units taken for the leave
29
+ attr_accessor :number_of_units_taken
30
+
31
+ # The type of units paid for the leave
32
+ attr_accessor :type_of_units
33
+
34
+ # The type of units taken for the leave
35
+ attr_accessor :type_of_units_taken
36
+
37
+ # Status of leave
29
38
  attr_accessor :period_status
30
39
  APPROVED ||= "Approved".freeze
31
40
  COMPLETED ||= "Completed".freeze
41
+ ESTIMATED ||= "Estimated".freeze
32
42
 
33
43
  class EnumAttributeValidator
34
44
  attr_reader :datatype
@@ -58,6 +68,9 @@ module XeroRuby::PayrollNz
58
68
  :'period_start_date' => :'periodStartDate',
59
69
  :'period_end_date' => :'periodEndDate',
60
70
  :'number_of_units' => :'numberOfUnits',
71
+ :'number_of_units_taken' => :'numberOfUnitsTaken',
72
+ :'type_of_units' => :'typeOfUnits',
73
+ :'type_of_units_taken' => :'typeOfUnitsTaken',
61
74
  :'period_status' => :'periodStatus'
62
75
  }
63
76
  end
@@ -68,6 +81,9 @@ module XeroRuby::PayrollNz
68
81
  :'period_start_date' => :'Date',
69
82
  :'period_end_date' => :'Date',
70
83
  :'number_of_units' => :'BigDecimal',
84
+ :'number_of_units_taken' => :'Float',
85
+ :'type_of_units' => :'String',
86
+ :'type_of_units_taken' => :'String',
71
87
  :'period_status' => :'String'
72
88
  }
73
89
  end
@@ -99,6 +115,18 @@ module XeroRuby::PayrollNz
99
115
  self.number_of_units = attributes[:'number_of_units']
100
116
  end
101
117
 
118
+ if attributes.key?(:'number_of_units_taken')
119
+ self.number_of_units_taken = attributes[:'number_of_units_taken']
120
+ end
121
+
122
+ if attributes.key?(:'type_of_units')
123
+ self.type_of_units = attributes[:'type_of_units']
124
+ end
125
+
126
+ if attributes.key?(:'type_of_units_taken')
127
+ self.type_of_units_taken = attributes[:'type_of_units_taken']
128
+ end
129
+
102
130
  if attributes.key?(:'period_status')
103
131
  self.period_status = attributes[:'period_status']
104
132
  end
@@ -114,7 +142,7 @@ module XeroRuby::PayrollNz
114
142
  # Check to see if the all the properties in the model are valid
115
143
  # @return true if the model is valid
116
144
  def valid?
117
- period_status_validator = EnumAttributeValidator.new('String', ["Approved", "Completed"])
145
+ period_status_validator = EnumAttributeValidator.new('String', ["Approved", "Completed", "Estimated"])
118
146
  return false unless period_status_validator.valid?(@period_status)
119
147
  true
120
148
  end
@@ -122,7 +150,7 @@ module XeroRuby::PayrollNz
122
150
  # Custom attribute writer method checking allowed values (enum).
123
151
  # @param [Object] period_status Object to be assigned
124
152
  def period_status=(period_status)
125
- validator = EnumAttributeValidator.new('String', ["Approved", "Completed"])
153
+ validator = EnumAttributeValidator.new('String', ["Approved", "Completed", "Estimated"])
126
154
  unless validator.valid?(period_status)
127
155
  fail ArgumentError, "invalid value for \"period_status\", must be one of #{validator.allowable_values}."
128
156
  end
@@ -137,6 +165,9 @@ module XeroRuby::PayrollNz
137
165
  period_start_date == o.period_start_date &&
138
166
  period_end_date == o.period_end_date &&
139
167
  number_of_units == o.number_of_units &&
168
+ number_of_units_taken == o.number_of_units_taken &&
169
+ type_of_units == o.type_of_units &&
170
+ type_of_units_taken == o.type_of_units_taken &&
140
171
  period_status == o.period_status
141
172
  end
142
173
 
@@ -149,7 +180,7 @@ module XeroRuby::PayrollNz
149
180
  # Calculates hash code according to all attributes.
150
181
  # @return [Integer] Hash code
151
182
  def hash
152
- [period_start_date, period_end_date, number_of_units, period_status].hash
183
+ [period_start_date, period_end_date, number_of_units, number_of_units_taken, type_of_units, type_of_units_taken, period_status].hash
153
184
  end
154
185
 
155
186
  # Builds the object from hash