createEmployment
-Creates an employment detail for a specific employee
+createEmployeeWorkingPattern
+Creates an employee working pattern
createEmployment
-
/Employees/{EmployeeID}/Employment
+ /Employees/{EmployeeID}/Working-Patterns
Usage and SDK Samples
xero_client.set_token_set(user.token_set)
xero_tenant_id = 'xeroTenantId_example'
employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c'
idempotency_key = 'KEY_VALUE'
-start_date = 'YYYY-MM-DD'
-
-employment = {
- payroll_calendar_id: "00000000-0000-0000-0000-000000000000",
- start_date: start_date
+effective_from = 'YYYY-MM-DD'
+
+workingWeek = {
+ monday: 8,
+ tuesday: 8,
+ wednesday: 8,
+ thursday: 8,
+ friday: 8,
+ saturday: 0,
+ sunday: 0
}
begin
- response = xero_client.accounting_api.create_employment(xero_tenant_id, employee_id, employment, idempotency_key)
+ response = xero_client.accounting_api.create_employee_working_pattern(xero_tenant_id, employee_id, employeeWorkingPatternWithWorkingWeeksRequest, idempotency_key)
return response
rescue XeroRuby::ApiError => e
- puts "Exception when calling create_employment: #{e}"
+ puts "Exception when calling create_employee_working_pattern: #{e}"
end
Parameters
Parameters
Parameters
Parameters
Parameters
"content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/Employment" + "$ref" : "#/components/schemas/EmployeeWorkingPatternWithWorkingWeeksRequest" }, - "example" : "{ \"payrollCalendarID\": \"9aa56064-990f-4ad3-a189-d966d8f6a030\", \"startDate\": \"2020-09-02\" }" + "example" : "{ \"effectiveFrom\": \"2020-01-01T00:00:00\", \"workingWeeks\": [ { \"monday\": 0.0, \"tuesday\": 3.0000, \"wednesday\": 0.0, \"thursday\": 0.0, \"friday\": 0.0, \"saturday\": 0.0, \"sunday\": 0.0 } ] }" } }, "required" : true @@ -6064,11 +6277,11 @@Parameters
-
createLeaveType
-Creates a new leave type
+createEmployment
+Creates an employment detail for a specific employee
createLeaveType
-
/LeaveTypes
+ /Employees/{EmployeeID}/Employment
Usage and SDK Samples
xero_client.set_token_set(user.token_set)
xero_tenant_id = 'xeroTenantId_example'
+employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c'
idempotency_key = 'KEY_VALUE'
+start_date = 'YYYY-MM-DD'
-leave_type = {
- name: "LeaveType",
- is_paid_leave: true,
- show_on_payslip: true
+employment = {
+ payroll_calendar_id: "00000000-0000-0000-0000-000000000000",
+ start_date: start_date,
+ engagement_type: "",
+ fixed_term_end_date:
}
begin
- response = xero_client.accounting_api.create_leave_type(xero_tenant_id, leaveType, idempotency_key)
+ response = xero_client.accounting_api.create_employment(xero_tenant_id, employee_id, employment, idempotency_key)
return response
rescue XeroRuby::ApiError => e
- puts "Exception when calling create_leave_type: #{e}"
+ puts "Exception when calling create_employment: #{e}"
end
Scopes
payroll.settings | -Grant read-write access to payroll settings | +payroll.employees | +Grant read-write access to payroll employees |
Parameters
+Name | +Description | +
---|---|
EmployeeID* | +
+
+
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+
+Employee id for single object
+
+
+ Required
+
+ |
+
-
+
@@ -6150,7 +6399,7 @@ Parameters
- |
+
@@ -6174,12 +6423,12 @@ ParametersDescription |
| ||||||||||||
leaveType * | +employment * |
- LeaveType
+ Employment
@@ -6194,9 +6443,9 @@
Parameters"content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/LeaveType" + "$ref" : "#/components/schemas/Employment" }, - "example" : "{ \"name\": \"My wqwhhiktun Leave\", \"isPaidLeave\": false, \"showOnPayslip\": true }" + "example" : "{ \"payrollCalendarID\": \"9aa56064-990f-4ad3-a189-d966d8f6a030\", \"startDate\": \"2020-09-02\", \"engagementType\": \"FixedTerm\", \"fixedTermEndDate\": \"2026-01-01\" }" } }, "required" : true @@ -6206,11 +6455,11 @@Parameters-
-
+
-
@@ -6218,34 +6467,176 @@ createMultipleEmployeeEarningsTemplate-Creates multiple employee earnings template records for a specific employee +createLeaveType+Creates a new leave type createMultipleEmployeeEarningsTemplate-
+
Usage and SDK Samples
-
+
+
+
+ Scopes+
Parameters+Header parameters
+
Body parameters
+
+
+
+
+
+
+
+
+
+
+ createMultipleEmployeeEarningsTemplate+Creates multiple employee earnings template records for a specific employee ++
+ + Usage and SDK Samples+ + +
+
+
+
+
+
+ Required
+
+ |
+
Name | +Description | +
---|---|
Xero-Tenant-Id* | +
+
+
+
+
+
+
+
+
+ String
+
+
+
+
+Xero identifier for Tenant
+
+
+ Required
+
+ |
+
+
deleteEmployeeSalaryAndWage
+Deletes an employee's salary and wages record
++
/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}
+ +
Usage and SDK Samples
+ + +xero_client.set_token_set(user.token_set)
+
+xero_tenant_id = 'xeroTenantId_example'
+employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c'
+salary_and_wages_id = '3fa85f64-5717-4562-b3fc-2c963f66afa6'
+
+begin
+ response = xero_client.accounting_api.delete_employee_salary_and_wage(xero_tenant_id, employee_id, salary_and_wages_id)
+ return response
+rescue XeroRuby::ApiError => e
+ puts "Exception when calling delete_employee_salary_and_wage: #{e}"
+end
+
+ Scopes
+payroll.employees | +Grant read-write access to payroll employees | +
Parameters
+Name | +Description | +||
---|---|---|---|
EmployeeID* | +
+
+
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+
+Employee id for single object
+
+
+ Required
+
+ |
+||
SalaryAndWagesID* | +
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+Id for single salary and wages object
@@ -7542,7 +8073,7 @@ Parameters
- |
+
@@ -7565,11 +8096,11 @@
Parameters-
-
+
-
@@ -7577,28 +8108,28 @@ deleteEmployeeSalaryAndWage-Deletes an employee's salary and wages record +deleteEmployeeWorkingPattern+deletes employee's working patterns deleteEmployeeSalaryAndWage-
+
Usage and SDK Samples
-
+
Parameters
- |
+
@@ -7645,11 +8176,11 @@ Parameters |
SalaryAndWagesID* | +|||
EmployeeWorkingPatternID* |
-
+
@@ -7660,7 +8191,7 @@
Parameters
-Id for single salary and wages object
+Employee working pattern id for single object
@@ -7682,7 +8213,7 @@ Parameters
- |
+
+
@@ -9075,7 +9606,7 @@
getEmployeeOpeningBalances-
+
Usage and SDK Samples@@ -9820,6 +10351,269 @@Parameters |
+
getEmployeeWorkingPattern
+Retrieves employee's working patterns
++
/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}
+ +
Usage and SDK Samples
+ + +xero_client.set_token_set(user.token_set)
+
+xero_tenant_id = 'xeroTenantId_example'
+employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c'
+employee_working_pattern_id = '4ff1e5cc-9835-40d5-bb18-09f3b118db9c'
+
+begin
+ response = xero_client.accounting_api.get_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_id)
+ return response
+rescue XeroRuby::ApiError => e
+ puts "Exception when calling get_employee_working_pattern: #{e}"
+end
+
+ Scopes
+payroll.employees | +Grant read-write access to payroll employees | +
payroll.employees.read | +Grant read-only access to payroll employees | +
Parameters
+Name | +Description | +
---|---|
EmployeeID* | +
+
+
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+
+Employee id for single object
+
+
+ Required
+
+ |
+
EmployeeWorkingPatternID* | +
+
+
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+
+Employee working pattern id for single object
+
+
+ Required
+
+ |
+
Name | +Description | +
---|---|
Xero-Tenant-Id* | +
+
+
+
+
+
+
+
+
+ String
+
+
+
+
+Xero identifier for Tenant
+
+
+ Required
+
+ |
+
+
getEmployeeWorkingPatterns
+Retrieves employee's working patterns
++
/Employees/{EmployeeID}/Working-Patterns
+ +
Usage and SDK Samples
+ + +xero_client.set_token_set(user.token_set)
+
+xero_tenant_id = 'xeroTenantId_example'
+employee_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c'
+
+begin
+ response = xero_client.accounting_api.get_employee_working_patterns(xero_tenant_id, employee_id)
+ return response
+rescue XeroRuby::ApiError => e
+ puts "Exception when calling get_employee_working_patterns: #{e}"
+end
+
+ Scopes
+payroll.employees | +Grant read-write access to payroll employees | +
payroll.employees.read | +Grant read-only access to payroll employees | +
Parameters
+Name | +Description | +
---|---|
EmployeeID* | +
+
+
+
+
+
+
+
+
+ UUID
+
+
+ (uuid)
+
+
+
+
+Employee id for single object
+
+
+ Required
+
+ |
+
Name | +Description | +
---|---|
Xero-Tenant-Id* | +
+
+
+
+
+
+
+
+
+ String
+
+
+
+
+Xero identifier for Tenant
+
+
+ Required
+
+ |
updateEmployeeEarningsTemplate
-
/Employees/{EmployeeID}/PayTemplates/earnings/{PayTemplateEarningID}
+ /Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}
Usage and SDK Samples
diff --git a/docs/payroll_uk/index.html b/docs/payroll_uk/index.html index 79450073..b46359ce 100644 --- a/docs/payroll_uk/index.html +++ b/docs/payroll_uk/index.html @@ -3510,7 +3510,7 @@-
approveTimesheet
diff --git a/docs/projects/index.html b/docs/projects/index.html
index 2faffbf2..e13239d5 100644
--- a/docs/projects/index.html
+++ b/docs/projects/index.html
@@ -1462,7 +1462,7 @@
-
createProject
diff --git a/lib/xero-ruby.rb b/lib/xero-ruby.rb
index 8471a9a1..c133fa84 100644
--- a/lib/xero-ruby.rb
+++ b/lib/xero-ruby.rb
@@ -218,6 +218,11 @@
require 'xero-ruby/models/payroll_nz/employee_statutory_sick_leaves'
require 'xero-ruby/models/payroll_nz/employee_tax'
require 'xero-ruby/models/payroll_nz/employee_tax_object'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request'
+require 'xero-ruby/models/payroll_nz/employee_working_patterns_object'
require 'xero-ruby/models/payroll_nz/employees'
require 'xero-ruby/models/payroll_nz/employment'
require 'xero-ruby/models/payroll_nz/employment_object'
@@ -271,6 +276,7 @@
require 'xero-ruby/models/payroll_nz/timesheets'
require 'xero-ruby/models/payroll_nz/tracking_categories'
require 'xero-ruby/models/payroll_nz/tracking_category'
+require 'xero-ruby/models/payroll_nz/working_week'
require 'xero-ruby/models/payroll_au/api_exception'
require 'xero-ruby/models/payroll_au/account'
require 'xero-ruby/models/payroll_au/account_type'
diff --git a/lib/xero-ruby/api/payroll_nz_api.rb b/lib/xero-ruby/api/payroll_nz_api.rb
index c31f0be0..0c5adeaf 100644
--- a/lib/xero-ruby/api/payroll_nz_api.rb
+++ b/lib/xero-ruby/api/payroll_nz_api.rb
@@ -371,7 +371,7 @@ def create_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.create_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -543,7 +543,7 @@ def create_employee_leave_setup_with_http_info(xero_tenant_id, employee_id, empl
fail ArgumentError, "Missing the required parameter 'employee_leave_setup' when calling PayrollNzApi.create_employee_leave_setup"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/leaveSetup'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/LeaveSetup'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -715,7 +715,7 @@ def create_employee_opening_balances_with_http_info(xero_tenant_id, employee_id,
fail ArgumentError, "Missing the required parameter 'employee_opening_balance' when calling PayrollNzApi.create_employee_opening_balances"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/openingBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/OpeningBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -936,6 +936,92 @@ def create_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id,
return data, status_code, headers
end
+ # Creates an employee working pattern
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_with_working_weeks_request [EmployeeWorkingPatternWithWorkingWeeksRequest]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
+ # @return [EmployeeWorkingPatternWithWorkingWeeksObject]
+ def create_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, opts = {})
+ data, _status_code, _headers = create_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, opts)
+ data
+ end
+
+ # Creates an employee working pattern
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_with_working_weeks_request [EmployeeWorkingPatternWithWorkingWeeksRequest]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
+ # @return [Array<(EmployeeWorkingPatternWithWorkingWeeksObject, Integer, Hash)>] EmployeeWorkingPatternWithWorkingWeeksObject data, response status code and response headers
+ def create_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.create_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_with_working_weeks_request' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_with_working_weeks_request.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_with_working_weeks_request' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(employee_working_pattern_with_working_weeks_request)
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternWithWorkingWeeksObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#create_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Creates an employment detail for a specific employee
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param employee_id [String] Employee id for single object
@@ -1139,7 +1225,7 @@ def create_multiple_employee_earnings_template_with_http_info(xero_tenant_id, em
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.create_multiple_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/paytemplateearnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplateEarnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -1709,7 +1795,7 @@ def delete_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'pay_template_earning_id' when calling PayrollNzApi.delete_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -1917,6 +2003,87 @@ def delete_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id,
return data, status_code, headers
end
+ # deletes employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeLeaveObject]
+ def delete_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_id, opts = {})
+ data, _status_code, _headers = delete_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, opts)
+ data
+ end
+
+ # deletes employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeLeaveObject, Integer, Hash)>] EmployeeLeaveObject data, response status code and response headers
+ def delete_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.delete_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_id' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'EmployeeWorkingPatternID' + '}', employee_working_pattern_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeLeaveObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#delete_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Deletes a timesheet
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param timesheet_id [String] Identifier for the timesheet
@@ -2777,7 +2944,7 @@ def get_employee_opening_balances_with_http_info(xero_tenant_id, employee_id, op
fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_opening_balances"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/openingBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/OpeningBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -3207,6 +3374,162 @@ def get_employee_tax_with_http_info(xero_tenant_id, employee_id, options = {})
return data, status_code, headers
end
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeWorkingPatternWithWorkingWeeksObject]
+ def get_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_id, opts = {})
+ data, _status_code, _headers = get_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, opts)
+ data
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeWorkingPatternWithWorkingWeeksObject, Integer, Hash)>] EmployeeWorkingPatternWithWorkingWeeksObject data, response status code and response headers
+ def get_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.get_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_id' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'EmployeeWorkingPatternID' + '}', employee_working_pattern_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternWithWorkingWeeksObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#get_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeWorkingPatternsObject]
+ def get_employee_working_patterns(xero_tenant_id, employee_id, opts = {})
+ data, _status_code, _headers = get_employee_working_patterns_with_http_info(xero_tenant_id, employee_id, opts)
+ data
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeWorkingPatternsObject, Integer, Hash)>] EmployeeWorkingPatternsObject data, response status code and response headers
+ def get_employee_working_patterns_with_http_info(xero_tenant_id, employee_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.get_employee_working_patterns ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.get_employee_working_patterns"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_working_patterns"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternsObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#get_employee_working_patterns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Retrieves employees
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param [Hash] opts the optional parameters
@@ -4835,7 +5158,7 @@ def update_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.update_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
diff --git a/lib/xero-ruby/models/accounting/bank_transactions.rb b/lib/xero-ruby/models/accounting/bank_transactions.rb
index c344d3e6..65826849 100644
--- a/lib/xero-ruby/models/accounting/bank_transactions.rb
+++ b/lib/xero-ruby/models/accounting/bank_transactions.rb
@@ -19,6 +19,9 @@ class BankTransactions
attr_accessor :pagination
+ # Displays array of warning messages from the API
+ attr_accessor :warnings
+
attr_accessor :bank_transactions
@@ -26,6 +29,7 @@ class BankTransactions
def self.attribute_map
{
:'pagination' => :'pagination',
+ :'warnings' => :'Warnings',
:'bank_transactions' => :'BankTransactions'
}
end
@@ -34,6 +38,7 @@ def self.attribute_map
def self.openapi_types
{
:'pagination' => :'Pagination',
+ :'warnings' => :'Array
', :'bank_transactions' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'bank_transactions') if (value = attributes[:'bank_transactions']).is_a?(Array) self.bank_transactions = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && bank_transactions == o.bank_transactions end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, bank_transactions].hash + [pagination, warnings, bank_transactions].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/contacts.rb b/lib/xero-ruby/models/accounting/contacts.rb index 36de103c..5ec55080 100644 --- a/lib/xero-ruby/models/accounting/contacts.rb +++ b/lib/xero-ruby/models/accounting/contacts.rb @@ -19,6 +19,9 @@ class Contacts attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :contacts @@ -26,6 +29,7 @@ class Contacts def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'contacts' => :'Contacts' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'contacts' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'contacts') if (value = attributes[:'contacts']).is_a?(Array) self.contacts = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && contacts == o.contacts end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, contacts].hash + [pagination, warnings, contacts].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/credit_notes.rb b/lib/xero-ruby/models/accounting/credit_notes.rb index 0a19549d..8134e3f4 100644 --- a/lib/xero-ruby/models/accounting/credit_notes.rb +++ b/lib/xero-ruby/models/accounting/credit_notes.rb @@ -19,6 +19,9 @@ class CreditNotes attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :credit_notes @@ -26,6 +29,7 @@ class CreditNotes def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'credit_notes' => :'CreditNotes' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'credit_notes' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'credit_notes') if (value = attributes[:'credit_notes']).is_a?(Array) self.credit_notes = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && credit_notes == o.credit_notes end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, credit_notes].hash + [pagination, warnings, credit_notes].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/invoices.rb b/lib/xero-ruby/models/accounting/invoices.rb index dac9cfeb..11c59b3b 100644 --- a/lib/xero-ruby/models/accounting/invoices.rb +++ b/lib/xero-ruby/models/accounting/invoices.rb @@ -19,6 +19,9 @@ class Invoices attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :invoices @@ -26,6 +29,7 @@ class Invoices def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'invoices' => :'Invoices' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'invoices' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'invoices') if (value = attributes[:'invoices']).is_a?(Array) self.invoices = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && invoices == o.invoices end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, invoices].hash + [pagination, warnings, invoices].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/journals.rb b/lib/xero-ruby/models/accounting/journals.rb index 93796fa3..f4ca1b6a 100644 --- a/lib/xero-ruby/models/accounting/journals.rb +++ b/lib/xero-ruby/models/accounting/journals.rb @@ -16,12 +16,16 @@ module XeroRuby::Accounting require 'bigdecimal' class Journals + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :journals # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'warnings' => :'Warnings', :'journals' => :'Journals' } end @@ -29,6 +33,7 @@ def self.attribute_map # Attribute type mapping. def self.openapi_types { + :'warnings' => :'Array ', :'journals' => :'Array ' } end @@ -48,6 +53,12 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'journals') if (value = attributes[:'journals']).is_a?(Array) self.journals = value @@ -73,6 +84,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + warnings == o.warnings && journals == o.journals end @@ -85,7 +97,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [journals].hash + [warnings, journals].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/manual_journals.rb b/lib/xero-ruby/models/accounting/manual_journals.rb index 620a4901..998312b3 100644 --- a/lib/xero-ruby/models/accounting/manual_journals.rb +++ b/lib/xero-ruby/models/accounting/manual_journals.rb @@ -19,6 +19,9 @@ class ManualJournals attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :manual_journals @@ -26,6 +29,7 @@ class ManualJournals def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'manual_journals' => :'ManualJournals' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'manual_journals' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'manual_journals') if (value = attributes[:'manual_journals']).is_a?(Array) self.manual_journals = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && manual_journals == o.manual_journals end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, manual_journals].hash + [pagination, warnings, manual_journals].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/overpayments.rb b/lib/xero-ruby/models/accounting/overpayments.rb index 53ddca92..98314874 100644 --- a/lib/xero-ruby/models/accounting/overpayments.rb +++ b/lib/xero-ruby/models/accounting/overpayments.rb @@ -19,6 +19,9 @@ class Overpayments attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :overpayments @@ -26,6 +29,7 @@ class Overpayments def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'overpayments' => :'Overpayments' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'overpayments' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'overpayments') if (value = attributes[:'overpayments']).is_a?(Array) self.overpayments = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && overpayments == o.overpayments end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, overpayments].hash + [pagination, warnings, overpayments].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/payments.rb b/lib/xero-ruby/models/accounting/payments.rb index 51ddedc5..ce10c6c3 100644 --- a/lib/xero-ruby/models/accounting/payments.rb +++ b/lib/xero-ruby/models/accounting/payments.rb @@ -19,6 +19,9 @@ class Payments attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :payments @@ -26,6 +29,7 @@ class Payments def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'payments' => :'Payments' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'payments' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'payments') if (value = attributes[:'payments']).is_a?(Array) self.payments = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && payments == o.payments end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, payments].hash + [pagination, warnings, payments].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/prepayments.rb b/lib/xero-ruby/models/accounting/prepayments.rb index 224b80b5..3dfe384b 100644 --- a/lib/xero-ruby/models/accounting/prepayments.rb +++ b/lib/xero-ruby/models/accounting/prepayments.rb @@ -19,6 +19,9 @@ class Prepayments attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :prepayments @@ -26,6 +29,7 @@ class Prepayments def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'prepayments' => :'Prepayments' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'prepayments' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'prepayments') if (value = attributes[:'prepayments']).is_a?(Array) self.prepayments = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && prepayments == o.prepayments end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, prepayments].hash + [pagination, warnings, prepayments].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/accounting/purchase_orders.rb b/lib/xero-ruby/models/accounting/purchase_orders.rb index bf288bfc..b4d8f8ec 100644 --- a/lib/xero-ruby/models/accounting/purchase_orders.rb +++ b/lib/xero-ruby/models/accounting/purchase_orders.rb @@ -19,6 +19,9 @@ class PurchaseOrders attr_accessor :pagination + # Displays array of warning messages from the API + attr_accessor :warnings + attr_accessor :purchase_orders @@ -26,6 +29,7 @@ class PurchaseOrders def self.attribute_map { :'pagination' => :'pagination', + :'warnings' => :'Warnings', :'purchase_orders' => :'PurchaseOrders' } end @@ -34,6 +38,7 @@ def self.attribute_map def self.openapi_types { :'pagination' => :'Pagination', + :'warnings' => :'Array ', :'purchase_orders' => :'Array ' } end @@ -57,6 +62,12 @@ def initialize(attributes = {}) self.pagination = attributes[:'pagination'] end + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + if attributes.key?(:'purchase_orders') if (value = attributes[:'purchase_orders']).is_a?(Array) self.purchase_orders = value @@ -83,6 +94,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && pagination == o.pagination && + warnings == o.warnings && purchase_orders == o.purchase_orders end @@ -95,7 +107,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [pagination, purchase_orders].hash + [pagination, warnings, purchase_orders].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/employee.rb b/lib/xero-ruby/models/payroll_nz/employee.rb index 5df4bf94..301462e6 100644 --- a/lib/xero-ruby/models/payroll_nz/employee.rb +++ b/lib/xero-ruby/models/payroll_nz/employee.rb @@ -63,6 +63,12 @@ class Employee # Employee's job title attr_accessor :job_title + # Engagement type of the employee + attr_accessor :engagement_type + + # End date for an employee with a fixed-term engagement type + attr_accessor :fixed_term_end_date + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -102,7 +108,9 @@ def self.attribute_map :'payroll_calendar_id' => :'payrollCalendarID', :'updated_date_utc' => :'updatedDateUTC', :'created_date_utc' => :'createdDateUTC', - :'job_title' => :'jobTitle' + :'job_title' => :'jobTitle', + :'engagement_type' => :'engagementType', + :'fixed_term_end_date' => :'fixedTermEndDate' } end @@ -123,7 +131,9 @@ def self.openapi_types :'payroll_calendar_id' => :'String', :'updated_date_utc' => :'DateTime', :'created_date_utc' => :'DateTime', - :'job_title' => :'String' + :'job_title' => :'String', + :'engagement_type' => :'String', + :'fixed_term_end_date' => :'Date' } end @@ -201,6 +211,14 @@ def initialize(attributes = {}) if attributes.key?(:'job_title') self.job_title = attributes[:'job_title'] end + + if attributes.key?(:'engagement_type') + self.engagement_type = attributes[:'engagement_type'] + end + + if attributes.key?(:'fixed_term_end_date') + self.fixed_term_end_date = attributes[:'fixed_term_end_date'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -247,7 +265,9 @@ def ==(o) payroll_calendar_id == o.payroll_calendar_id && updated_date_utc == o.updated_date_utc && created_date_utc == o.created_date_utc && - job_title == o.job_title + job_title == o.job_title && + engagement_type == o.engagement_type && + fixed_term_end_date == o.fixed_term_end_date end # @see the `==` method @@ -259,7 +279,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [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, job_title].hash + [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, job_title, engagement_type, fixed_term_end_date].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb b/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb index 4f11d508..d6a97330 100644 --- a/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +++ b/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb @@ -37,6 +37,12 @@ class EmployeeLeaveSetup # Initial sick leave balance. This will be positive unless they've taken sick leave in advance attr_accessor :sick_leave_opening_balance + # Set Schedule of Accrual Type for Sick Leave + attr_accessor :sick_leave_schedule_of_accrual + + # If Sick Leave Schedule of Accrual is \"OnAnniversaryDate\", this is the date when entitled to Sick Leave + attr_accessor :sick_leave_anniversary_date + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -46,7 +52,9 @@ def self.attribute_map :'negative_annual_leave_balance_paid_amount' => :'negativeAnnualLeaveBalancePaidAmount', :'sick_leave_hours_to_accrue_annually' => :'sickLeaveHoursToAccrueAnnually', :'sick_leave_maximum_hours_to_accrue' => :'sickLeaveMaximumHoursToAccrue', - :'sick_leave_opening_balance' => :'sickLeaveOpeningBalance' + :'sick_leave_opening_balance' => :'sickLeaveOpeningBalance', + :'sick_leave_schedule_of_accrual' => :'SickLeaveScheduleOfAccrual', + :'sick_leave_anniversary_date' => :'SickLeaveAnniversaryDate' } end @@ -59,7 +67,9 @@ def self.openapi_types :'negative_annual_leave_balance_paid_amount' => :'BigDecimal', :'sick_leave_hours_to_accrue_annually' => :'BigDecimal', :'sick_leave_maximum_hours_to_accrue' => :'BigDecimal', - :'sick_leave_opening_balance' => :'BigDecimal' + :'sick_leave_opening_balance' => :'BigDecimal', + :'sick_leave_schedule_of_accrual' => :'String', + :'sick_leave_anniversary_date' => :'Date' } end @@ -105,6 +115,14 @@ def initialize(attributes = {}) if attributes.key?(:'sick_leave_opening_balance') self.sick_leave_opening_balance = attributes[:'sick_leave_opening_balance'] end + + if attributes.key?(:'sick_leave_schedule_of_accrual') + self.sick_leave_schedule_of_accrual = attributes[:'sick_leave_schedule_of_accrual'] + end + + if attributes.key?(:'sick_leave_anniversary_date') + self.sick_leave_anniversary_date = attributes[:'sick_leave_anniversary_date'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -131,7 +149,9 @@ def ==(o) negative_annual_leave_balance_paid_amount == o.negative_annual_leave_balance_paid_amount && sick_leave_hours_to_accrue_annually == o.sick_leave_hours_to_accrue_annually && sick_leave_maximum_hours_to_accrue == o.sick_leave_maximum_hours_to_accrue && - sick_leave_opening_balance == o.sick_leave_opening_balance + sick_leave_opening_balance == o.sick_leave_opening_balance && + sick_leave_schedule_of_accrual == o.sick_leave_schedule_of_accrual && + sick_leave_anniversary_date == o.sick_leave_anniversary_date end # @see the `==` method @@ -143,7 +163,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [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].hash + [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 end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb b/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb index ce73a60d..7b8a98cb 100644 --- a/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +++ b/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb @@ -50,6 +50,9 @@ class EmployeeLeaveType # Specific to Annual Leave. Annual leave balance in dollars attr_accessor :annual_leave_total_amount_paid + # The date when an employee becomes entitled to their accrual. + attr_accessor :schedule_of_accrual_date + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -84,7 +87,8 @@ def self.attribute_map :'percentage_of_gross_earnings' => :'percentageOfGrossEarnings', :'include_holiday_pay_every_pay' => :'includeHolidayPayEveryPay', :'show_annual_leave_in_advance' => :'showAnnualLeaveInAdvance', - :'annual_leave_total_amount_paid' => :'annualLeaveTotalAmountPaid' + :'annual_leave_total_amount_paid' => :'annualLeaveTotalAmountPaid', + :'schedule_of_accrual_date' => :'scheduleOfAccrualDate' } end @@ -100,7 +104,8 @@ def self.openapi_types :'percentage_of_gross_earnings' => :'BigDecimal', :'include_holiday_pay_every_pay' => :'Boolean', :'show_annual_leave_in_advance' => :'Boolean', - :'annual_leave_total_amount_paid' => :'BigDecimal' + :'annual_leave_total_amount_paid' => :'BigDecimal', + :'schedule_of_accrual_date' => :'Date' } end @@ -158,6 +163,10 @@ def initialize(attributes = {}) if attributes.key?(:'annual_leave_total_amount_paid') self.annual_leave_total_amount_paid = attributes[:'annual_leave_total_amount_paid'] end + + if attributes.key?(:'schedule_of_accrual_date') + self.schedule_of_accrual_date = attributes[:'schedule_of_accrual_date'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -199,7 +208,8 @@ def ==(o) percentage_of_gross_earnings == o.percentage_of_gross_earnings && include_holiday_pay_every_pay == o.include_holiday_pay_every_pay && show_annual_leave_in_advance == o.show_annual_leave_in_advance && - annual_leave_total_amount_paid == o.annual_leave_total_amount_paid + annual_leave_total_amount_paid == o.annual_leave_total_amount_paid && + schedule_of_accrual_date == o.schedule_of_accrual_date end # @see the `==` method @@ -211,7 +221,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [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].hash + [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 end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb b/lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb new file mode 100644 index 00000000..5dd5bb08 --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb @@ -0,0 +1,242 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class EmployeeWorkingPattern + # The Xero identifier for for Employee working pattern + attr_accessor :payee_working_pattern_id + + # The effective date of the corresponding salary and wages + attr_accessor :effective_from + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_working_pattern_id' => :'payeeWorkingPatternID', + :'effective_from' => :'effectiveFrom' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'payee_working_pattern_id' => :'String', + :'effective_from' => :'Date' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EmployeeWorkingPattern` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EmployeeWorkingPattern`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'payee_working_pattern_id') + self.payee_working_pattern_id = attributes[:'payee_working_pattern_id'] + end + + if attributes.key?(:'effective_from') + self.effective_from = attributes[:'effective_from'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_working_pattern_id.nil? + invalid_properties.push('invalid value for "payee_working_pattern_id", payee_working_pattern_id cannot be nil.') + end + + if @effective_from.nil? + invalid_properties.push('invalid value for "effective_from", effective_from cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payee_working_pattern_id.nil? + return false if @effective_from.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_working_pattern_id == o.payee_working_pattern_id && + effective_from == o.effective_from + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [payee_working_pattern_id, effective_from].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb new file mode 100644 index 00000000..b368cdeb --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb @@ -0,0 +1,254 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class EmployeeWorkingPatternWithWorkingWeeks + # The Xero identifier for for Employee working pattern + attr_accessor :payee_working_pattern_id + + # The effective date of the corresponding salary and wages + attr_accessor :effective_from + + + attr_accessor :working_weeks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_working_pattern_id' => :'payeeWorkingPatternID', + :'effective_from' => :'effectiveFrom', + :'working_weeks' => :'workingWeeks' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'payee_working_pattern_id' => :'String', + :'effective_from' => :'Date', + :'working_weeks' => :'Array ' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeks` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'payee_working_pattern_id') + self.payee_working_pattern_id = attributes[:'payee_working_pattern_id'] + end + + if attributes.key?(:'effective_from') + self.effective_from = attributes[:'effective_from'] + end + + if attributes.key?(:'working_weeks') + if (value = attributes[:'working_weeks']).is_a?(Array) + self.working_weeks = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_working_pattern_id.nil? + invalid_properties.push('invalid value for "payee_working_pattern_id", payee_working_pattern_id cannot be nil.') + end + + if @effective_from.nil? + invalid_properties.push('invalid value for "effective_from", effective_from cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payee_working_pattern_id.nil? + return false if @effective_from.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_working_pattern_id == o.payee_working_pattern_id && + effective_from == o.effective_from && + working_weeks == o.working_weeks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [payee_working_pattern_id, effective_from, working_weeks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb new file mode 100644 index 00000000..0c383ee6 --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb @@ -0,0 +1,242 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class EmployeeWorkingPatternWithWorkingWeeksObject + + attr_accessor :pagination + + + attr_accessor :problem + + + attr_accessor :payee_working_pattern + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pagination' => :'pagination', + :'problem' => :'problem', + :'payee_working_pattern' => :'payeeWorkingPattern' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'pagination' => :'Pagination', + :'problem' => :'Problem', + :'payee_working_pattern' => :'EmployeeWorkingPatternWithWorkingWeeks' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeksObject` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeksObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pagination') + self.pagination = attributes[:'pagination'] + end + + if attributes.key?(:'problem') + self.problem = attributes[:'problem'] + end + + if attributes.key?(:'payee_working_pattern') + self.payee_working_pattern = attributes[:'payee_working_pattern'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pagination == o.pagination && + problem == o.problem && + payee_working_pattern == o.payee_working_pattern + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pagination, problem, payee_working_pattern].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb new file mode 100644 index 00000000..a69bb708 --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb @@ -0,0 +1,244 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class EmployeeWorkingPatternWithWorkingWeeksRequest + # The effective date of the corresponding salary and wages + attr_accessor :effective_from + + + attr_accessor :working_weeks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'effective_from' => :'effectiveFrom', + :'working_weeks' => :'workingWeeks' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'effective_from' => :'Date', + :'working_weeks' => :'Array ' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeksRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EmployeeWorkingPatternWithWorkingWeeksRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'effective_from') + self.effective_from = attributes[:'effective_from'] + end + + if attributes.key?(:'working_weeks') + if (value = attributes[:'working_weeks']).is_a?(Array) + self.working_weeks = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @effective_from.nil? + invalid_properties.push('invalid value for "effective_from", effective_from cannot be nil.') + end + + if @working_weeks.nil? + invalid_properties.push('invalid value for "working_weeks", working_weeks cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @effective_from.nil? + return false if @working_weeks.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + effective_from == o.effective_from && + working_weeks == o.working_weeks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [effective_from, working_weeks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb b/lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb new file mode 100644 index 00000000..e2db1873 --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb @@ -0,0 +1,244 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class EmployeeWorkingPatternsObject + + attr_accessor :pagination + + + attr_accessor :problem + + + attr_accessor :payee_working_patterns + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pagination' => :'pagination', + :'problem' => :'problem', + :'payee_working_patterns' => :'payeeWorkingPatterns' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'pagination' => :'Pagination', + :'problem' => :'Problem', + :'payee_working_patterns' => :'Array ' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::EmployeeWorkingPatternsObject` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::EmployeeWorkingPatternsObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pagination') + self.pagination = attributes[:'pagination'] + end + + if attributes.key?(:'problem') + self.problem = attributes[:'problem'] + end + + if attributes.key?(:'payee_working_patterns') + if (value = attributes[:'payee_working_patterns']).is_a?(Array) + self.payee_working_patterns = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pagination == o.pagination && + problem == o.problem && + payee_working_patterns == o.payee_working_patterns + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pagination, problem, payee_working_patterns].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/models/payroll_nz/employment.rb b/lib/xero-ruby/models/payroll_nz/employment.rb index f0cf7fce..4440c52c 100644 --- a/lib/xero-ruby/models/payroll_nz/employment.rb +++ b/lib/xero-ruby/models/payroll_nz/employment.rb @@ -25,12 +25,20 @@ class Employment # Start date of the employment (YYYY-MM-DD) attr_accessor :start_date + # Engagement type of the employee + attr_accessor :engagement_type + + # End date for an employee with a fixed-term engagement type + attr_accessor :fixed_term_end_date + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'payroll_calendar_id' => :'payrollCalendarID', :'pay_run_calendar_id' => :'payRunCalendarID', - :'start_date' => :'startDate' + :'start_date' => :'startDate', + :'engagement_type' => :'engagementType', + :'fixed_term_end_date' => :'fixedTermEndDate' } end @@ -39,7 +47,9 @@ def self.openapi_types { :'payroll_calendar_id' => :'String', :'pay_run_calendar_id' => :'String', - :'start_date' => :'Date' + :'start_date' => :'Date', + :'engagement_type' => :'String', + :'fixed_term_end_date' => :'Date' } end @@ -69,6 +79,14 @@ def initialize(attributes = {}) if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end + + if attributes.key?(:'engagement_type') + self.engagement_type = attributes[:'engagement_type'] + end + + if attributes.key?(:'fixed_term_end_date') + self.fixed_term_end_date = attributes[:'fixed_term_end_date'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -91,7 +109,9 @@ def ==(o) self.class == o.class && payroll_calendar_id == o.payroll_calendar_id && pay_run_calendar_id == o.pay_run_calendar_id && - start_date == o.start_date + start_date == o.start_date && + engagement_type == o.engagement_type && + fixed_term_end_date == o.fixed_term_end_date end # @see the `==` method @@ -103,7 +123,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [payroll_calendar_id, pay_run_calendar_id, start_date].hash + [payroll_calendar_id, pay_run_calendar_id, start_date, engagement_type, fixed_term_end_date].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb b/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb index f38f52ee..c8765f41 100644 --- a/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +++ b/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb @@ -51,6 +51,11 @@ class SalaryAndWage SALARY ||= "Salary".freeze HOURLY ||= "Hourly".freeze + # The type of the Working Pattern of the corresponding salary and wages + attr_accessor :work_pattern_type + DAYS_AND_HOURS ||= "DaysAndHours".freeze + REGULAR_WEEK ||= "RegularWeek".freeze + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -85,7 +90,8 @@ def self.attribute_map :'effective_from' => :'effectiveFrom', :'annual_salary' => :'annualSalary', :'status' => :'status', - :'payment_type' => :'paymentType' + :'payment_type' => :'paymentType', + :'work_pattern_type' => :'workPatternType' } end @@ -101,7 +107,8 @@ def self.openapi_types :'effective_from' => :'Date', :'annual_salary' => :'BigDecimal', :'status' => :'String', - :'payment_type' => :'String' + :'payment_type' => :'String', + :'work_pattern_type' => :'String' } end @@ -159,6 +166,10 @@ def initialize(attributes = {}) if attributes.key?(:'payment_type') self.payment_type = attributes[:'payment_type'] end + + if attributes.key?(:'work_pattern_type') + self.work_pattern_type = attributes[:'work_pattern_type'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -210,6 +221,8 @@ def valid? return false if @payment_type.nil? payment_type_validator = EnumAttributeValidator.new('String', ["Salary", "Hourly"]) return false unless payment_type_validator.valid?(@payment_type) + work_pattern_type_validator = EnumAttributeValidator.new('String', ["DaysAndHours", "RegularWeek"]) + return false unless work_pattern_type_validator.valid?(@work_pattern_type) true end @@ -233,6 +246,16 @@ def payment_type=(payment_type) @payment_type = payment_type end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] work_pattern_type Object to be assigned + def work_pattern_type=(work_pattern_type) + validator = EnumAttributeValidator.new('String', ["DaysAndHours", "RegularWeek"]) + unless validator.valid?(work_pattern_type) + fail ArgumentError, "invalid value for \"work_pattern_type\", must be one of #{validator.allowable_values}." + end + @work_pattern_type = work_pattern_type + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -247,7 +270,8 @@ def ==(o) effective_from == o.effective_from && annual_salary == o.annual_salary && status == o.status && - payment_type == o.payment_type + payment_type == o.payment_type && + work_pattern_type == o.work_pattern_type end # @see the `==` method @@ -259,7 +283,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [salary_and_wages_id, earnings_rate_id, number_of_units_per_week, rate_per_unit, number_of_units_per_day, days_per_week, effective_from, annual_salary, status, payment_type].hash + [salary_and_wages_id, earnings_rate_id, number_of_units_per_week, rate_per_unit, number_of_units_per_day, days_per_week, effective_from, annual_salary, status, payment_type, work_pattern_type].hash end # Builds the object from hash diff --git a/lib/xero-ruby/models/payroll_nz/working_week.rb b/lib/xero-ruby/models/payroll_nz/working_week.rb new file mode 100644 index 00000000..52c4061e --- /dev/null +++ b/lib/xero-ruby/models/payroll_nz/working_week.rb @@ -0,0 +1,317 @@ +=begin +#Xero Payroll NZ + +#This is the Xero Payroll API for orgs in the NZ region. + +Contact: api@xero.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.3.1 + +=end + +require 'time' +require 'date' + +module XeroRuby::PayrollNz + require 'bigdecimal' + + class WorkingWeek + # The number of hours worked on a Monday + attr_accessor :monday + + # The number of hours worked on a Tuesday + attr_accessor :tuesday + + # The number of hours worked on a Wednesday + attr_accessor :wednesday + + # The number of hours worked on a Thursday + attr_accessor :thursday + + # The number of hours worked on a Friday + attr_accessor :friday + + # The number of hours worked on a Saturday + attr_accessor :saturday + + # The number of hours worked on a Sunday + attr_accessor :sunday + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'monday' => :'monday', + :'tuesday' => :'tuesday', + :'wednesday' => :'wednesday', + :'thursday' => :'thursday', + :'friday' => :'friday', + :'saturday' => :'saturday', + :'sunday' => :'sunday' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'monday' => :'BigDecimal', + :'tuesday' => :'BigDecimal', + :'wednesday' => :'BigDecimal', + :'thursday' => :'BigDecimal', + :'friday' => :'BigDecimal', + :'saturday' => :'BigDecimal', + :'sunday' => :'BigDecimal' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollNz::WorkingWeek` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::PayrollNz::WorkingWeek`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'monday') + self.monday = attributes[:'monday'] + end + + if attributes.key?(:'tuesday') + self.tuesday = attributes[:'tuesday'] + end + + if attributes.key?(:'wednesday') + self.wednesday = attributes[:'wednesday'] + end + + if attributes.key?(:'thursday') + self.thursday = attributes[:'thursday'] + end + + if attributes.key?(:'friday') + self.friday = attributes[:'friday'] + end + + if attributes.key?(:'saturday') + self.saturday = attributes[:'saturday'] + end + + if attributes.key?(:'sunday') + self.sunday = attributes[:'sunday'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @monday.nil? + invalid_properties.push('invalid value for "monday", monday cannot be nil.') + end + + if @tuesday.nil? + invalid_properties.push('invalid value for "tuesday", tuesday cannot be nil.') + end + + if @wednesday.nil? + invalid_properties.push('invalid value for "wednesday", wednesday cannot be nil.') + end + + if @thursday.nil? + invalid_properties.push('invalid value for "thursday", thursday cannot be nil.') + end + + if @friday.nil? + invalid_properties.push('invalid value for "friday", friday cannot be nil.') + end + + if @saturday.nil? + invalid_properties.push('invalid value for "saturday", saturday cannot be nil.') + end + + if @sunday.nil? + invalid_properties.push('invalid value for "sunday", sunday cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @monday.nil? + return false if @tuesday.nil? + return false if @wednesday.nil? + return false if @thursday.nil? + return false if @friday.nil? + return false if @saturday.nil? + return false if @sunday.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + monday == o.monday && + tuesday == o.tuesday && + wednesday == o.wednesday && + thursday == o.thursday && + friday == o.friday && + saturday == o.saturday && + sunday == o.sunday + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [monday, tuesday, wednesday, thursday, friday, saturday, sunday].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(parse_date(value)) + when :Date + Date.parse(parse_date(value)) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BigDecimal + BigDecimal(value.to_s) + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(? .+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(? .+?), (? .+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + XeroRuby::PayrollNz.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash(downcase: false) + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + key = downcase ? attr : param + hash[key] = _to_hash(value, downcase: downcase) + end + hash + end + + # Returns the object in the form of hash with snake_case + def to_attributes + to_hash(downcase: true) + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value, downcase: false) + if value.is_a?(Array) + value.map do |v| + v.to_hash(downcase: downcase) + end + elsif value.is_a?(Hash) + {}.tap do |hash| + value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } + end + elsif value.respond_to? :to_hash + value.to_hash(downcase: downcase) + else + value + end + end + + def parse_date(datestring) + if datestring.include?('Date') + date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// + original, date, timezone = *date_pattern.match(datestring) + date = (date.to_i / 1000) + Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s + elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD + Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s + else # handle date 'types' for small subset of payroll API's + Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s + end + end + end +end diff --git a/lib/xero-ruby/version.rb b/lib/xero-ruby/version.rb index 079a7984..599cd2eb 100644 --- a/lib/xero-ruby/version.rb +++ b/lib/xero-ruby/version.rb @@ -7,9 +7,9 @@ Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 -The version of the XeroOpenAPI document: 6.0.0 +The version of the XeroOpenAPI document: 6.1.1 =end module XeroRuby - VERSION = '9.0.0' + VERSION = '9.1.0' end
-
createProject
diff --git a/lib/xero-ruby.rb b/lib/xero-ruby.rb
index 8471a9a1..c133fa84 100644
--- a/lib/xero-ruby.rb
+++ b/lib/xero-ruby.rb
@@ -218,6 +218,11 @@
require 'xero-ruby/models/payroll_nz/employee_statutory_sick_leaves'
require 'xero-ruby/models/payroll_nz/employee_tax'
require 'xero-ruby/models/payroll_nz/employee_tax_object'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object'
+require 'xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request'
+require 'xero-ruby/models/payroll_nz/employee_working_patterns_object'
require 'xero-ruby/models/payroll_nz/employees'
require 'xero-ruby/models/payroll_nz/employment'
require 'xero-ruby/models/payroll_nz/employment_object'
@@ -271,6 +276,7 @@
require 'xero-ruby/models/payroll_nz/timesheets'
require 'xero-ruby/models/payroll_nz/tracking_categories'
require 'xero-ruby/models/payroll_nz/tracking_category'
+require 'xero-ruby/models/payroll_nz/working_week'
require 'xero-ruby/models/payroll_au/api_exception'
require 'xero-ruby/models/payroll_au/account'
require 'xero-ruby/models/payroll_au/account_type'
diff --git a/lib/xero-ruby/api/payroll_nz_api.rb b/lib/xero-ruby/api/payroll_nz_api.rb
index c31f0be0..0c5adeaf 100644
--- a/lib/xero-ruby/api/payroll_nz_api.rb
+++ b/lib/xero-ruby/api/payroll_nz_api.rb
@@ -371,7 +371,7 @@ def create_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.create_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -543,7 +543,7 @@ def create_employee_leave_setup_with_http_info(xero_tenant_id, employee_id, empl
fail ArgumentError, "Missing the required parameter 'employee_leave_setup' when calling PayrollNzApi.create_employee_leave_setup"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/leaveSetup'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/LeaveSetup'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -715,7 +715,7 @@ def create_employee_opening_balances_with_http_info(xero_tenant_id, employee_id,
fail ArgumentError, "Missing the required parameter 'employee_opening_balance' when calling PayrollNzApi.create_employee_opening_balances"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/openingBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/OpeningBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -936,6 +936,92 @@ def create_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id,
return data, status_code, headers
end
+ # Creates an employee working pattern
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_with_working_weeks_request [EmployeeWorkingPatternWithWorkingWeeksRequest]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
+ # @return [EmployeeWorkingPatternWithWorkingWeeksObject]
+ def create_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, opts = {})
+ data, _status_code, _headers = create_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, opts)
+ data
+ end
+
+ # Creates an employee working pattern
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_with_working_weeks_request [EmployeeWorkingPatternWithWorkingWeeksRequest]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
+ # @return [Array<(EmployeeWorkingPatternWithWorkingWeeksObject, Integer, Hash)>] EmployeeWorkingPatternWithWorkingWeeksObject data, response status code and response headers
+ def create_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_with_working_weeks_request, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.create_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_with_working_weeks_request' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_with_working_weeks_request.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_with_working_weeks_request' when calling PayrollNzApi.create_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body] || @api_client.object_to_http_body(employee_working_pattern_with_working_weeks_request)
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternWithWorkingWeeksObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#create_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Creates an employment detail for a specific employee
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param employee_id [String] Employee id for single object
@@ -1139,7 +1225,7 @@ def create_multiple_employee_earnings_template_with_http_info(xero_tenant_id, em
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.create_multiple_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/paytemplateearnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplateEarnings'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -1709,7 +1795,7 @@ def delete_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'pay_template_earning_id' when calling PayrollNzApi.delete_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -1917,6 +2003,87 @@ def delete_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id,
return data, status_code, headers
end
+ # deletes employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeLeaveObject]
+ def delete_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_id, opts = {})
+ data, _status_code, _headers = delete_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, opts)
+ data
+ end
+
+ # deletes employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeLeaveObject, Integer, Hash)>] EmployeeLeaveObject data, response status code and response headers
+ def delete_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.delete_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_id' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_id' when calling PayrollNzApi.delete_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'EmployeeWorkingPatternID' + '}', employee_working_pattern_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeLeaveObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#delete_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Deletes a timesheet
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param timesheet_id [String] Identifier for the timesheet
@@ -2777,7 +2944,7 @@ def get_employee_opening_balances_with_http_info(xero_tenant_id, employee_id, op
fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_opening_balances"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/openingBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/OpeningBalances'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
@@ -3207,6 +3374,162 @@ def get_employee_tax_with_http_info(xero_tenant_id, employee_id, options = {})
return data, status_code, headers
end
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeWorkingPatternWithWorkingWeeksObject]
+ def get_employee_working_pattern(xero_tenant_id, employee_id, employee_working_pattern_id, opts = {})
+ data, _status_code, _headers = get_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, opts)
+ data
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param employee_working_pattern_id [String] Employee working pattern id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeWorkingPatternWithWorkingWeeksObject, Integer, Hash)>] EmployeeWorkingPatternWithWorkingWeeksObject data, response status code and response headers
+ def get_employee_working_pattern_with_http_info(xero_tenant_id, employee_id, employee_working_pattern_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.get_employee_working_pattern ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # verify the required parameter 'employee_working_pattern_id' is set
+ if @api_client.config.client_side_validation && employee_working_pattern_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_working_pattern_id' when calling PayrollNzApi.get_employee_working_pattern"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'EmployeeWorkingPatternID' + '}', employee_working_pattern_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternWithWorkingWeeksObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#get_employee_working_pattern\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [EmployeeWorkingPatternsObject]
+ def get_employee_working_patterns(xero_tenant_id, employee_id, opts = {})
+ data, _status_code, _headers = get_employee_working_patterns_with_http_info(xero_tenant_id, employee_id, opts)
+ data
+ end
+
+ # Retrieves employee's working patterns
+ # @param xero_tenant_id [String] Xero identifier for Tenant
+ # @param employee_id [String] Employee id for single object
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(EmployeeWorkingPatternsObject, Integer, Hash)>] EmployeeWorkingPatternsObject data, response status code and response headers
+ def get_employee_working_patterns_with_http_info(xero_tenant_id, employee_id, options = {})
+ opts = options.dup
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: PayrollNzApi.get_employee_working_patterns ...'
+ end
+ # verify the required parameter 'xero_tenant_id' is set
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.get_employee_working_patterns"
+ end
+ # verify the required parameter 'employee_id' is set
+ if @api_client.config.client_side_validation && employee_id.nil?
+ fail ArgumentError, "Missing the required parameter 'employee_id' when calling PayrollNzApi.get_employee_working_patterns"
+ end
+ # resource path
+ local_var_path = '/Employees/{EmployeeID}/Working-Patterns'.sub('{' + 'EmployeeID' + '}', employee_id.to_s)
+
+ # camelize keys of incoming `where` opts
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:body]
+
+ # return_type
+ return_type = opts[:return_type] || 'EmployeeWorkingPatternsObject'
+
+ # auth_names
+ auth_names = opts[:auth_names] || ['OAuth2']
+
+ new_options = opts.merge(
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollNzApi", new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: PayrollNzApi#get_employee_working_patterns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Retrieves employees
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param [Hash] opts the optional parameters
@@ -4835,7 +5158,7 @@ def update_employee_earnings_template_with_http_info(xero_tenant_id, employee_id
fail ArgumentError, "Missing the required parameter 'earnings_template' when calling PayrollNzApi.update_employee_earnings_template"
end
# resource path
- local_var_path = '/Employees/{EmployeeID}/PayTemplates/earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
+ local_var_path = '/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'PayTemplateEarningID' + '}', pay_template_earning_id.to_s)
# camelize keys of incoming `where` opts
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
diff --git a/lib/xero-ruby/models/accounting/bank_transactions.rb b/lib/xero-ruby/models/accounting/bank_transactions.rb
index c344d3e6..65826849 100644
--- a/lib/xero-ruby/models/accounting/bank_transactions.rb
+++ b/lib/xero-ruby/models/accounting/bank_transactions.rb
@@ -19,6 +19,9 @@ class BankTransactions
attr_accessor :pagination
+ # Displays array of warning messages from the API
+ attr_accessor :warnings
+
attr_accessor :bank_transactions
@@ -26,6 +29,7 @@ class BankTransactions
def self.attribute_map
{
:'pagination' => :'pagination',
+ :'warnings' => :'Warnings',
:'bank_transactions' => :'BankTransactions'
}
end
@@ -34,6 +38,7 @@ def self.attribute_map
def self.openapi_types
{
:'pagination' => :'Pagination',
+ :'warnings' => :'Array