affixapi 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +19 -0
  4. data/README.md +374 -0
  5. data/Rakefile +10 -0
  6. data/affixapi.gemspec +38 -0
  7. data/docs/AddressNoNonNullRequest.md +26 -0
  8. data/docs/AddressResponse.md +26 -0
  9. data/docs/Class20230301Api.md +1401 -0
  10. data/docs/ClientRequest.md +24 -0
  11. data/docs/ClientResponse.md +26 -0
  12. data/docs/CompanyResponse.md +28 -0
  13. data/docs/CoreApi.md +69 -0
  14. data/docs/CreateEmployeeRequest.md +68 -0
  15. data/docs/CreateEmployeeRequestBankAccount.md +26 -0
  16. data/docs/CreateEmployeeRequestManager.md +26 -0
  17. data/docs/CurrencyRequest.md +15 -0
  18. data/docs/CurrencyResponse.md +15 -0
  19. data/docs/DeveloperApi.md +777 -0
  20. data/docs/DisconnectResponse.md +18 -0
  21. data/docs/EmployeeResponse.md +74 -0
  22. data/docs/EmploymentNoNullEnumRequest.md +30 -0
  23. data/docs/EmploymentResponse.md +30 -0
  24. data/docs/GroupNoNullEnumRequest.md +24 -0
  25. data/docs/GroupResponse.md +24 -0
  26. data/docs/IdAndMessageResponse.md +20 -0
  27. data/docs/IdentityResponse.md +22 -0
  28. data/docs/InlineResponse400.md +20 -0
  29. data/docs/InlineResponse401.md +22 -0
  30. data/docs/InlineResponse409.md +22 -0
  31. data/docs/IntrospectResponse.md +24 -0
  32. data/docs/LocationNoNonNullRequest.md +26 -0
  33. data/docs/LocationResponse.md +26 -0
  34. data/docs/ManagementApi.md +420 -0
  35. data/docs/MessageResponse.md +18 -0
  36. data/docs/ModeRequest.md +15 -0
  37. data/docs/ModeResponse.md +15 -0
  38. data/docs/OfficialApi.md +631 -0
  39. data/docs/PayrunResponse.md +30 -0
  40. data/docs/PayslipResponse.md +44 -0
  41. data/docs/PayslipResponseContributions.md +20 -0
  42. data/docs/PayslipResponseDeductions.md +20 -0
  43. data/docs/PayslipResponseEarnings.md +22 -0
  44. data/docs/PayslipResponseTaxes.md +22 -0
  45. data/docs/ProviderRequest.md +15 -0
  46. data/docs/ProviderResponse.md +15 -0
  47. data/docs/ScopesRequest.md +15 -0
  48. data/docs/ScopesResponse.md +15 -0
  49. data/docs/TimeOffBalanceResponse.md +32 -0
  50. data/docs/TimeOffEntryResponse.md +40 -0
  51. data/docs/TimesheetResponse.md +32 -0
  52. data/docs/TokenRequest.md +26 -0
  53. data/docs/TokenResponse.md +26 -0
  54. data/git_push.sh +58 -0
  55. data/lib/openapi_client/api/class20230301_api.rb +1198 -0
  56. data/lib/openapi_client/api/core_api.rb +79 -0
  57. data/lib/openapi_client/api/developer_api.rb +677 -0
  58. data/lib/openapi_client/api/management_api.rb +380 -0
  59. data/lib/openapi_client/api/official_api.rb +543 -0
  60. data/lib/openapi_client/api_client.rb +390 -0
  61. data/lib/openapi_client/api_error.rb +57 -0
  62. data/lib/openapi_client/configuration.rb +288 -0
  63. data/lib/openapi_client/models/address_no_non_null_request.rb +295 -0
  64. data/lib/openapi_client/models/address_response.rb +295 -0
  65. data/lib/openapi_client/models/client_request.rb +269 -0
  66. data/lib/openapi_client/models/client_response.rb +284 -0
  67. data/lib/openapi_client/models/company_response.rb +279 -0
  68. data/lib/openapi_client/models/create_employee_request.rb +568 -0
  69. data/lib/openapi_client/models/create_employee_request_bank_account.rb +259 -0
  70. data/lib/openapi_client/models/create_employee_request_manager.rb +263 -0
  71. data/lib/openapi_client/models/currency_request.rb +38 -0
  72. data/lib/openapi_client/models/currency_response.rb +38 -0
  73. data/lib/openapi_client/models/disconnect_response.rb +258 -0
  74. data/lib/openapi_client/models/employee_response.rb +608 -0
  75. data/lib/openapi_client/models/employment_no_null_enum_request.rb +329 -0
  76. data/lib/openapi_client/models/employment_response.rb +329 -0
  77. data/lib/openapi_client/models/group_no_null_enum_request.rb +283 -0
  78. data/lib/openapi_client/models/group_response.rb +283 -0
  79. data/lib/openapi_client/models/id_and_message_response.rb +239 -0
  80. data/lib/openapi_client/models/identity_response.rb +250 -0
  81. data/lib/openapi_client/models/inline_response400.rb +227 -0
  82. data/lib/openapi_client/models/inline_response401.rb +299 -0
  83. data/lib/openapi_client/models/inline_response409.rb +278 -0
  84. data/lib/openapi_client/models/introspect_response.rb +269 -0
  85. data/lib/openapi_client/models/location_no_non_null_request.rb +263 -0
  86. data/lib/openapi_client/models/location_response.rb +263 -0
  87. data/lib/openapi_client/models/message_response.rb +223 -0
  88. data/lib/openapi_client/models/mode_request.rb +37 -0
  89. data/lib/openapi_client/models/mode_response.rb +37 -0
  90. data/lib/openapi_client/models/payrun_response.rb +342 -0
  91. data/lib/openapi_client/models/payslip_response.rb +448 -0
  92. data/lib/openapi_client/models/payslip_response_contributions.rb +238 -0
  93. data/lib/openapi_client/models/payslip_response_deductions.rb +238 -0
  94. data/lib/openapi_client/models/payslip_response_earnings.rb +250 -0
  95. data/lib/openapi_client/models/payslip_response_taxes.rb +248 -0
  96. data/lib/openapi_client/models/provider_request.rb +70 -0
  97. data/lib/openapi_client/models/provider_response.rb +70 -0
  98. data/lib/openapi_client/models/scopes_request.rb +55 -0
  99. data/lib/openapi_client/models/scopes_response.rb +55 -0
  100. data/lib/openapi_client/models/time_off_balance_response.rb +342 -0
  101. data/lib/openapi_client/models/time_off_entry_response.rb +408 -0
  102. data/lib/openapi_client/models/timesheet_response.rb +318 -0
  103. data/lib/openapi_client/models/token_request.rb +318 -0
  104. data/lib/openapi_client/models/token_response.rb +318 -0
  105. data/lib/openapi_client/version.rb +15 -0
  106. data/lib/openapi_client.rb +86 -0
  107. data/openapi_client-0.0.1.gem +0 -0
  108. data/pkg/affixapi-0.0.1.gem +0 -0
  109. data/spec/api/class20230301_api_spec.rb +260 -0
  110. data/spec/api/core_api_spec.rb +46 -0
  111. data/spec/api/developer_api_spec.rb +160 -0
  112. data/spec/api/management_api_spec.rb +103 -0
  113. data/spec/api/official_api_spec.rb +135 -0
  114. data/spec/api_client_spec.rb +226 -0
  115. data/spec/configuration_spec.rb +42 -0
  116. data/spec/models/address_no_non_null_request_spec.rb +62 -0
  117. data/spec/models/address_response_spec.rb +62 -0
  118. data/spec/models/client_request_spec.rb +52 -0
  119. data/spec/models/client_response_spec.rb +58 -0
  120. data/spec/models/company_response_spec.rb +64 -0
  121. data/spec/models/create_employee_request_bank_account_spec.rb +58 -0
  122. data/spec/models/create_employee_request_manager_spec.rb +58 -0
  123. data/spec/models/create_employee_request_spec.rb +204 -0
  124. data/spec/models/currency_request_spec.rb +28 -0
  125. data/spec/models/currency_response_spec.rb +28 -0
  126. data/spec/models/disconnect_response_spec.rb +38 -0
  127. data/spec/models/employee_response_spec.rb +222 -0
  128. data/spec/models/employment_no_null_enum_request_spec.rb +78 -0
  129. data/spec/models/employment_response_spec.rb +78 -0
  130. data/spec/models/group_no_null_enum_request_spec.rb +56 -0
  131. data/spec/models/group_response_spec.rb +56 -0
  132. data/spec/models/id_and_message_response_spec.rb +40 -0
  133. data/spec/models/identity_response_spec.rb +46 -0
  134. data/spec/models/inline_response400_spec.rb +40 -0
  135. data/spec/models/inline_response401_spec.rb +54 -0
  136. data/spec/models/inline_response409_spec.rb +50 -0
  137. data/spec/models/introspect_response_spec.rb +52 -0
  138. data/spec/models/location_no_non_null_request_spec.rb +58 -0
  139. data/spec/models/location_response_spec.rb +58 -0
  140. data/spec/models/message_response_spec.rb +34 -0
  141. data/spec/models/mode_request_spec.rb +28 -0
  142. data/spec/models/mode_response_spec.rb +28 -0
  143. data/spec/models/payrun_response_spec.rb +78 -0
  144. data/spec/models/payslip_response_contributions_spec.rb +40 -0
  145. data/spec/models/payslip_response_deductions_spec.rb +40 -0
  146. data/spec/models/payslip_response_earnings_spec.rb +46 -0
  147. data/spec/models/payslip_response_spec.rb +116 -0
  148. data/spec/models/payslip_response_taxes_spec.rb +46 -0
  149. data/spec/models/provider_request_spec.rb +28 -0
  150. data/spec/models/provider_response_spec.rb +28 -0
  151. data/spec/models/scopes_request_spec.rb +28 -0
  152. data/spec/models/scopes_response_spec.rb +28 -0
  153. data/spec/models/time_off_balance_response_spec.rb +80 -0
  154. data/spec/models/time_off_entry_response_spec.rb +108 -0
  155. data/spec/models/timesheet_response_spec.rb +76 -0
  156. data/spec/models/token_request_spec.rb +62 -0
  157. data/spec/models/token_response_spec.rb +62 -0
  158. data/spec/spec_helper.rb +111 -0
  159. metadata +349 -0
