doorflow 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +27 -0
  3. data/LICENSE +21 -0
  4. data/README.md +356 -0
  5. data/bin/post-generate +47 -0
  6. data/doorflow.gemspec +55 -0
  7. data/lib/doorflow/auth/doorflow_auth.rb +308 -0
  8. data/lib/doorflow/auth/file_token_storage.rb +104 -0
  9. data/lib/doorflow/auth/token_storage.rb +106 -0
  10. data/lib/doorflow/auth.rb +32 -0
  11. data/lib/doorflow/client/account_proxy.rb +19 -0
  12. data/lib/doorflow/client/channels_proxy.rb +64 -0
  13. data/lib/doorflow/client/credential_types_proxy.rb +28 -0
  14. data/lib/doorflow/client/credentials_proxy.rb +73 -0
  15. data/lib/doorflow/client/events_proxy.rb +33 -0
  16. data/lib/doorflow/client/group_reservations_proxy.rb +46 -0
  17. data/lib/doorflow/client/groups_proxy.rb +51 -0
  18. data/lib/doorflow/client/notification_rules_proxy.rb +46 -0
  19. data/lib/doorflow/client/people_proxy.rb +69 -0
  20. data/lib/doorflow/client/reservations_proxy.rb +46 -0
  21. data/lib/doorflow/client/resource_proxy.rb +113 -0
  22. data/lib/doorflow/client/roles_proxy.rb +28 -0
  23. data/lib/doorflow/client/sites_proxy.rb +28 -0
  24. data/lib/doorflow/client.rb +263 -0
  25. data/lib/doorflow/errors/api_error.rb +28 -0
  26. data/lib/doorflow/errors/authentication_error.rb +23 -0
  27. data/lib/doorflow/errors/doorflow_error.rb +75 -0
  28. data/lib/doorflow/errors/forbidden_error.rb +22 -0
  29. data/lib/doorflow/errors/not_found_error.rb +22 -0
  30. data/lib/doorflow/errors/rate_limit_error.rb +65 -0
  31. data/lib/doorflow/errors/validation_error.rb +83 -0
  32. data/lib/doorflow/errors.rb +152 -0
  33. data/lib/doorflow/list_object.rb +125 -0
  34. data/lib/doorflow/resource.rb +153 -0
  35. data/lib/doorflow/resources/account.rb +66 -0
  36. data/lib/doorflow/resources/channel.rb +104 -0
  37. data/lib/doorflow/resources/credential.rb +73 -0
  38. data/lib/doorflow/resources/credential_type.rb +30 -0
  39. data/lib/doorflow/resources/event.rb +47 -0
  40. data/lib/doorflow/resources/group.rb +71 -0
  41. data/lib/doorflow/resources/group_reservation.rb +55 -0
  42. data/lib/doorflow/resources/notification_rule.rb +71 -0
  43. data/lib/doorflow/resources/person.rb +102 -0
  44. data/lib/doorflow/resources/reservation.rb +72 -0
  45. data/lib/doorflow/resources/role.rb +66 -0
  46. data/lib/doorflow/resources/site.rb +66 -0
  47. data/lib/doorflow/webhooks/event.rb +92 -0
  48. data/lib/doorflow/webhooks/handler.rb +206 -0
  49. data/lib/doorflow/webhooks/signature_verifier.rb +120 -0
  50. data/lib/doorflow/webhooks.rb +47 -0
  51. data/lib/doorflow-api/api/accounts_api.rb +79 -0
  52. data/lib/doorflow-api/api/admission_requests_api.rb +85 -0
  53. data/lib/doorflow-api/api/channels_api.rb +757 -0
  54. data/lib/doorflow-api/api/credential_types_api.rb +88 -0
  55. data/lib/doorflow-api/api/credentials_api.rb +458 -0
  56. data/lib/doorflow-api/api/events_api.rb +190 -0
  57. data/lib/doorflow-api/api/group_reservations_api.rb +225 -0
  58. data/lib/doorflow-api/api/groups_api.rb +79 -0
  59. data/lib/doorflow-api/api/notification_rules_api.rb +347 -0
  60. data/lib/doorflow-api/api/oauth_api.rb +360 -0
  61. data/lib/doorflow-api/api/people_api.rb +372 -0
  62. data/lib/doorflow-api/api/reservations_api.rb +225 -0
  63. data/lib/doorflow-api/api/roles_api.rb +79 -0
  64. data/lib/doorflow-api/api/sites_api.rb +88 -0
  65. data/lib/doorflow-api/api/sync_api.rb +79 -0
  66. data/lib/doorflow-api/api_client.rb +437 -0
  67. data/lib/doorflow-api/api_error.rb +63 -0
  68. data/lib/doorflow-api/api_model_base.rb +88 -0
  69. data/lib/doorflow-api/configuration.rb +399 -0
  70. data/lib/doorflow-api/models/account.rb +334 -0
  71. data/lib/doorflow-api/models/account_passport.rb +193 -0
  72. data/lib/doorflow-api/models/account_reseller.rb +192 -0
  73. data/lib/doorflow-api/models/account_sync.rb +214 -0
  74. data/lib/doorflow-api/models/account_user.rb +247 -0
  75. data/lib/doorflow-api/models/admission_request.rb +328 -0
  76. data/lib/doorflow-api/models/admission_request_door_controller.rb +159 -0
  77. data/lib/doorflow-api/models/admission_request_person.rb +159 -0
  78. data/lib/doorflow-api/models/admit_channel202_response.rb +192 -0
  79. data/lib/doorflow-api/models/admit_person202_response.rb +192 -0
  80. data/lib/doorflow-api/models/admit_person403_response.rb +157 -0
  81. data/lib/doorflow-api/models/admit_person_request.rb +165 -0
  82. data/lib/doorflow-api/models/auto_unlock_channel400_response.rb +156 -0
  83. data/lib/doorflow-api/models/auto_unlock_channel_request.rb +149 -0
  84. data/lib/doorflow-api/models/channel.rb +498 -0
  85. data/lib/doorflow-api/models/channel_auto_unlock.rb +159 -0
  86. data/lib/doorflow-api/models/channel_lockdown.rb +176 -0
  87. data/lib/doorflow-api/models/channel_lockdown_aux_lockdown.rb +148 -0
  88. data/lib/doorflow-api/models/channel_lockdown_card_lockdown.rb +148 -0
  89. data/lib/doorflow-api/models/channel_lockdown_rex_lockdown.rb +148 -0
  90. data/lib/doorflow-api/models/channel_mode.rb +212 -0
  91. data/lib/doorflow-api/models/channel_sync.rb +200 -0
  92. data/lib/doorflow-api/models/create_credential422_response.rb +157 -0
  93. data/lib/doorflow-api/models/create_credential422_response_errors.rb +173 -0
  94. data/lib/doorflow-api/models/credential.rb +336 -0
  95. data/lib/doorflow-api/models/credential_input.rb +164 -0
  96. data/lib/doorflow-api/models/credential_input_person_credential.rb +187 -0
  97. data/lib/doorflow-api/models/credential_type.rb +232 -0
  98. data/lib/doorflow-api/models/credential_update_input.rb +164 -0
  99. data/lib/doorflow-api/models/credential_update_input_person_credential.rb +165 -0
  100. data/lib/doorflow-api/models/delete_group_reservation200_response.rb +147 -0
  101. data/lib/doorflow-api/models/error.rb +192 -0
  102. data/lib/doorflow-api/models/event.rb +361 -0
  103. data/lib/doorflow-api/models/get_access_token200_response.rb +266 -0
  104. data/lib/doorflow-api/models/get_access_token400_response.rb +190 -0
  105. data/lib/doorflow-api/models/get_access_token401_response.rb +156 -0
  106. data/lib/doorflow-api/models/get_admission_request401_response.rb +156 -0
  107. data/lib/doorflow-api/models/get_admission_request403_response.rb +156 -0
  108. data/lib/doorflow-api/models/get_admission_request404_response.rb +156 -0
  109. data/lib/doorflow-api/models/get_admission_request500_response.rb +156 -0
  110. data/lib/doorflow-api/models/get_token_info200_response.rb +267 -0
  111. data/lib/doorflow-api/models/get_token_info200_response_application.rb +148 -0
  112. data/lib/doorflow-api/models/get_token_info401_response.rb +156 -0
  113. data/lib/doorflow-api/models/group.rb +284 -0
  114. data/lib/doorflow-api/models/group_reservation.rb +380 -0
  115. data/lib/doorflow-api/models/group_reservation_input.rb +164 -0
  116. data/lib/doorflow-api/models/group_reservation_input_group_reservation.rb +257 -0
  117. data/lib/doorflow-api/models/initiate_sync429_response.rb +243 -0
  118. data/lib/doorflow-api/models/list_events400_response.rb +156 -0
  119. data/lib/doorflow-api/models/lockdown_channel_request.rb +168 -0
  120. data/lib/doorflow-api/models/notification_rule.rb +324 -0
  121. data/lib/doorflow-api/models/notification_rule_actions_inner.rb +168 -0
  122. data/lib/doorflow-api/models/notification_rule_conditions_inner.rb +168 -0
  123. data/lib/doorflow-api/models/notification_rule_events_inner.rb +158 -0
  124. data/lib/doorflow-api/models/notification_rule_input.rb +254 -0
  125. data/lib/doorflow-api/models/person.rb +511 -0
  126. data/lib/doorflow-api/models/person_input.rb +413 -0
  127. data/lib/doorflow-api/models/reservation.rb +329 -0
  128. data/lib/doorflow-api/models/reservation_input.rb +281 -0
  129. data/lib/doorflow-api/models/revoke_token403_response.rb +156 -0
  130. data/lib/doorflow-api/models/role.rb +268 -0
  131. data/lib/doorflow-api/models/site.rb +254 -0
  132. data/lib/doorflow-api/models/site_site_ips_inner.rb +148 -0
  133. data/lib/doorflow-api/models/unlock_channel_request.rb +148 -0
  134. data/lib/doorflow-api/version.rb +15 -0
  135. data/lib/doorflow-api.rb +123 -0
  136. data/lib/doorflow.rb +171 -0
  137. data/spec/api/admission_requests_api_spec.rb +47 -0
  138. data/spec/api/channels_api_spec.rb +174 -0
  139. data/spec/api/credential_types_api_spec.rb +49 -0
  140. data/spec/api/group_reservations_api_spec.rb +75 -0
  141. data/spec/api/oauth_api_spec.rb +97 -0
  142. data/spec/doorflow/client_spec.rb +109 -0
  143. data/spec/doorflow_spec.rb +22 -0
  144. data/spec/fixtures/vcr_cassettes/channel/list.yml +70 -0
  145. data/spec/fixtures/vcr_cassettes/channel/retrieve.yml +131 -0
  146. data/spec/fixtures/vcr_cassettes/person/auto_pagination.yml +87 -0
  147. data/spec/fixtures/vcr_cassettes/person/create.yml +64 -0
  148. data/spec/fixtures/vcr_cassettes/person/delete.yml +125 -0
  149. data/spec/fixtures/vcr_cassettes/person/list.yml +90 -0
  150. data/spec/fixtures/vcr_cassettes/person/not_found.yml +62 -0
  151. data/spec/fixtures/vcr_cassettes/person/retrieve.yml +136 -0
  152. data/spec/fixtures/vcr_cassettes/person/update.yml +260 -0
  153. data/spec/fixtures/vcr_cassettes/person/validation_error.yml +62 -0
  154. data/spec/integration/channel_spec.rb +88 -0
  155. data/spec/integration/person_spec.rb +99 -0
  156. data/spec/models/account_passport_spec.rb +42 -0
  157. data/spec/models/account_reseller_spec.rb +60 -0
  158. data/spec/models/account_sync_spec.rb +52 -0
  159. data/spec/models/account_user_spec.rb +54 -0
  160. data/spec/models/admission_request_door_controller_spec.rb +42 -0
  161. data/spec/models/admission_request_person_spec.rb +42 -0
  162. data/spec/models/admission_request_spec.rb +82 -0
  163. data/spec/models/admit_channel202_response_spec.rb +46 -0
  164. data/spec/models/admit_person202_response_spec.rb +46 -0
  165. data/spec/models/admit_person403_response_spec.rb +42 -0
  166. data/spec/models/admit_person_request_spec.rb +36 -0
  167. data/spec/models/auto_unlock_channel400_response_spec.rb +42 -0
  168. data/spec/models/auto_unlock_channel_request_spec.rb +36 -0
  169. data/spec/models/channel_auto_unlock_spec.rb +42 -0
  170. data/spec/models/channel_lockdown_aux_lockdown_spec.rb +36 -0
  171. data/spec/models/channel_lockdown_card_lockdown_spec.rb +36 -0
  172. data/spec/models/channel_lockdown_rex_lockdown_spec.rb +36 -0
  173. data/spec/models/channel_lockdown_spec.rb +54 -0
  174. data/spec/models/channel_mode_spec.rb +52 -0
  175. data/spec/models/channel_sync_spec.rb +46 -0
  176. data/spec/models/create_credential422_response_errors_spec.rb +48 -0
  177. data/spec/models/create_credential422_response_spec.rb +42 -0
  178. data/spec/models/credential_input_person_credential_spec.rb +48 -0
  179. data/spec/models/credential_input_spec.rb +36 -0
  180. data/spec/models/credential_spec.rb +86 -0
  181. data/spec/models/credential_update_input_person_credential_spec.rb +36 -0
  182. data/spec/models/credential_update_input_spec.rb +36 -0
  183. data/spec/models/delete_group_reservation200_response_spec.rb +36 -0
  184. data/spec/models/error_spec.rb +42 -0
  185. data/spec/models/get_access_token200_response_spec.rb +66 -0
  186. data/spec/models/get_access_token400_response_spec.rb +46 -0
  187. data/spec/models/get_access_token401_response_spec.rb +42 -0
  188. data/spec/models/get_admission_request401_response_spec.rb +42 -0
  189. data/spec/models/get_admission_request403_response_spec.rb +42 -0
  190. data/spec/models/get_admission_request404_response_spec.rb +42 -0
  191. data/spec/models/get_admission_request500_response_spec.rb +42 -0
  192. data/spec/models/get_token_info200_response_application_spec.rb +36 -0
  193. data/spec/models/get_token_info200_response_spec.rb +66 -0
  194. data/spec/models/get_token_info401_response_spec.rb +42 -0
  195. data/spec/models/group_reservation_input_group_reservation_spec.rb +54 -0
  196. data/spec/models/group_reservation_input_spec.rb +36 -0
  197. data/spec/models/group_reservation_spec.rb +82 -0
  198. data/spec/models/initiate_sync429_response_spec.rb +52 -0
  199. data/spec/models/list_events400_response_spec.rb +42 -0
  200. data/spec/models/lockdown_channel_request_spec.rb +48 -0
  201. data/spec/models/notification_rule_actions_inner_spec.rb +48 -0
  202. data/spec/models/notification_rule_conditions_inner_spec.rb +48 -0
  203. data/spec/models/notification_rule_events_inner_spec.rb +42 -0
  204. data/spec/models/notification_rule_input_spec.rb +60 -0
  205. data/spec/models/person_input_spec.rb +180 -0
  206. data/spec/models/reservation_input_spec.rb +60 -0
  207. data/spec/models/revoke_token403_response_spec.rb +42 -0
  208. data/spec/models/site_site_ips_inner_spec.rb +36 -0
  209. data/spec/models/unlock_channel_request_spec.rb +36 -0
  210. data/spec/spec_helper.rb +160 -0
  211. metadata +495 -0
