Class: XeroRuby::PayrollAu::Employee
- Inherits:
-
Object
- Object
- XeroRuby::PayrollAu::Employee
- Defined in:
- lib/xero-ruby/models/payroll_au/employee.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#bank_accounts ⇒ Object
Returns the value of attribute bank_accounts.
-
#classification ⇒ Object
Employees classification.
-
#country_of_residence ⇒ Object
Returns the value of attribute country_of_residence.
-
#date_of_birth ⇒ Object
Date of birth of the employee (YYYY-MM-DD).
-
#email ⇒ Object
The email address for the employee.
-
#employee_group_name ⇒ Object
The Employee Group allows you to report on payroll expenses and liabilities for each group of employees.
-
#employee_id ⇒ Object
Xero unique identifier for an Employee.
-
#employment_type ⇒ Object
Returns the value of attribute employment_type.
-
#first_name ⇒ Object
First name of employee.
-
#gender ⇒ Object
The employee’s gender.
-
#home_address ⇒ Object
Returns the value of attribute home_address.
-
#income_type ⇒ Object
Returns the value of attribute income_type.
-
#is_authorised_to_approve_leave ⇒ Object
Authorised to approve other employees’ leave requests.
-
#is_authorised_to_approve_timesheets ⇒ Object
Authorised to approve timesheets.
-
#is_stp2_qualified ⇒ Object
Indicates if the employee has been updated for STP Phase 2 compliance.
-
#job_title ⇒ Object
JobTitle of the employee.
-
#last_name ⇒ Object
Last name of employee.
-
#leave_balances ⇒ Object
Returns the value of attribute leave_balances.
-
#leave_lines ⇒ Object
Returns the value of attribute leave_lines.
-
#middle_names ⇒ Object
Middle name(s) of the employee.
-
#mobile ⇒ Object
Employee mobile number.
-
#opening_balances ⇒ Object
Returns the value of attribute opening_balances.
-
#ordinary_earnings_rate_id ⇒ Object
Xero unique identifier for earnings rate.
-
#pay_template ⇒ Object
Returns the value of attribute pay_template.
-
#payroll_calendar_id ⇒ Object
Xero unique identifier for payroll calendar for the employee.
-
#phone ⇒ Object
Employee phone number.
-
#start_date ⇒ Object
Start date for an employee (YYYY-MM-DD).
-
#status ⇒ Object
Returns the value of attribute status.
-
#super_memberships ⇒ Object
Returns the value of attribute super_memberships.
-
#tax_declaration ⇒ Object
Returns the value of attribute tax_declaration.
-
#termination_date ⇒ Object
Employee Termination Date (YYYY-MM-DD).
-
#termination_reason ⇒ Object
-
‘V` Voluntary cessation - An employee resignation, retirement, domestic or pressing necessity or abandonment of employment * `I` Ill health - An employee resignation due to medical condition that prevents the continuation of employment, such as for illness, ill-health, medical unfitness or total permanent disability * `D` Deceased - The death of an employee * `R` Redundancy - An employer-initiated termination of employment due to a genuine redundancy or approved early retirement scheme * `F` Dismissal - An employer-initiated termination of employment due to dismissal, inability to perform the required work, misconduct or inefficiency * `C` Contract cessation - The natural conclusion of a limited employment relationship due to contract/engagement duration or task completion, seasonal work completion, or to cease casuals that are no longer required * `T` Transfer - The administrative arrangements performed to transfer employees across payroll systems, move them temporarily to another employer (machinery of government for public servants), transfer of business, move them to outsourcing arrangements or other such technical activities.
-
-
#title ⇒ Object
Title of the employee.
-
#twitter_user_name ⇒ Object
Employee’s twitter name.
-
#updated_date_utc ⇒ Object
Last modified timestamp.
-
#validation_errors ⇒ Object
Displays array of validation error messages from the API.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Employee
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
- #parse_date(datestring) ⇒ Object
-
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Employee
Initializes the object
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 246 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::PayrollAu::Employee` 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::PayrollAu::Employee`. 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?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'date_of_birth') self.date_of_birth = attributes[:'date_of_birth'] end if attributes.key?(:'home_address') self.home_address = attributes[:'home_address'] end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'middle_names') self.middle_names = attributes[:'middle_names'] end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'phone') self.phone = attributes[:'phone'] end if attributes.key?(:'mobile') self.mobile = attributes[:'mobile'] end if attributes.key?(:'twitter_user_name') self.twitter_user_name = attributes[:'twitter_user_name'] end if attributes.key?(:'is_authorised_to_approve_leave') self. = attributes[:'is_authorised_to_approve_leave'] end if attributes.key?(:'is_authorised_to_approve_timesheets') self. = attributes[:'is_authorised_to_approve_timesheets'] end if attributes.key?(:'job_title') self.job_title = attributes[:'job_title'] end if attributes.key?(:'classification') self.classification = attributes[:'classification'] end if attributes.key?(:'ordinary_earnings_rate_id') self.ordinary_earnings_rate_id = attributes[:'ordinary_earnings_rate_id'] end if attributes.key?(:'payroll_calendar_id') self.payroll_calendar_id = attributes[:'payroll_calendar_id'] end if attributes.key?(:'employee_group_name') self.employee_group_name = attributes[:'employee_group_name'] end if attributes.key?(:'employee_id') self.employee_id = attributes[:'employee_id'] end if attributes.key?(:'termination_date') self.termination_date = attributes[:'termination_date'] end if attributes.key?(:'termination_reason') self.termination_reason = attributes[:'termination_reason'] end if attributes.key?(:'bank_accounts') if (value = attributes[:'bank_accounts']).is_a?(Array) self.bank_accounts = value end end if attributes.key?(:'pay_template') self.pay_template = attributes[:'pay_template'] end if attributes.key?(:'opening_balances') self.opening_balances = attributes[:'opening_balances'] end if attributes.key?(:'tax_declaration') self.tax_declaration = attributes[:'tax_declaration'] end if attributes.key?(:'income_type') self.income_type = attributes[:'income_type'] end if attributes.key?(:'employment_type') self.employment_type = attributes[:'employment_type'] end if attributes.key?(:'country_of_residence') self.country_of_residence = attributes[:'country_of_residence'] end if attributes.key?(:'is_stp2_qualified') self.is_stp2_qualified = attributes[:'is_stp2_qualified'] end if attributes.key?(:'leave_balances') if (value = attributes[:'leave_balances']).is_a?(Array) self.leave_balances = value end end if attributes.key?(:'leave_lines') if (value = attributes[:'leave_lines']).is_a?(Array) self.leave_lines = value end end if attributes.key?(:'super_memberships') if (value = attributes[:'super_memberships']).is_a?(Array) self.super_memberships = value end end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'updated_date_utc') self.updated_date_utc = attributes[:'updated_date_utc'] end if attributes.key?(:'validation_errors') if (value = attributes[:'validation_errors']).is_a?(Array) self.validation_errors = value end end end |
Instance Attribute Details
#bank_accounts ⇒ Object
Returns the value of attribute bank_accounts.
97 98 99 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 97 def bank_accounts @bank_accounts end |
#classification ⇒ Object
Employees classification
69 70 71 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 69 def classification @classification end |
#country_of_residence ⇒ Object
Returns the value of attribute country_of_residence.
115 116 117 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 115 def country_of_residence @country_of_residence end |
#date_of_birth ⇒ Object
Date of birth of the employee (YYYY-MM-DD)
26 27 28 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 26 def date_of_birth @date_of_birth end |
#email ⇒ Object
The email address for the employee
41 42 43 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 41 def email @email end |
#employee_group_name ⇒ Object
The Employee Group allows you to report on payroll expenses and liabilities for each group of employees
78 79 80 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 78 def employee_group_name @employee_group_name end |
#employee_id ⇒ Object
Xero unique identifier for an Employee
81 82 83 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 81 def employee_id @employee_id end |
#employment_type ⇒ Object
Returns the value of attribute employment_type.
112 113 114 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 112 def employment_type @employment_type end |
#first_name ⇒ Object
First name of employee
20 21 22 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 20 def first_name @first_name end |
#gender ⇒ Object
The employee’s gender. See Employee Gender
44 45 46 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 44 def gender @gender end |
#home_address ⇒ Object
Returns the value of attribute home_address.
29 30 31 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 29 def home_address @home_address end |
#income_type ⇒ Object
Returns the value of attribute income_type.
109 110 111 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 109 def income_type @income_type end |
#is_authorised_to_approve_leave ⇒ Object
Authorised to approve other employees’ leave requests
60 61 62 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 60 def @is_authorised_to_approve_leave end |
#is_authorised_to_approve_timesheets ⇒ Object
Authorised to approve timesheets
63 64 65 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 63 def @is_authorised_to_approve_timesheets end |
#is_stp2_qualified ⇒ Object
Indicates if the employee has been updated for STP Phase 2 compliance. Doesn’t indicate that the employee is payable.
118 119 120 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 118 def is_stp2_qualified @is_stp2_qualified end |
#job_title ⇒ Object
JobTitle of the employee
66 67 68 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 66 def job_title @job_title end |
#last_name ⇒ Object
Last name of employee
23 24 25 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 23 def last_name @last_name end |
#leave_balances ⇒ Object
Returns the value of attribute leave_balances.
121 122 123 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 121 def leave_balances @leave_balances end |
#leave_lines ⇒ Object
Returns the value of attribute leave_lines.
124 125 126 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 124 def leave_lines @leave_lines end |
#middle_names ⇒ Object
Middle name(s) of the employee
38 39 40 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 38 def middle_names @middle_names end |
#mobile ⇒ Object
Employee mobile number
54 55 56 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 54 def mobile @mobile end |
#opening_balances ⇒ Object
Returns the value of attribute opening_balances.
103 104 105 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 103 def opening_balances @opening_balances end |
#ordinary_earnings_rate_id ⇒ Object
Xero unique identifier for earnings rate
72 73 74 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 72 def ordinary_earnings_rate_id @ordinary_earnings_rate_id end |
#pay_template ⇒ Object
Returns the value of attribute pay_template.
100 101 102 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 100 def pay_template @pay_template end |
#payroll_calendar_id ⇒ Object
Xero unique identifier for payroll calendar for the employee
75 76 77 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 75 def payroll_calendar_id @payroll_calendar_id end |
#phone ⇒ Object
Employee phone number
51 52 53 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 51 def phone @phone end |
#start_date ⇒ Object
Start date for an employee (YYYY-MM-DD)
32 33 34 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 32 def start_date @start_date end |
#status ⇒ Object
Returns the value of attribute status.
130 131 132 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 130 def status @status end |
#super_memberships ⇒ Object
Returns the value of attribute super_memberships.
127 128 129 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 127 def super_memberships @super_memberships end |
#tax_declaration ⇒ Object
Returns the value of attribute tax_declaration.
106 107 108 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 106 def tax_declaration @tax_declaration end |
#termination_date ⇒ Object
Employee Termination Date (YYYY-MM-DD)
84 85 86 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 84 def termination_date @termination_date end |
#termination_reason ⇒ Object
-
‘V` Voluntary cessation - An employee resignation, retirement, domestic or pressing necessity or abandonment of employment * `I` Ill health - An employee resignation due to medical condition that prevents the continuation of employment, such as for illness, ill-health, medical unfitness or total permanent disability * `D` Deceased - The death of an employee * `R` Redundancy - An employer-initiated termination of employment due to a genuine redundancy or approved early retirement scheme * `F` Dismissal - An employer-initiated termination of employment due to dismissal, inability to perform the required work, misconduct or inefficiency * `C` Contract cessation - The natural conclusion of a limited employment relationship due to contract/engagement duration or task completion, seasonal work completion, or to cease casuals that are no longer required * `T` Transfer - The administrative arrangements performed to transfer employees across payroll systems, move them temporarily to another employer (machinery of government for public servants), transfer of business, move them to outsourcing arrangements or other such technical activities.
87 88 89 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 87 def termination_reason @termination_reason end |
#title ⇒ Object
Title of the employee
35 36 37 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 35 def title @title end |
#twitter_user_name ⇒ Object
Employee’s twitter name
57 58 59 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 57 def twitter_user_name @twitter_user_name end |
#updated_date_utc ⇒ Object
Last modified timestamp
133 134 135 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 133 def updated_date_utc @updated_date_utc end |
#validation_errors ⇒ Object
Displays array of validation error messages from the API
136 137 138 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 136 def validation_errors @validation_errors end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 161 def self.attribute_map { :'first_name' => :'FirstName', :'last_name' => :'LastName', :'date_of_birth' => :'DateOfBirth', :'home_address' => :'HomeAddress', :'start_date' => :'StartDate', :'title' => :'Title', :'middle_names' => :'MiddleNames', :'email' => :'Email', :'gender' => :'Gender', :'phone' => :'Phone', :'mobile' => :'Mobile', :'twitter_user_name' => :'TwitterUserName', :'is_authorised_to_approve_leave' => :'IsAuthorisedToApproveLeave', :'is_authorised_to_approve_timesheets' => :'IsAuthorisedToApproveTimesheets', :'job_title' => :'JobTitle', :'classification' => :'Classification', :'ordinary_earnings_rate_id' => :'OrdinaryEarningsRateID', :'payroll_calendar_id' => :'PayrollCalendarID', :'employee_group_name' => :'EmployeeGroupName', :'employee_id' => :'EmployeeID', :'termination_date' => :'TerminationDate', :'termination_reason' => :'TerminationReason', :'bank_accounts' => :'BankAccounts', :'pay_template' => :'PayTemplate', :'opening_balances' => :'OpeningBalances', :'tax_declaration' => :'TaxDeclaration', :'income_type' => :'IncomeType', :'employment_type' => :'EmploymentType', :'country_of_residence' => :'CountryOfResidence', :'is_stp2_qualified' => :'IsSTP2Qualified', :'leave_balances' => :'LeaveBalances', :'leave_lines' => :'LeaveLines', :'super_memberships' => :'SuperMemberships', :'status' => :'Status', :'updated_date_utc' => :'UpdatedDateUTC', :'validation_errors' => :'ValidationErrors' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
524 525 526 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 524 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_types ⇒ Object
Attribute type mapping.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 203 def self.openapi_types { :'first_name' => :'String', :'last_name' => :'String', :'date_of_birth' => :'Date', :'home_address' => :'HomeAddress', :'start_date' => :'Date', :'title' => :'String', :'middle_names' => :'String', :'email' => :'String', :'gender' => :'String', :'phone' => :'String', :'mobile' => :'String', :'twitter_user_name' => :'String', :'is_authorised_to_approve_leave' => :'Boolean', :'is_authorised_to_approve_timesheets' => :'Boolean', :'job_title' => :'String', :'classification' => :'String', :'ordinary_earnings_rate_id' => :'String', :'payroll_calendar_id' => :'String', :'employee_group_name' => :'String', :'employee_id' => :'String', :'termination_date' => :'Date', :'termination_reason' => :'String', :'bank_accounts' => :'Array<BankAccount>', :'pay_template' => :'PayTemplate', :'opening_balances' => :'OpeningBalances', :'tax_declaration' => :'TaxDeclaration', :'income_type' => :'IncomeType', :'employment_type' => :'EmploymentType', :'country_of_residence' => :'CountryOfResidence', :'is_stp2_qualified' => :'Boolean', :'leave_balances' => :'Array<LeaveBalance>', :'leave_lines' => :'Array<LeaveLine>', :'super_memberships' => :'Array<SuperMembership>', :'status' => :'EmployeeStatus', :'updated_date_utc' => :'DateTime', :'validation_errors' => :'Array<ValidationError>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 468 def ==(o) return true if self.equal?(o) self.class == o.class && first_name == o.first_name && last_name == o.last_name && date_of_birth == o.date_of_birth && home_address == o.home_address && start_date == o.start_date && title == o.title && middle_names == o.middle_names && email == o.email && gender == o.gender && phone == o.phone && mobile == o.mobile && twitter_user_name == o.twitter_user_name && == o. && == o. && job_title == o.job_title && classification == o.classification && ordinary_earnings_rate_id == o.ordinary_earnings_rate_id && payroll_calendar_id == o.payroll_calendar_id && employee_group_name == o.employee_group_name && employee_id == o.employee_id && termination_date == o.termination_date && termination_reason == o.termination_reason && bank_accounts == o.bank_accounts && pay_template == o.pay_template && opening_balances == o.opening_balances && tax_declaration == o.tax_declaration && income_type == o.income_type && employment_type == o.employment_type && country_of_residence == o.country_of_residence && is_stp2_qualified == o.is_stp2_qualified && leave_balances == o.leave_balances && leave_lines == o.leave_lines && super_memberships == o.super_memberships && status == o.status && updated_date_utc == o.updated_date_utc && validation_errors == o.validation_errors end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 552 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<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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::PayrollAu.const_get(type).build_from_hash(value) end end |
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 625 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 531 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 |
#eql?(o) ⇒ Boolean
511 512 513 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 511 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
517 518 519 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 517 def hash [first_name, last_name, date_of_birth, home_address, start_date, title, middle_names, email, gender, phone, mobile, twitter_user_name, , , job_title, classification, ordinary_earnings_rate_id, payroll_calendar_id, employee_group_name, employee_id, termination_date, termination_reason, bank_accounts, pay_template, opening_balances, tax_declaration, income_type, employment_type, country_of_residence, is_stp2_qualified, leave_balances, leave_lines, super_memberships, status, updated_date_utc, validation_errors].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 416 def list_invalid_properties invalid_properties = Array.new if @first_name.nil? invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') end if @last_name.nil? invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') end if @date_of_birth.nil? invalid_properties.push('invalid value for "date_of_birth", date_of_birth cannot be nil.') end invalid_properties end |
#parse_date(datestring) ⇒ Object
641 642 643 644 645 646 647 648 649 650 651 652 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 641 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 |
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case
617 618 619 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 617 def to_attributes to_hash(downcase: true) end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
599 600 601 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 599 def to_body to_hash end |
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash
605 606 607 608 609 610 611 612 613 614 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 605 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 |
#to_s ⇒ String
Returns the string representation of the object
593 594 595 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 593 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
435 436 437 438 439 440 441 442 443 444 |
# File 'lib/xero-ruby/models/payroll_au/employee.rb', line 435 def valid? return false if @first_name.nil? return false if @last_name.nil? return false if @date_of_birth.nil? gender_validator = EnumAttributeValidator.new('String', ["N", "M", "F", "I"]) return false unless gender_validator.valid?(@gender) termination_reason_validator = EnumAttributeValidator.new('String', ["V", "I", "D", "R", "F", "C", "T"]) return false unless termination_reason_validator.valid?(@termination_reason) true end |