@@ -0,0 +1,568 @@
1
+ =begin
2
+ #Affix API
3
+
4
+ #The affixapi.com API documentation. # Introduction Affix API is an OAuth 2.1 application that allows developers to access customer data, without developers needing to manage or maintain integrations; or collect login credentials or API keys from users for these third party systems. # OAuth 2.1 Affix API follows the [OAuth 2.1 spec](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-08). As an OAuth application, Affix API handles not only both the collection of sensitive user credentials or API keys, but also builds and maintains the integrations with the providers, so you don't have to. # How to obtain an access token in order to get started, you must: - register a `client_id` - direct your user to the sign in flow (`https://connect.affixapi.com` [with the appropriate query parameters](https://github.com/affixapi/starter-kit/tree/master/connect)) - capture `authorization_code` we will send to your redirect URI after the sign in flow is complete and exchange that `authorization_code` for a Bearer token # Sandbox keys (developer mode) ### dev ``` eyJhbGciOiJFUzI1NiIsImtpZCI6Ims5RmxwSFR1YklmZWNsUU5QRVZzeFcxazFZZ0Zfbk1BWllOSGVuOFQxdGciLCJ0eXAiOiJKV1MifQ.eyJwcm92aWRlciI6InNhbmRib3giLCJzY29wZXMiOlsiLzIwMjMtMDMtMDEvZGV2ZWxvcGVyL2NvbXBhbnkiLCIvMjAyMy0wMy0wMS9kZXZlbG9wZXIvZW1wbG95ZWUiLCIvMjAyMy0wMy0wMS9kZXZlbG9wZXIvZW1wbG95ZWVzIiwiLzIwMjMtMDMtMDEvZGV2ZWxvcGVyL2lkZW50aXR5IiwiLzIwMjMtMDMtMDEvZGV2ZWxvcGVyL3BheXJ1bnMiLCIvMjAyMy0wMy0wMS9kZXZlbG9wZXIvcGF5cnVucy86cGF5cnVuX2lkIiwiLzIwMjM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4MywiaXNzIjoicHVibGljYXBpLWludGVybWVkaWF0ZS5wcm9kLmVuZ2luZWVyaW5nLmFmZml4YXBpLmNvbSIsInN1YiI6ImRldmVsb3BlciIsImF1ZCI6IjA4QkIwODFFLUQ5QUI0RDE0LThERjk5MjMzLTY2NjE1Q0U5In0.2zdpFAmiyYiYk6MOcbXNUwwR4M1Fextnaac340x54AidiWXCyw-u9KeavbqfYF6q8a9kcDLrxhJ8Wc_3tIzuVw' \\ 'https://api.affixapi.com/2023-03-01/developer/employees' ``` # Webhooks An exciting feature for HR/Payroll modes are webhooks. If enabled, your `webhook_uri` is set on your `client_id` for the respective environment: `dev | prod` Webhooks are configured to make live requests to the underlying integration 1x/hr, and if a difference is detected since the last request, we will send a request to your `webhook_uri` with this shape: ``` { added: <api.v20230301.Employees>[ <api.v20230301.Employee>{ ..., date_of_birth: '2010-08-06', display_full_name: 'Daija Rogahn', employee_number: '57993', employment_status: 'pending', employment_type: 'other', employments: [ { currency: 'eur', effective_date: '2022-02-25', employment_type: 'other', job_title: 'Dynamic Implementation Manager', pay_frequency: 'semimonthly', pay_period: 'YEAR', pay_rate: 96000, }, ], first_name: 'Daija', ... } ], removed: [], updated: [ <api.v20230301.Employee>{ ..., date_of_birth: '2009-11-09', display_full_name: 'Lourdes Stiedemann', employee_number: '63189', employment_status: 'leave', employment_type: 'full_time', employments: [ { currency: 'gbp', effective_date: '2023-01-16', employment_type: 'full_time', job_title: 'Forward Brand Planner', pay_frequency: 'semimonthly', pay_period: 'YEAR', pay_rate: 86000, }, ], first_name: 'Lourdes', } ] } ``` the following headers will be sent with webhook requests: ``` x-affix-api-signature: ab8474e609db95d5df3adc39ea3add7a7544bd215c5c520a30a650ae93a2fba7 x-affix-api-origin: webhooks-employees-webhook user-agent: affixapi.com ``` Before trusting the payload, you should sign the payload and verify the signature matches the signature sent by the `affixapi.com` service. This secures that the data sent to your `webhook_uri` is from the `affixapi.com` server. The signature is created by combining the signing secret (your `client_secret`) with the body of the request sent using a standard HMAC-SHA256 keyed hash. The signature can be created via: - create an `HMAC` with your `client_secret` - update the `HMAC` with the payload - get the hex digest -> this is the signature Sample `typescript` code that follows this recipe: ``` import { createHmac } from 'crypto'; export const computeSignature = ({ str, signingSecret, }: { signingSecret: string; str: string; }): string => { const hmac = createHmac('sha256', signingSecret); hmac.update(str); const signature = hmac.digest('hex'); return signature; }; ``` ## Rate limits Open endpoints (not gated by an API key) (applied at endpoint level): - 15 requests every 1 minute (by IP address) - 25 requests every 5 minutes (by IP address) Gated endpoints (require an API key) (applied at endpoint level): - 40 requests every 1 minute (by IP address) - 40 requests every 5 minutes (by `client_id`) Things to keep in mind: - Open endpoints (not gated by an API key) will likely be called by your users, not you, so rate limits generally would not apply to you. - As a developer, rate limits are applied at the endpoint granularity. - For example, say the rate limits below are 10 requests per minute by ip. from that same ip, within 1 minute, you get: - 10 requests per minute on `/orders`, - another 10 requests per minute on `/items`, - and another 10 requests per minute on `/identity`, - for a total of 30 requests per minute.
5
+
6
+ The version of the OpenAPI document: 2023-03-01
7
+ Contact: developers@affixapi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class CreateEmployeeRequest
18
+ attr_accessor :employee_number
19
+
20
+ # the first name of the individual
21
+ attr_accessor :first_name
22
+
23
+ # the last name of the individual
24
+ attr_accessor :last_name
25
+
26
+ attr_accessor :display_full_name
27
+
28
+ attr_accessor :nationality
29
+
30
+ attr_accessor :job_title
31
+
32
+ # the work email of the individual
33
+ attr_accessor :work_email
34
+
35
+ # the personal email of the individual
36
+ attr_accessor :personal_email
37
+
38
+ # +1234567890
39
+ attr_accessor :mobile_phone_number
40
+
41
+ attr_accessor :tax_id
42
+
43
+ attr_accessor :gender
44
+
45
+ attr_accessor :ethnicity
46
+
47
+ attr_accessor :marital_status
48
+
49
+ attr_accessor :date_of_birth
50
+
51
+ attr_accessor :employment_status
52
+
53
+ attr_accessor :employment_type
54
+
55
+ attr_accessor :start_date
56
+
57
+ attr_accessor :termination_date
58
+
59
+ attr_accessor :avatar
60
+
61
+ attr_accessor :home_location
62
+
63
+ attr_accessor :work_location
64
+
65
+ attr_accessor :manager
66
+
67
+ attr_accessor :bank_account
68
+
69
+ attr_accessor :employments
70
+
71
+ attr_accessor :custom_fields
72
+
73
+ attr_accessor :groups
74
+
75
+ class EnumAttributeValidator
76
+ attr_reader :datatype
77
+ attr_reader :allowable_values
78
+
79
+ def initialize(datatype, allowable_values)
80
+ @allowable_values = allowable_values.map do |value|
81
+ case datatype.to_s
82
+ when /Integer/i
83
+ value.to_i
84
+ when /Float/i
85
+ value.to_f
86
+ else
87
+ value
88
+ end
89
+ end
90
+ end
91
+
92
+ def valid?(value)
93
+ !value || allowable_values.include?(value)
94
+ end
95
+ end
96
+
97
+ # Attribute mapping from ruby-style variable name to JSON key.
98
+ def self.attribute_map
99
+ {
100
+ :'employee_number' => :'employee_number',
101
+ :'first_name' => :'first_name',
102
+ :'last_name' => :'last_name',
103
+ :'display_full_name' => :'display_full_name',
104
+ :'nationality' => :'nationality',
105
+ :'job_title' => :'job_title',
106
+ :'work_email' => :'work_email',
107
+ :'personal_email' => :'personal_email',
108
+ :'mobile_phone_number' => :'mobile_phone_number',
109
+ :'tax_id' => :'tax_id',
110
+ :'gender' => :'gender',
111
+ :'ethnicity' => :'ethnicity',
112
+ :'marital_status' => :'marital_status',
113
+ :'date_of_birth' => :'date_of_birth',
114
+ :'employment_status' => :'employment_status',
115
+ :'employment_type' => :'employment_type',
116
+ :'start_date' => :'start_date',
117
+ :'termination_date' => :'termination_date',
118
+ :'avatar' => :'avatar',
119
+ :'home_location' => :'home_location',
120
+ :'work_location' => :'work_location',
121
+ :'manager' => :'manager',
122
+ :'bank_account' => :'bank_account',
123
+ :'employments' => :'employments',
124
+ :'custom_fields' => :'custom_fields',
125
+ :'groups' => :'groups'
126
+ }
127
+ end
128
+
129
+ # Returns all the JSON keys this model knows about
130
+ def self.acceptable_attributes
131
+ attribute_map.values
132
+ end
133
+
134
+ # Attribute type mapping.
135
+ def self.openapi_types
136
+ {
137
+ :'employee_number' => :'String',
138
+ :'first_name' => :'String',
139
+ :'last_name' => :'String',
140
+ :'display_full_name' => :'String',
141
+ :'nationality' => :'String',
142
+ :'job_title' => :'String',
143
+ :'work_email' => :'String',
144
+ :'personal_email' => :'String',
145
+ :'mobile_phone_number' => :'String',
146
+ :'tax_id' => :'String',
147
+ :'gender' => :'String',
148
+ :'ethnicity' => :'String',
149
+ :'marital_status' => :'String',
150
+ :'date_of_birth' => :'Date',
151
+ :'employment_status' => :'String',
152
+ :'employment_type' => :'String',
153
+ :'start_date' => :'Date',
154
+ :'termination_date' => :'Date',
155
+ :'avatar' => :'String',
156
+ :'home_location' => :'AddressNoNonNullRequest',
157
+ :'work_location' => :'LocationNoNonNullRequest',
158
+ :'manager' => :'CreateEmployeeRequestManager',
159
+ :'bank_account' => :'CreateEmployeeRequestBankAccount',
160
+ :'employments' => :'Array<EmploymentNoNullEnumRequest>',
161
+ :'custom_fields' => :'Object',
162
+ :'groups' => :'Array<GroupNoNullEnumRequest>'
163
+ }
164
+ end
165
+
166
+ # List of attributes with nullable: true
167
+ def self.openapi_nullable
168
+ Set.new([
169
+ :'employee_number',
170
+ :'display_full_name',
171
+ :'nationality',
172
+ :'job_title',
173
+ :'work_email',
174
+ :'personal_email',
175
+ :'mobile_phone_number',
176
+ :'tax_id',
177
+ :'gender',
178
+ :'ethnicity',
179
+ :'marital_status',
180
+ :'date_of_birth',
181
+ :'employment_status',
182
+ :'employment_type',
183
+ :'start_date',
184
+ :'termination_date',
185
+ :'avatar',
186
+ :'home_location',
187
+ :'work_location',
188
+ :'manager',
189
+ :'bank_account',
190
+ :'employments',
191
+ :'custom_fields',
192
+ :'groups'
193
+ ])
194
+ end
195
+
196
+ # Initializes the object
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ def initialize(attributes = {})
199
+ if (!attributes.is_a?(Hash))
200
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::CreateEmployeeRequest` initialize method"
201
+ end
202
+
203
+ # check to see if the attribute exists and convert string to symbol for hash key
204
+ attributes = attributes.each_with_object({}) { |(k, v), h|
205
+ if (!self.class.attribute_map.key?(k.to_sym))
206
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::CreateEmployeeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
207
+ end
208
+ h[k.to_sym] = v
209
+ }
210
+
211
+ if attributes.key?(:'employee_number')
212
+ self.employee_number = attributes[:'employee_number']
213
+ end
214
+
215
+ if attributes.key?(:'first_name')
216
+ self.first_name = attributes[:'first_name']
217
+ end
218
+
219
+ if attributes.key?(:'last_name')
220
+ self.last_name = attributes[:'last_name']
221
+ end
222
+
223
+ if attributes.key?(:'display_full_name')
224
+ self.display_full_name = attributes[:'display_full_name']
225
+ end
226
+
227
+ if attributes.key?(:'nationality')
228
+ self.nationality = attributes[:'nationality']
229
+ end
230
+
231
+ if attributes.key?(:'job_title')
232
+ self.job_title = attributes[:'job_title']
233
+ end
234
+
235
+ if attributes.key?(:'work_email')
236
+ self.work_email = attributes[:'work_email']
237
+ end
238
+
239
+ if attributes.key?(:'personal_email')
240
+ self.personal_email = attributes[:'personal_email']
241
+ end
242
+
243
+ if attributes.key?(:'mobile_phone_number')
244
+ self.mobile_phone_number = attributes[:'mobile_phone_number']
245
+ end
246
+
247
+ if attributes.key?(:'tax_id')
248
+ self.tax_id = attributes[:'tax_id']
249
+ end
250
+
251
+ if attributes.key?(:'gender')
252
+ self.gender = attributes[:'gender']
253
+ end
254
+
255
+ if attributes.key?(:'ethnicity')
256
+ self.ethnicity = attributes[:'ethnicity']
257
+ end
258
+
259
+ if attributes.key?(:'marital_status')
260
+ self.marital_status = attributes[:'marital_status']
261
+ end
262
+
263
+ if attributes.key?(:'date_of_birth')
264
+ self.date_of_birth = attributes[:'date_of_birth']
265
+ end
266
+
267
+ if attributes.key?(:'employment_status')
268
+ self.employment_status = attributes[:'employment_status']
269
+ end
270
+
271
+ if attributes.key?(:'employment_type')
272
+ self.employment_type = attributes[:'employment_type']
273
+ end
274
+
275
+ if attributes.key?(:'start_date')
276
+ self.start_date = attributes[:'start_date']
277
+ end
278
+
279
+ if attributes.key?(:'termination_date')
280
+ self.termination_date = attributes[:'termination_date']
281
+ end
282
+
283
+ if attributes.key?(:'avatar')
284
+ self.avatar = attributes[:'avatar']
285
+ end
286
+
287
+ if attributes.key?(:'home_location')
288
+ self.home_location = attributes[:'home_location']
289
+ end
290
+
291
+ if attributes.key?(:'work_location')
292
+ self.work_location = attributes[:'work_location']
293
+ end
294
+
295
+ if attributes.key?(:'manager')
296
+ self.manager = attributes[:'manager']
297
+ end
298
+
299
+ if attributes.key?(:'bank_account')
300
+ self.bank_account = attributes[:'bank_account']
301
+ end
302
+
303
+ if attributes.key?(:'employments')
304
+ if (value = attributes[:'employments']).is_a?(Array)
305
+ self.employments = value
306
+ end
307
+ end
308
+
309
+ if attributes.key?(:'custom_fields')
310
+ self.custom_fields = attributes[:'custom_fields']
311
+ end
312
+
313
+ if attributes.key?(:'groups')
314
+ if (value = attributes[:'groups']).is_a?(Array)
315
+ self.groups = value
316
+ end
317
+ end
318
+ end
319
+
320
+ # Show invalid properties with the reasons. Usually used together with valid?
321
+ # @return Array for valid properties with the reasons
322
+ def list_invalid_properties
323
+ invalid_properties = Array.new
324
+ if @first_name.nil?
325
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
326
+ end
327
+
328
+ if @last_name.nil?
329
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
330
+ end
331
+
332
+ invalid_properties
333
+ end
334
+
335
+ # Check to see if the all the properties in the model are valid
336
+ # @return true if the model is valid
337
+ def valid?
338
+ return false if @first_name.nil?
339
+ return false if @last_name.nil?
340
+ gender_validator = EnumAttributeValidator.new('String', ["male", "female", "not_specified"])
341
+ return false unless gender_validator.valid?(@gender)
342
+ ethnicity_validator = EnumAttributeValidator.new('String', ["asian", "black", "hispanic", "mixed", "not_specified", "other", "white"])
343
+ return false unless ethnicity_validator.valid?(@ethnicity)
344
+ marital_status_validator = EnumAttributeValidator.new('String', ["single", "married", "not_specified"])
345
+ return false unless marital_status_validator.valid?(@marital_status)
346
+ employment_status_validator = EnumAttributeValidator.new('String', ["active", "inactive", "pending", "leave"])
347
+ return false unless employment_status_validator.valid?(@employment_status)
348
+ employment_type_validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "other"])
349
+ return false unless employment_type_validator.valid?(@employment_type)
350
+ true
351
+ end
352
+
353
+ # Custom attribute writer method checking allowed values (enum).
354
+ # @param [Object] gender Object to be assigned
355
+ def gender=(gender)
356
+ validator = EnumAttributeValidator.new('String', ["male", "female", "not_specified"])
357
+ unless validator.valid?(gender)
358
+ fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
359
+ end
360
+ @gender = gender
361
+ end
362
+
363
+ # Custom attribute writer method checking allowed values (enum).
364
+ # @param [Object] ethnicity Object to be assigned
365
+ def ethnicity=(ethnicity)
366
+ validator = EnumAttributeValidator.new('String', ["asian", "black", "hispanic", "mixed", "not_specified", "other", "white"])
367
+ unless validator.valid?(ethnicity)
368
+ fail ArgumentError, "invalid value for \"ethnicity\", must be one of #{validator.allowable_values}."
369
+ end
370
+ @ethnicity = ethnicity
371
+ end
372
+
373
+ # Custom attribute writer method checking allowed values (enum).
374
+ # @param [Object] marital_status Object to be assigned
375
+ def marital_status=(marital_status)
376
+ validator = EnumAttributeValidator.new('String', ["single", "married", "not_specified"])
377
+ unless validator.valid?(marital_status)
378
+ fail ArgumentError, "invalid value for \"marital_status\", must be one of #{validator.allowable_values}."
379
+ end
380
+ @marital_status = marital_status
381
+ end
382
+
383
+ # Custom attribute writer method checking allowed values (enum).
384
+ # @param [Object] employment_status Object to be assigned
385
+ def employment_status=(employment_status)
386
+ validator = EnumAttributeValidator.new('String', ["active", "inactive", "pending", "leave"])
387
+ unless validator.valid?(employment_status)
388
+ fail ArgumentError, "invalid value for \"employment_status\", must be one of #{validator.allowable_values}."
389
+ end
390
+ @employment_status = employment_status
391
+ end
392
+
393
+ # Custom attribute writer method checking allowed values (enum).
394
+ # @param [Object] employment_type Object to be assigned
395
+ def employment_type=(employment_type)
396
+ validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "other"])
397
+ unless validator.valid?(employment_type)
398
+ fail ArgumentError, "invalid value for \"employment_type\", must be one of #{validator.allowable_values}."
399
+ end
400
+ @employment_type = employment_type
401
+ end
402
+
403
+ # Checks equality by comparing each attribute.
404
+ # @param [Object] Object to be compared
405
+ def ==(o)
406
+ return true if self.equal?(o)
407
+ self.class == o.class &&
408
+ employee_number == o.employee_number &&
409
+ first_name == o.first_name &&
410
+ last_name == o.last_name &&
411
+ display_full_name == o.display_full_name &&
412
+ nationality == o.nationality &&
413
+ job_title == o.job_title &&
414
+ work_email == o.work_email &&
415
+ personal_email == o.personal_email &&
416
+ mobile_phone_number == o.mobile_phone_number &&
417
+ tax_id == o.tax_id &&
418
+ gender == o.gender &&
419
+ ethnicity == o.ethnicity &&
420
+ marital_status == o.marital_status &&
421
+ date_of_birth == o.date_of_birth &&
422
+ employment_status == o.employment_status &&
423
+ employment_type == o.employment_type &&
424
+ start_date == o.start_date &&
425
+ termination_date == o.termination_date &&
426
+ avatar == o.avatar &&
427
+ home_location == o.home_location &&
428
+ work_location == o.work_location &&
429
+ manager == o.manager &&
430
+ bank_account == o.bank_account &&
431
+ employments == o.employments &&
432
+ custom_fields == o.custom_fields &&
433
+ groups == o.groups
434
+ end
435
+
436
+ # @see the `==` method
437
+ # @param [Object] Object to be compared
438
+ def eql?(o)
439
+ self == o
440
+ end
441
+
442
+ # Calculates hash code according to all attributes.
443
+ # @return [Integer] Hash code
444
+ def hash
445
+ [employee_number, first_name, last_name, display_full_name, nationality, job_title, work_email, personal_email, mobile_phone_number, tax_id, gender, ethnicity, marital_status, date_of_birth, employment_status, employment_type, start_date, termination_date, avatar, home_location, work_location, manager, bank_account, employments, custom_fields, groups].hash
446
+ end
447
+
448
+ # Builds the object from hash
449
+ # @param [Hash] attributes Model attributes in the form of hash
450
+ # @return [Object] Returns the model itself
451
+ def self.build_from_hash(attributes)
452
+ new.build_from_hash(attributes)
453
+ end
454
+
455
+ # Builds the object from hash
456
+ # @param [Hash] attributes Model attributes in the form of hash
457
+ # @return [Object] Returns the model itself
458
+ def build_from_hash(attributes)
459
+ return nil unless attributes.is_a?(Hash)
460
+ self.class.openapi_types.each_pair do |key, type|
461
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
462
+ self.send("#{key}=", nil)
463
+ elsif type =~ /\AArray<(.*)>/i
464
+ # check to ensure the input is an array given that the attribute
465
+ # is documented as an array but the input is not
466
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
467
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
468
+ end
469
+ elsif !attributes[self.class.attribute_map[key]].nil?
470
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
471
+ end
472
+ end
473
+
474
+ self
475
+ end
476
+
477
+ # Deserializes the data based on type
478
+ # @param string type Data type
479
+ # @param string value Value to be deserialized
480
+ # @return [Object] Deserialized data
481
+ def _deserialize(type, value)
482
+ case type.to_sym
483
+ when :Time
484
+ Time.parse(value)
485
+ when :Date
486
+ Date.parse(value)
487
+ when :String
488
+ value.to_s
489
+ when :Integer
490
+ value.to_i
491
+ when :Float
492
+ value.to_f
493
+ when :Boolean
494
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
495
+ true
496
+ else
497
+ false
498
+ end
499
+ when :Object
500
+ # generic object (usually a Hash), return directly
501
+ value
502
+ when /\AArray<(?<inner_type>.+)>\z/
503
+ inner_type = Regexp.last_match[:inner_type]
504
+ value.map { |v| _deserialize(inner_type, v) }
505
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
506
+ k_type = Regexp.last_match[:k_type]
507
+ v_type = Regexp.last_match[:v_type]
508
+ {}.tap do |hash|
509
+ value.each do |k, v|
510
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
511
+ end
512
+ end
513
+ else # model
514
+ # models (e.g. Pet) or oneOf
515
+ klass = OpenapiClient.const_get(type)
516
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
517
+ end
518
+ end
519
+
520
+ # Returns the string representation of the object
521
+ # @return [String] String presentation of the object
522
+ def to_s
523
+ to_hash.to_s
524
+ end
525
+
526
+ # to_body is an alias to to_hash (backward compatibility)
527
+ # @return [Hash] Returns the object in the form of hash
528
+ def to_body
529
+ to_hash
530
+ end
531
+
532
+ # Returns the object in the form of hash
533
+ # @return [Hash] Returns the object in the form of hash
534
+ def to_hash
535
+ hash = {}
536
+ self.class.attribute_map.each_pair do |attr, param|
537
+ value = self.send(attr)
538
+ if value.nil?
539
+ is_nullable = self.class.openapi_nullable.include?(attr)
540
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
541
+ end
542
+
543
+ hash[param] = _to_hash(value)
544
+ end
545
+ hash
546
+ end
547
+
548
+ # Outputs non-array value in the form of hash
549
+ # For object, use to_hash. Otherwise, just return the value
550
+ # @param [Object] value Any valid value
551
+ # @return [Hash] Returns the value in the form of hash
552
+ def _to_hash(value)
553
+ if value.is_a?(Array)
554
+ value.compact.map { |v| _to_hash(v) }
555
+ elsif value.is_a?(Hash)
556
+ {}.tap do |hash|
557
+ value.each { |k, v| hash[k] = _to_hash(v) }
558
+ end
559
+ elsif value.respond_to? :to_hash
560
+ value.to_hash
561
+ else
562
+ value
563
+ end
564
+ end
565
+
566
+ end
567
+
568
+ end