@@ -0,0 +1,511 @@
1
+ =begin
2
+ #DoorFlow API
3
+
4
+ #Access control and door management API for DoorFlow
5
+
6
+ The version of the OpenAPI document: 3.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DoorFlow
17
+ class Person < ApiModelBase
18
+ # Unique identifier for the person
19
+ attr_accessor :id
20
+
21
+ # First name (required)
22
+ attr_accessor :first_name
23
+
24
+ # Last name (required)
25
+ attr_accessor :last_name
26
+
27
+ # Salutation or title (Mr., Ms., Dr., etc.)
28
+ attr_accessor :salutation
29
+
30
+ # Job title
31
+ attr_accessor :job_title
32
+
33
+ # Email address (must be unique within account if provided)
34
+ attr_accessor :email
35
+
36
+ # Organisation ID
37
+ attr_accessor :organisation_id
38
+
39
+ # External system identifier
40
+ attr_accessor :system_id
41
+
42
+ # Department name
43
+ attr_accessor :department
44
+
45
+ # Whether the person is currently enabled for access
46
+ attr_accessor :enabled
47
+
48
+ # Access valid from this date/time
49
+ attr_accessor :valid_from
50
+
51
+ # Access valid until this date/time
52
+ attr_accessor :valid_to
53
+
54
+ # URL to person's full-size photo
55
+ attr_accessor :image_url
56
+
57
+ # URL to person's thumbnail photo
58
+ attr_accessor :image_thumbnail_url
59
+
60
+ # Telephone number
61
+ attr_accessor :telephone
62
+
63
+ # Mobile number (E.164 format required if passport enabled)
64
+ attr_accessor :mobile
65
+
66
+ # Additional notes
67
+ attr_accessor :notes
68
+
69
+ # Barcode identifier
70
+ attr_accessor :barcode
71
+
72
+ # Custom field 1
73
+ attr_accessor :custom_1
74
+
75
+ # Custom field 2
76
+ attr_accessor :custom_2
77
+
78
+ # Custom field 3
79
+ attr_accessor :custom_3
80
+
81
+ # Custom field 4
82
+ attr_accessor :custom_4
83
+
84
+ # Custom field 5
85
+ attr_accessor :custom_5
86
+
87
+ # Timestamp of creation
88
+ attr_accessor :created_at
89
+
90
+ # Timestamp of last update
91
+ attr_accessor :updated_at
92
+
93
+ # Array of group IDs this person belongs to
94
+ attr_accessor :groups
95
+
96
+ # Array of role IDs assigned to this person
97
+ attr_accessor :roles
98
+
99
+ # Attribute mapping from ruby-style variable name to JSON key.
100
+ def self.attribute_map
101
+ {
102
+ :'id' => :'id',
103
+ :'first_name' => :'first_name',
104
+ :'last_name' => :'last_name',
105
+ :'salutation' => :'salutation',
106
+ :'job_title' => :'job_title',
107
+ :'email' => :'email',
108
+ :'organisation_id' => :'organisation_id',
109
+ :'system_id' => :'system_id',
110
+ :'department' => :'department',
111
+ :'enabled' => :'enabled',
112
+ :'valid_from' => :'valid_from',
113
+ :'valid_to' => :'valid_to',
114
+ :'image_url' => :'image_url',
115
+ :'image_thumbnail_url' => :'image_thumbnail_url',
116
+ :'telephone' => :'telephone',
117
+ :'mobile' => :'mobile',
118
+ :'notes' => :'notes',
119
+ :'barcode' => :'barcode',
120
+ :'custom_1' => :'custom_1',
121
+ :'custom_2' => :'custom_2',
122
+ :'custom_3' => :'custom_3',
123
+ :'custom_4' => :'custom_4',
124
+ :'custom_5' => :'custom_5',
125
+ :'created_at' => :'created_at',
126
+ :'updated_at' => :'updated_at',
127
+ :'groups' => :'groups',
128
+ :'roles' => :'roles'
129
+ }
130
+ end
131
+
132
+ # Returns attribute mapping this model knows about
133
+ def self.acceptable_attribute_map
134
+ attribute_map
135
+ end
136
+
137
+ # Returns all the JSON keys this model knows about
138
+ def self.acceptable_attributes
139
+ acceptable_attribute_map.values
140
+ end
141
+
142
+ # Attribute type mapping.
143
+ def self.openapi_types
144
+ {
145
+ :'id' => :'Integer',
146
+ :'first_name' => :'String',
147
+ :'last_name' => :'String',
148
+ :'salutation' => :'String',
149
+ :'job_title' => :'String',
150
+ :'email' => :'String',
151
+ :'organisation_id' => :'Integer',
152
+ :'system_id' => :'String',
153
+ :'department' => :'String',
154
+ :'enabled' => :'Boolean',
155
+ :'valid_from' => :'Time',
156
+ :'valid_to' => :'Time',
157
+ :'image_url' => :'String',
158
+ :'image_thumbnail_url' => :'String',
159
+ :'telephone' => :'String',
160
+ :'mobile' => :'String',
161
+ :'notes' => :'String',
162
+ :'barcode' => :'String',
163
+ :'custom_1' => :'String',
164
+ :'custom_2' => :'String',
165
+ :'custom_3' => :'String',
166
+ :'custom_4' => :'String',
167
+ :'custom_5' => :'String',
168
+ :'created_at' => :'Time',
169
+ :'updated_at' => :'Time',
170
+ :'groups' => :'Array<Integer>',
171
+ :'roles' => :'Array<Integer>'
172
+ }
173
+ end
174
+
175
+ # List of attributes with nullable: true
176
+ def self.openapi_nullable
177
+ Set.new([
178
+ :'salutation',
179
+ :'job_title',
180
+ :'email',
181
+ :'organisation_id',
182
+ :'system_id',
183
+ :'department',
184
+ :'valid_from',
185
+ :'valid_to',
186
+ :'image_url',
187
+ :'image_thumbnail_url',
188
+ :'telephone',
189
+ :'mobile',
190
+ :'notes',
191
+ :'barcode',
192
+ :'custom_1',
193
+ :'custom_2',
194
+ :'custom_3',
195
+ :'custom_4',
196
+ :'custom_5',
197
+ ])
198
+ end
199
+
200
+ # Initializes the object
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ def initialize(attributes = {})
203
+ if (!attributes.is_a?(Hash))
204
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::Person` initialize method"
205
+ end
206
+
207
+ # check to see if the attribute exists and convert string to symbol for hash key
208
+ acceptable_attribute_map = self.class.acceptable_attribute_map
209
+ attributes = attributes.each_with_object({}) { |(k, v), h|
210
+ if (!acceptable_attribute_map.key?(k.to_sym))
211
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::Person`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
212
+ end
213
+ h[k.to_sym] = v
214
+ }
215
+
216
+ if attributes.key?(:'id')
217
+ self.id = attributes[:'id']
218
+ else
219
+ self.id = nil
220
+ end
221
+
222
+ if attributes.key?(:'first_name')
223
+ self.first_name = attributes[:'first_name']
224
+ else
225
+ self.first_name = nil
226
+ end
227
+
228
+ if attributes.key?(:'last_name')
229
+ self.last_name = attributes[:'last_name']
230
+ else
231
+ self.last_name = nil
232
+ end
233
+
234
+ if attributes.key?(:'salutation')
235
+ self.salutation = attributes[:'salutation']
236
+ end
237
+
238
+ if attributes.key?(:'job_title')
239
+ self.job_title = attributes[:'job_title']
240
+ end
241
+
242
+ if attributes.key?(:'email')
243
+ self.email = attributes[:'email']
244
+ end
245
+
246
+ if attributes.key?(:'organisation_id')
247
+ self.organisation_id = attributes[:'organisation_id']
248
+ end
249
+
250
+ if attributes.key?(:'system_id')
251
+ self.system_id = attributes[:'system_id']
252
+ end
253
+
254
+ if attributes.key?(:'department')
255
+ self.department = attributes[:'department']
256
+ end
257
+
258
+ if attributes.key?(:'enabled')
259
+ self.enabled = attributes[:'enabled']
260
+ else
261
+ self.enabled = nil
262
+ end
263
+
264
+ if attributes.key?(:'valid_from')
265
+ self.valid_from = attributes[:'valid_from']
266
+ end
267
+
268
+ if attributes.key?(:'valid_to')
269
+ self.valid_to = attributes[:'valid_to']
270
+ end
271
+
272
+ if attributes.key?(:'image_url')
273
+ self.image_url = attributes[:'image_url']
274
+ end
275
+
276
+ if attributes.key?(:'image_thumbnail_url')
277
+ self.image_thumbnail_url = attributes[:'image_thumbnail_url']
278
+ end
279
+
280
+ if attributes.key?(:'telephone')
281
+ self.telephone = attributes[:'telephone']
282
+ end
283
+
284
+ if attributes.key?(:'mobile')
285
+ self.mobile = attributes[:'mobile']
286
+ end
287
+
288
+ if attributes.key?(:'notes')
289
+ self.notes = attributes[:'notes']
290
+ end
291
+
292
+ if attributes.key?(:'barcode')
293
+ self.barcode = attributes[:'barcode']
294
+ end
295
+
296
+ if attributes.key?(:'custom_1')
297
+ self.custom_1 = attributes[:'custom_1']
298
+ end
299
+
300
+ if attributes.key?(:'custom_2')
301
+ self.custom_2 = attributes[:'custom_2']
302
+ end
303
+
304
+ if attributes.key?(:'custom_3')
305
+ self.custom_3 = attributes[:'custom_3']
306
+ end
307
+
308
+ if attributes.key?(:'custom_4')
309
+ self.custom_4 = attributes[:'custom_4']
310
+ end
311
+
312
+ if attributes.key?(:'custom_5')
313
+ self.custom_5 = attributes[:'custom_5']
314
+ end
315
+
316
+ if attributes.key?(:'created_at')
317
+ self.created_at = attributes[:'created_at']
318
+ end
319
+
320
+ if attributes.key?(:'updated_at')
321
+ self.updated_at = attributes[:'updated_at']
322
+ end
323
+
324
+ if attributes.key?(:'groups')
325
+ if (value = attributes[:'groups']).is_a?(Array)
326
+ self.groups = value
327
+ end
328
+ else
329
+ self.groups = nil
330
+ end
331
+
332
+ if attributes.key?(:'roles')
333
+ if (value = attributes[:'roles']).is_a?(Array)
334
+ self.roles = value
335
+ end
336
+ else
337
+ self.roles = nil
338
+ end
339
+ end
340
+
341
+ # Show invalid properties with the reasons. Usually used together with valid?
342
+ # @return Array for valid properties with the reasons
343
+ def list_invalid_properties
344
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
345
+ invalid_properties = Array.new
346
+ if @id.nil?
347
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
348
+ end
349
+
350
+ if @first_name.nil?
351
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
352
+ end
353
+
354
+ if @last_name.nil?
355
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
356
+ end
357
+
358
+ # enabled, groups, and roles can be nil in API responses
359
+ invalid_properties
360
+ end
361
+
362
+ # Check to see if the all the properties in the model are valid
363
+ # @return true if the model is valid
364
+ def valid?
365
+ warn '[DEPRECATED] the `valid?` method is obsolete'
366
+ return false if @id.nil?
367
+ return false if @first_name.nil?
368
+ return false if @last_name.nil?
369
+ # enabled, groups, and roles can be nil
370
+ true
371
+ end
372
+
373
+ # Custom attribute writer method with validation
374
+ # @param [Object] id Value to be assigned
375
+ def id=(id)
376
+ if id.nil?
377
+ fail ArgumentError, 'id cannot be nil'
378
+ end
379
+
380
+ @id = id
381
+ end
382
+
383
+ # Custom attribute writer method with validation
384
+ # @param [Object] first_name Value to be assigned
385
+ def first_name=(first_name)
386
+ if first_name.nil?
387
+ fail ArgumentError, 'first_name cannot be nil'
388
+ end
389
+
390
+ @first_name = first_name
391
+ end
392
+
393
+ # Custom attribute writer method with validation
394
+ # @param [Object] last_name Value to be assigned
395
+ def last_name=(last_name)
396
+ if last_name.nil?
397
+ fail ArgumentError, 'last_name cannot be nil'
398
+ end
399
+
400
+ @last_name = last_name
401
+ end
402
+
403
+ # Custom attribute writer method with validation
404
+ # @param [Object] enabled Value to be assigned
405
+ def enabled=(enabled)
406
+ # Allow nil - API may return people without enabled field set
407
+ @enabled = enabled
408
+ end
409
+
410
+ # Custom attribute writer method with validation
411
+ # @param [Object] groups Value to be assigned
412
+ def groups=(groups)
413
+ # Allow nil - API may return people without groups
414
+ @groups = groups || []
415
+ end
416
+
417
+ # Custom attribute writer method with validation
418
+ # @param [Object] roles Value to be assigned
419
+ def roles=(roles)
420
+ # Allow nil - API may return people without roles
421
+ @roles = roles || []
422
+ end
423
+
424
+ # Checks equality by comparing each attribute.
425
+ # @param [Object] Object to be compared
426
+ def ==(o)
427
+ return true if self.equal?(o)
428
+ self.class == o.class &&
429
+ id == o.id &&
430
+ first_name == o.first_name &&
431
+ last_name == o.last_name &&
432
+ salutation == o.salutation &&
433
+ job_title == o.job_title &&
434
+ email == o.email &&
435
+ organisation_id == o.organisation_id &&
436
+ system_id == o.system_id &&
437
+ department == o.department &&
438
+ enabled == o.enabled &&
439
+ valid_from == o.valid_from &&
440
+ valid_to == o.valid_to &&
441
+ image_url == o.image_url &&
442
+ image_thumbnail_url == o.image_thumbnail_url &&
443
+ telephone == o.telephone &&
444
+ mobile == o.mobile &&
445
+ notes == o.notes &&
446
+ barcode == o.barcode &&
447
+ custom_1 == o.custom_1 &&
448
+ custom_2 == o.custom_2 &&
449
+ custom_3 == o.custom_3 &&
450
+ custom_4 == o.custom_4 &&
451
+ custom_5 == o.custom_5 &&
452
+ created_at == o.created_at &&
453
+ updated_at == o.updated_at &&
454
+ groups == o.groups &&
455
+ roles == o.roles
456
+ end
457
+
458
+ # @see the `==` method
459
+ # @param [Object] Object to be compared
460
+ def eql?(o)
461
+ self == o
462
+ end
463
+
464
+ # Calculates hash code according to all attributes.
465
+ # @return [Integer] Hash code
466
+ def hash
467
+ [id, first_name, last_name, salutation, job_title, email, organisation_id, system_id, department, enabled, valid_from, valid_to, image_url, image_thumbnail_url, telephone, mobile, notes, barcode, custom_1, custom_2, custom_3, custom_4, custom_5, created_at, updated_at, groups, roles].hash
468
+ end
469
+
470
+ # Builds the object from hash
471
+ # @param [Hash] attributes Model attributes in the form of hash
472
+ # @return [Object] Returns the model itself
473
+ def self.build_from_hash(attributes)
474
+ return nil unless attributes.is_a?(Hash)
475
+ attributes = attributes.transform_keys(&:to_sym)
476
+ transformed_hash = {}
477
+ openapi_types.each_pair do |key, type|
478
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
479
+ transformed_hash["#{key}"] = nil
480
+ elsif type =~ /\AArray<(.*)>/i
481
+ # check to ensure the input is an array given that the attribute
482
+ # is documented as an array but the input is not
483
+ if attributes[attribute_map[key]].is_a?(Array)
484
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
485
+ end
486
+ elsif !attributes[attribute_map[key]].nil?
487
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
488
+ end
489
+ end
490
+ new(transformed_hash)
491
+ end
492
+
493
+ # Returns the object in the form of hash
494
+ # @return [Hash] Returns the object in the form of hash
495
+ def to_hash
496
+ hash = {}
497
+ self.class.attribute_map.each_pair do |attr, param|
498
+ value = self.send(attr)
499
+ if value.nil?
500
+ is_nullable = self.class.openapi_nullable.include?(attr)
501
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
502
+ end
503
+
504
+ hash[param] = _to_hash(value)
505
+ end
506
+ hash
507
+ end
508
+
509
+ end
510
+
511
+ end