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,608 @@
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 EmployeeResponse
18
+ # The Affix-assigned id of the individual
19
+ attr_accessor :id
20
+
21
+ # the remote system-assigned id of the individual
22
+ attr_accessor :remote_id
23
+
24
+ attr_accessor :employee_number
25
+
26
+ # the first name of the individual
27
+ attr_accessor :first_name
28
+
29
+ # the last name of the individual
30
+ attr_accessor :last_name
31
+
32
+ attr_accessor :display_full_name
33
+
34
+ attr_accessor :nationality
35
+
36
+ attr_accessor :job_title
37
+
38
+ # the work email of the individual
39
+ attr_accessor :work_email
40
+
41
+ # the personal email of the individual
42
+ attr_accessor :personal_email
43
+
44
+ # +1234567890
45
+ attr_accessor :mobile_phone_number
46
+
47
+ attr_accessor :tax_id
48
+
49
+ attr_accessor :gender
50
+
51
+ attr_accessor :ethnicity
52
+
53
+ attr_accessor :marital_status
54
+
55
+ attr_accessor :date_of_birth
56
+
57
+ attr_accessor :employment_status
58
+
59
+ attr_accessor :employment_type
60
+
61
+ attr_accessor :start_date
62
+
63
+ attr_accessor :remote_created_at
64
+
65
+ attr_accessor :termination_date
66
+
67
+ attr_accessor :avatar
68
+
69
+ attr_accessor :home_location
70
+
71
+ attr_accessor :work_location
72
+
73
+ attr_accessor :manager
74
+
75
+ attr_accessor :bank_account
76
+
77
+ attr_accessor :employments
78
+
79
+ attr_accessor :custom_fields
80
+
81
+ attr_accessor :groups
82
+
83
+ class EnumAttributeValidator
84
+ attr_reader :datatype
85
+ attr_reader :allowable_values
86
+
87
+ def initialize(datatype, allowable_values)
88
+ @allowable_values = allowable_values.map do |value|
89
+ case datatype.to_s
90
+ when /Integer/i
91
+ value.to_i
92
+ when /Float/i
93
+ value.to_f
94
+ else
95
+ value
96
+ end
97
+ end
98
+ end
99
+
100
+ def valid?(value)
101
+ !value || allowable_values.include?(value)
102
+ end
103
+ end
104
+
105
+ # Attribute mapping from ruby-style variable name to JSON key.
106
+ def self.attribute_map
107
+ {
108
+ :'id' => :'id',
109
+ :'remote_id' => :'remote_id',
110
+ :'employee_number' => :'employee_number',
111
+ :'first_name' => :'first_name',
112
+ :'last_name' => :'last_name',
113
+ :'display_full_name' => :'display_full_name',
114
+ :'nationality' => :'nationality',
115
+ :'job_title' => :'job_title',
116
+ :'work_email' => :'work_email',
117
+ :'personal_email' => :'personal_email',
118
+ :'mobile_phone_number' => :'mobile_phone_number',
119
+ :'tax_id' => :'tax_id',
120
+ :'gender' => :'gender',
121
+ :'ethnicity' => :'ethnicity',
122
+ :'marital_status' => :'marital_status',
123
+ :'date_of_birth' => :'date_of_birth',
124
+ :'employment_status' => :'employment_status',
125
+ :'employment_type' => :'employment_type',
126
+ :'start_date' => :'start_date',
127
+ :'remote_created_at' => :'remote_created_at',
128
+ :'termination_date' => :'termination_date',
129
+ :'avatar' => :'avatar',
130
+ :'home_location' => :'home_location',
131
+ :'work_location' => :'work_location',
132
+ :'manager' => :'manager',
133
+ :'bank_account' => :'bank_account',
134
+ :'employments' => :'employments',
135
+ :'custom_fields' => :'custom_fields',
136
+ :'groups' => :'groups'
137
+ }
138
+ end
139
+
140
+ # Returns all the JSON keys this model knows about
141
+ def self.acceptable_attributes
142
+ attribute_map.values
143
+ end
144
+
145
+ # Attribute type mapping.
146
+ def self.openapi_types
147
+ {
148
+ :'id' => :'String',
149
+ :'remote_id' => :'String',
150
+ :'employee_number' => :'String',
151
+ :'first_name' => :'String',
152
+ :'last_name' => :'String',
153
+ :'display_full_name' => :'String',
154
+ :'nationality' => :'String',
155
+ :'job_title' => :'String',
156
+ :'work_email' => :'String',
157
+ :'personal_email' => :'String',
158
+ :'mobile_phone_number' => :'String',
159
+ :'tax_id' => :'String',
160
+ :'gender' => :'String',
161
+ :'ethnicity' => :'String',
162
+ :'marital_status' => :'String',
163
+ :'date_of_birth' => :'Date',
164
+ :'employment_status' => :'String',
165
+ :'employment_type' => :'String',
166
+ :'start_date' => :'Date',
167
+ :'remote_created_at' => :'Date',
168
+ :'termination_date' => :'Date',
169
+ :'avatar' => :'String',
170
+ :'home_location' => :'AddressResponse',
171
+ :'work_location' => :'LocationResponse',
172
+ :'manager' => :'CreateEmployeeRequestManager',
173
+ :'bank_account' => :'CreateEmployeeRequestBankAccount',
174
+ :'employments' => :'Array<EmploymentResponse>',
175
+ :'custom_fields' => :'Object',
176
+ :'groups' => :'Array<GroupResponse>'
177
+ }
178
+ end
179
+
180
+ # List of attributes with nullable: true
181
+ def self.openapi_nullable
182
+ Set.new([
183
+ :'employee_number',
184
+ :'display_full_name',
185
+ :'nationality',
186
+ :'job_title',
187
+ :'work_email',
188
+ :'personal_email',
189
+ :'mobile_phone_number',
190
+ :'tax_id',
191
+ :'gender',
192
+ :'ethnicity',
193
+ :'marital_status',
194
+ :'date_of_birth',
195
+ :'employment_status',
196
+ :'employment_type',
197
+ :'start_date',
198
+ :'remote_created_at',
199
+ :'termination_date',
200
+ :'avatar',
201
+ :'home_location',
202
+ :'work_location',
203
+ :'manager',
204
+ :'bank_account',
205
+ :'employments',
206
+ :'custom_fields',
207
+ :'groups'
208
+ ])
209
+ end
210
+
211
+ # Initializes the object
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ def initialize(attributes = {})
214
+ if (!attributes.is_a?(Hash))
215
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::EmployeeResponse` initialize method"
216
+ end
217
+
218
+ # check to see if the attribute exists and convert string to symbol for hash key
219
+ attributes = attributes.each_with_object({}) { |(k, v), h|
220
+ if (!self.class.attribute_map.key?(k.to_sym))
221
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::EmployeeResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
222
+ end
223
+ h[k.to_sym] = v
224
+ }
225
+
226
+ if attributes.key?(:'id')
227
+ self.id = attributes[:'id']
228
+ end
229
+
230
+ if attributes.key?(:'remote_id')
231
+ self.remote_id = attributes[:'remote_id']
232
+ end
233
+
234
+ if attributes.key?(:'employee_number')
235
+ self.employee_number = attributes[:'employee_number']
236
+ end
237
+
238
+ if attributes.key?(:'first_name')
239
+ self.first_name = attributes[:'first_name']
240
+ end
241
+
242
+ if attributes.key?(:'last_name')
243
+ self.last_name = attributes[:'last_name']
244
+ end
245
+
246
+ if attributes.key?(:'display_full_name')
247
+ self.display_full_name = attributes[:'display_full_name']
248
+ end
249
+
250
+ if attributes.key?(:'nationality')
251
+ self.nationality = attributes[:'nationality']
252
+ end
253
+
254
+ if attributes.key?(:'job_title')
255
+ self.job_title = attributes[:'job_title']
256
+ end
257
+
258
+ if attributes.key?(:'work_email')
259
+ self.work_email = attributes[:'work_email']
260
+ end
261
+
262
+ if attributes.key?(:'personal_email')
263
+ self.personal_email = attributes[:'personal_email']
264
+ end
265
+
266
+ if attributes.key?(:'mobile_phone_number')
267
+ self.mobile_phone_number = attributes[:'mobile_phone_number']
268
+ end
269
+
270
+ if attributes.key?(:'tax_id')
271
+ self.tax_id = attributes[:'tax_id']
272
+ end
273
+
274
+ if attributes.key?(:'gender')
275
+ self.gender = attributes[:'gender']
276
+ end
277
+
278
+ if attributes.key?(:'ethnicity')
279
+ self.ethnicity = attributes[:'ethnicity']
280
+ end
281
+
282
+ if attributes.key?(:'marital_status')
283
+ self.marital_status = attributes[:'marital_status']
284
+ end
285
+
286
+ if attributes.key?(:'date_of_birth')
287
+ self.date_of_birth = attributes[:'date_of_birth']
288
+ end
289
+
290
+ if attributes.key?(:'employment_status')
291
+ self.employment_status = attributes[:'employment_status']
292
+ end
293
+
294
+ if attributes.key?(:'employment_type')
295
+ self.employment_type = attributes[:'employment_type']
296
+ end
297
+
298
+ if attributes.key?(:'start_date')
299
+ self.start_date = attributes[:'start_date']
300
+ end
301
+
302
+ if attributes.key?(:'remote_created_at')
303
+ self.remote_created_at = attributes[:'remote_created_at']
304
+ end
305
+
306
+ if attributes.key?(:'termination_date')
307
+ self.termination_date = attributes[:'termination_date']
308
+ end
309
+
310
+ if attributes.key?(:'avatar')
311
+ self.avatar = attributes[:'avatar']
312
+ end
313
+
314
+ if attributes.key?(:'home_location')
315
+ self.home_location = attributes[:'home_location']
316
+ end
317
+
318
+ if attributes.key?(:'work_location')
319
+ self.work_location = attributes[:'work_location']
320
+ end
321
+
322
+ if attributes.key?(:'manager')
323
+ self.manager = attributes[:'manager']
324
+ end
325
+
326
+ if attributes.key?(:'bank_account')
327
+ self.bank_account = attributes[:'bank_account']
328
+ end
329
+
330
+ if attributes.key?(:'employments')
331
+ if (value = attributes[:'employments']).is_a?(Array)
332
+ self.employments = value
333
+ end
334
+ end
335
+
336
+ if attributes.key?(:'custom_fields')
337
+ self.custom_fields = attributes[:'custom_fields']
338
+ end
339
+
340
+ if attributes.key?(:'groups')
341
+ if (value = attributes[:'groups']).is_a?(Array)
342
+ self.groups = value
343
+ end
344
+ end
345
+ end
346
+
347
+ # Show invalid properties with the reasons. Usually used together with valid?
348
+ # @return Array for valid properties with the reasons
349
+ def list_invalid_properties
350
+ invalid_properties = Array.new
351
+ if @id.nil?
352
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
353
+ end
354
+
355
+ if @remote_id.nil?
356
+ invalid_properties.push('invalid value for "remote_id", remote_id cannot be nil.')
357
+ end
358
+
359
+ if @first_name.nil?
360
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
361
+ end
362
+
363
+ if @last_name.nil?
364
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
365
+ end
366
+
367
+ invalid_properties
368
+ end
369
+
370
+ # Check to see if the all the properties in the model are valid
371
+ # @return true if the model is valid
372
+ def valid?
373
+ return false if @id.nil?
374
+ return false if @remote_id.nil?
375
+ return false if @first_name.nil?
376
+ return false if @last_name.nil?
377
+ gender_validator = EnumAttributeValidator.new('String', ["male", "female", "not_specified", "null"])
378
+ return false unless gender_validator.valid?(@gender)
379
+ ethnicity_validator = EnumAttributeValidator.new('String', ["null", "asian", "black", "hispanic", "mixed", "not_specified", "other", "white"])
380
+ return false unless ethnicity_validator.valid?(@ethnicity)
381
+ marital_status_validator = EnumAttributeValidator.new('String', ["single", "married", "not_specified", "null"])
382
+ return false unless marital_status_validator.valid?(@marital_status)
383
+ employment_status_validator = EnumAttributeValidator.new('String', ["null", "active", "inactive", "pending", "leave"])
384
+ return false unless employment_status_validator.valid?(@employment_status)
385
+ employment_type_validator = EnumAttributeValidator.new('String', ["null", "full_time", "part_time", "contractor", "other"])
386
+ return false unless employment_type_validator.valid?(@employment_type)
387
+ true
388
+ end
389
+
390
+ # Custom attribute writer method checking allowed values (enum).
391
+ # @param [Object] gender Object to be assigned
392
+ def gender=(gender)
393
+ validator = EnumAttributeValidator.new('String', ["male", "female", "not_specified", "null"])
394
+ unless validator.valid?(gender)
395
+ fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
396
+ end
397
+ @gender = gender
398
+ end
399
+
400
+ # Custom attribute writer method checking allowed values (enum).
401
+ # @param [Object] ethnicity Object to be assigned
402
+ def ethnicity=(ethnicity)
403
+ validator = EnumAttributeValidator.new('String', ["null", "asian", "black", "hispanic", "mixed", "not_specified", "other", "white"])
404
+ unless validator.valid?(ethnicity)
405
+ fail ArgumentError, "invalid value for \"ethnicity\", must be one of #{validator.allowable_values}."
406
+ end
407
+ @ethnicity = ethnicity
408
+ end
409
+
410
+ # Custom attribute writer method checking allowed values (enum).
411
+ # @param [Object] marital_status Object to be assigned
412
+ def marital_status=(marital_status)
413
+ validator = EnumAttributeValidator.new('String', ["single", "married", "not_specified", "null"])
414
+ unless validator.valid?(marital_status)
415
+ fail ArgumentError, "invalid value for \"marital_status\", must be one of #{validator.allowable_values}."
416
+ end
417
+ @marital_status = marital_status
418
+ end
419
+
420
+ # Custom attribute writer method checking allowed values (enum).
421
+ # @param [Object] employment_status Object to be assigned
422
+ def employment_status=(employment_status)
423
+ validator = EnumAttributeValidator.new('String', ["null", "active", "inactive", "pending", "leave"])
424
+ unless validator.valid?(employment_status)
425
+ fail ArgumentError, "invalid value for \"employment_status\", must be one of #{validator.allowable_values}."
426
+ end
427
+ @employment_status = employment_status
428
+ end
429
+
430
+ # Custom attribute writer method checking allowed values (enum).
431
+ # @param [Object] employment_type Object to be assigned
432
+ def employment_type=(employment_type)
433
+ validator = EnumAttributeValidator.new('String', ["null", "full_time", "part_time", "contractor", "other"])
434
+ unless validator.valid?(employment_type)
435
+ fail ArgumentError, "invalid value for \"employment_type\", must be one of #{validator.allowable_values}."
436
+ end
437
+ @employment_type = employment_type
438
+ end
439
+
440
+ # Checks equality by comparing each attribute.
441
+ # @param [Object] Object to be compared
442
+ def ==(o)
443
+ return true if self.equal?(o)
444
+ self.class == o.class &&
445
+ id == o.id &&
446
+ remote_id == o.remote_id &&
447
+ employee_number == o.employee_number &&
448
+ first_name == o.first_name &&
449
+ last_name == o.last_name &&
450
+ display_full_name == o.display_full_name &&
451
+ nationality == o.nationality &&
452
+ job_title == o.job_title &&
453
+ work_email == o.work_email &&
454
+ personal_email == o.personal_email &&
455
+ mobile_phone_number == o.mobile_phone_number &&
456
+ tax_id == o.tax_id &&
457
+ gender == o.gender &&
458
+ ethnicity == o.ethnicity &&
459
+ marital_status == o.marital_status &&
460
+ date_of_birth == o.date_of_birth &&
461
+ employment_status == o.employment_status &&
462
+ employment_type == o.employment_type &&
463
+ start_date == o.start_date &&
464
+ remote_created_at == o.remote_created_at &&
465
+ termination_date == o.termination_date &&
466
+ avatar == o.avatar &&
467
+ home_location == o.home_location &&
468
+ work_location == o.work_location &&
469
+ manager == o.manager &&
470
+ bank_account == o.bank_account &&
471
+ employments == o.employments &&
472
+ custom_fields == o.custom_fields &&
473
+ groups == o.groups
474
+ end
475
+
476
+ # @see the `==` method
477
+ # @param [Object] Object to be compared
478
+ def eql?(o)
479
+ self == o
480
+ end
481
+
482
+ # Calculates hash code according to all attributes.
483
+ # @return [Integer] Hash code
484
+ def hash
485
+ [id, remote_id, 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, remote_created_at, termination_date, avatar, home_location, work_location, manager, bank_account, employments, custom_fields, groups].hash
486
+ end
487
+
488
+ # Builds the object from hash
489
+ # @param [Hash] attributes Model attributes in the form of hash
490
+ # @return [Object] Returns the model itself
491
+ def self.build_from_hash(attributes)
492
+ new.build_from_hash(attributes)
493
+ end
494
+
495
+ # Builds the object from hash
496
+ # @param [Hash] attributes Model attributes in the form of hash
497
+ # @return [Object] Returns the model itself
498
+ def build_from_hash(attributes)
499
+ return nil unless attributes.is_a?(Hash)
500
+ self.class.openapi_types.each_pair do |key, type|
501
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
502
+ self.send("#{key}=", nil)
503
+ elsif type =~ /\AArray<(.*)>/i
504
+ # check to ensure the input is an array given that the attribute
505
+ # is documented as an array but the input is not
506
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
507
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
508
+ end
509
+ elsif !attributes[self.class.attribute_map[key]].nil?
510
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
511
+ end
512
+ end
513
+
514
+ self
515
+ end
516
+
517
+ # Deserializes the data based on type
518
+ # @param string type Data type
519
+ # @param string value Value to be deserialized
520
+ # @return [Object] Deserialized data
521
+ def _deserialize(type, value)
522
+ case type.to_sym
523
+ when :Time
524
+ Time.parse(value)
525
+ when :Date
526
+ Date.parse(value)
527
+ when :String
528
+ value.to_s
529
+ when :Integer
530
+ value.to_i
531
+ when :Float
532
+ value.to_f
533
+ when :Boolean
534
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
535
+ true
536
+ else
537
+ false
538
+ end
539
+ when :Object
540
+ # generic object (usually a Hash), return directly
541
+ value
542
+ when /\AArray<(?<inner_type>.+)>\z/
543
+ inner_type = Regexp.last_match[:inner_type]
544
+ value.map { |v| _deserialize(inner_type, v) }
545
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
546
+ k_type = Regexp.last_match[:k_type]
547
+ v_type = Regexp.last_match[:v_type]
548
+ {}.tap do |hash|
549
+ value.each do |k, v|
550
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
551
+ end
552
+ end
553
+ else # model
554
+ # models (e.g. Pet) or oneOf
555
+ klass = OpenapiClient.const_get(type)
556
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
557
+ end
558
+ end
559
+
560
+ # Returns the string representation of the object
561
+ # @return [String] String presentation of the object
562
+ def to_s
563
+ to_hash.to_s
564
+ end
565
+
566
+ # to_body is an alias to to_hash (backward compatibility)
567
+ # @return [Hash] Returns the object in the form of hash
568
+ def to_body
569
+ to_hash
570
+ end
571
+
572
+ # Returns the object in the form of hash
573
+ # @return [Hash] Returns the object in the form of hash
574
+ def to_hash
575
+ hash = {}
576
+ self.class.attribute_map.each_pair do |attr, param|
577
+ value = self.send(attr)
578
+ if value.nil?
579
+ is_nullable = self.class.openapi_nullable.include?(attr)
580
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
581
+ end
582
+
583
+ hash[param] = _to_hash(value)
584
+ end
585
+ hash
586
+ end
587
+
588
+ # Outputs non-array value in the form of hash
589
+ # For object, use to_hash. Otherwise, just return the value
590
+ # @param [Object] value Any valid value
591
+ # @return [Hash] Returns the value in the form of hash
592
+ def _to_hash(value)
593
+ if value.is_a?(Array)
594
+ value.compact.map { |v| _to_hash(v) }
595
+ elsif value.is_a?(Hash)
596
+ {}.tap do |hash|
597
+ value.each { |k, v| hash[k] = _to_hash(v) }
598
+ end
599
+ elsif value.respond_to? :to_hash
600
+ value.to_hash
601
+ else
602
+ value
603
+ end
604
+ end
605
+
606
+ end
607
+
608
+ end