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,498 @@
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 Channel < ApiModelBase
18
+ # Unique identifier for the channel
19
+ attr_accessor :id
20
+
21
+ # Name of the channel/door controller
22
+ attr_accessor :name
23
+
24
+ # MAC address of the controller (format aa:bb:cc:dd:ee:ff)
25
+ attr_accessor :mac_address
26
+
27
+ # Current connection status of the channel
28
+ attr_accessor :status
29
+
30
+ # Unit number for multi-channel controllers
31
+ attr_accessor :unit
32
+
33
+ # Controller model number
34
+ attr_accessor :model
35
+
36
+ # Full descriptive model name
37
+ attr_accessor :model_long
38
+
39
+ # Serial number of the controller
40
+ attr_accessor :serial_number
41
+
42
+ # Card format configuration
43
+ attr_accessor :card_format
44
+
45
+ # PIN format configuration
46
+ attr_accessor :pin_format
47
+
48
+ # Freescale firmware version
49
+ attr_accessor :freescale_version
50
+
51
+ # PIC firmware version
52
+ attr_accessor :pic_version
53
+
54
+ # Reader device class identifier
55
+ attr_accessor :reader_device_class_name
56
+
57
+ # ID of the site this channel belongs to
58
+ attr_accessor :site_id
59
+
60
+ # Timestamp of last update
61
+ attr_accessor :updated_at
62
+
63
+ # Timestamp of creation
64
+ attr_accessor :created_at
65
+
66
+ attr_accessor :sync
67
+
68
+ attr_accessor :lockdown
69
+
70
+ attr_accessor :mode
71
+
72
+ attr_accessor :auto_unlock
73
+
74
+ class EnumAttributeValidator
75
+ attr_reader :datatype
76
+ attr_reader :allowable_values
77
+
78
+ def initialize(datatype, allowable_values)
79
+ @allowable_values = allowable_values.map do |value|
80
+ case datatype.to_s
81
+ when /Integer/i
82
+ value.to_i
83
+ when /Float/i
84
+ value.to_f
85
+ else
86
+ value
87
+ end
88
+ end
89
+ end
90
+
91
+ def valid?(value)
92
+ !value || allowable_values.include?(value)
93
+ end
94
+ end
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'id' => :'id',
100
+ :'name' => :'name',
101
+ :'mac_address' => :'mac_address',
102
+ :'status' => :'status',
103
+ :'unit' => :'unit',
104
+ :'model' => :'model',
105
+ :'model_long' => :'model_long',
106
+ :'serial_number' => :'serial_number',
107
+ :'card_format' => :'card_format',
108
+ :'pin_format' => :'pin_format',
109
+ :'freescale_version' => :'freescale_version',
110
+ :'pic_version' => :'pic_version',
111
+ :'reader_device_class_name' => :'reader_device_class_name',
112
+ :'site_id' => :'site_id',
113
+ :'updated_at' => :'updated_at',
114
+ :'created_at' => :'created_at',
115
+ :'sync' => :'sync',
116
+ :'lockdown' => :'lockdown',
117
+ :'mode' => :'mode',
118
+ :'auto_unlock' => :'auto_unlock'
119
+ }
120
+ end
121
+
122
+ # Returns attribute mapping this model knows about
123
+ def self.acceptable_attribute_map
124
+ attribute_map
125
+ end
126
+
127
+ # Returns all the JSON keys this model knows about
128
+ def self.acceptable_attributes
129
+ acceptable_attribute_map.values
130
+ end
131
+
132
+ # Attribute type mapping.
133
+ def self.openapi_types
134
+ {
135
+ :'id' => :'Integer',
136
+ :'name' => :'String',
137
+ :'mac_address' => :'String',
138
+ :'status' => :'String',
139
+ :'unit' => :'Integer',
140
+ :'model' => :'String',
141
+ :'model_long' => :'String',
142
+ :'serial_number' => :'String',
143
+ :'card_format' => :'String',
144
+ :'pin_format' => :'String',
145
+ :'freescale_version' => :'String',
146
+ :'pic_version' => :'String',
147
+ :'reader_device_class_name' => :'String',
148
+ :'site_id' => :'Integer',
149
+ :'updated_at' => :'Time',
150
+ :'created_at' => :'Time',
151
+ :'sync' => :'ChannelSync',
152
+ :'lockdown' => :'ChannelLockdown',
153
+ :'mode' => :'ChannelMode',
154
+ :'auto_unlock' => :'ChannelAutoUnlock'
155
+ }
156
+ end
157
+
158
+ # List of attributes with nullable: true
159
+ def self.openapi_nullable
160
+ Set.new([
161
+ :'model',
162
+ :'serial_number',
163
+ :'card_format',
164
+ :'pin_format',
165
+ :'freescale_version',
166
+ :'pic_version',
167
+ :'reader_device_class_name',
168
+ :'site_id',
169
+ :'lockdown',
170
+ :'auto_unlock'
171
+ ])
172
+ end
173
+
174
+ # Initializes the object
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ def initialize(attributes = {})
177
+ if (!attributes.is_a?(Hash))
178
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::Channel` initialize method"
179
+ end
180
+
181
+ # check to see if the attribute exists and convert string to symbol for hash key
182
+ acceptable_attribute_map = self.class.acceptable_attribute_map
183
+ attributes = attributes.each_with_object({}) { |(k, v), h|
184
+ if (!acceptable_attribute_map.key?(k.to_sym))
185
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::Channel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
186
+ end
187
+ h[k.to_sym] = v
188
+ }
189
+
190
+ if attributes.key?(:'id')
191
+ self.id = attributes[:'id']
192
+ else
193
+ self.id = nil
194
+ end
195
+
196
+ if attributes.key?(:'name')
197
+ self.name = attributes[:'name']
198
+ else
199
+ self.name = nil
200
+ end
201
+
202
+ if attributes.key?(:'mac_address')
203
+ self.mac_address = attributes[:'mac_address']
204
+ else
205
+ self.mac_address = nil
206
+ end
207
+
208
+ if attributes.key?(:'status')
209
+ self.status = attributes[:'status']
210
+ else
211
+ self.status = nil
212
+ end
213
+
214
+ if attributes.key?(:'unit')
215
+ self.unit = attributes[:'unit']
216
+ else
217
+ self.unit = nil
218
+ end
219
+
220
+ if attributes.key?(:'model')
221
+ self.model = attributes[:'model']
222
+ end
223
+
224
+ if attributes.key?(:'model_long')
225
+ self.model_long = attributes[:'model_long']
226
+ end
227
+
228
+ if attributes.key?(:'serial_number')
229
+ self.serial_number = attributes[:'serial_number']
230
+ end
231
+
232
+ if attributes.key?(:'card_format')
233
+ self.card_format = attributes[:'card_format']
234
+ end
235
+
236
+ if attributes.key?(:'pin_format')
237
+ self.pin_format = attributes[:'pin_format']
238
+ end
239
+
240
+ if attributes.key?(:'freescale_version')
241
+ self.freescale_version = attributes[:'freescale_version']
242
+ end
243
+
244
+ if attributes.key?(:'pic_version')
245
+ self.pic_version = attributes[:'pic_version']
246
+ end
247
+
248
+ if attributes.key?(:'reader_device_class_name')
249
+ self.reader_device_class_name = attributes[:'reader_device_class_name']
250
+ end
251
+
252
+ if attributes.key?(:'site_id')
253
+ self.site_id = attributes[:'site_id']
254
+ end
255
+
256
+ if attributes.key?(:'updated_at')
257
+ self.updated_at = attributes[:'updated_at']
258
+ end
259
+
260
+ if attributes.key?(:'created_at')
261
+ self.created_at = attributes[:'created_at']
262
+ end
263
+
264
+ if attributes.key?(:'sync')
265
+ self.sync = attributes[:'sync']
266
+ else
267
+ self.sync = nil
268
+ end
269
+
270
+ if attributes.key?(:'lockdown')
271
+ self.lockdown = attributes[:'lockdown']
272
+ end
273
+
274
+ if attributes.key?(:'mode')
275
+ self.mode = attributes[:'mode']
276
+ else
277
+ self.mode = nil
278
+ end
279
+
280
+ if attributes.key?(:'auto_unlock')
281
+ self.auto_unlock = attributes[:'auto_unlock']
282
+ end
283
+ end
284
+
285
+ # Show invalid properties with the reasons. Usually used together with valid?
286
+ # @return Array for valid properties with the reasons
287
+ def list_invalid_properties
288
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
289
+ invalid_properties = Array.new
290
+ if @id.nil?
291
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
292
+ end
293
+
294
+ if @name.nil?
295
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
296
+ end
297
+
298
+ if @mac_address.nil?
299
+ invalid_properties.push('invalid value for "mac_address", mac_address cannot be nil.')
300
+ end
301
+
302
+ pattern = Regexp.new(/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/)
303
+ if @mac_address !~ pattern
304
+ invalid_properties.push("invalid value for \"mac_address\", must conform to the pattern #{pattern}.")
305
+ end
306
+
307
+ if @status.nil?
308
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
309
+ end
310
+
311
+ if @unit.nil?
312
+ invalid_properties.push('invalid value for "unit", unit cannot be nil.')
313
+ end
314
+
315
+ if @sync.nil?
316
+ invalid_properties.push('invalid value for "sync", sync cannot be nil.')
317
+ end
318
+
319
+ if @mode.nil?
320
+ invalid_properties.push('invalid value for "mode", mode cannot be nil.')
321
+ end
322
+
323
+ invalid_properties
324
+ end
325
+
326
+ # Check to see if the all the properties in the model are valid
327
+ # @return true if the model is valid
328
+ def valid?
329
+ warn '[DEPRECATED] the `valid?` method is obsolete'
330
+ return false if @id.nil?
331
+ return false if @name.nil?
332
+ return false if @mac_address.nil?
333
+ return false if @mac_address !~ Regexp.new(/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/)
334
+ return false if @status.nil?
335
+ status_validator = EnumAttributeValidator.new('String', ["online", "offline", "pending_encryption"])
336
+ return false unless status_validator.valid?(@status)
337
+ return false if @unit.nil?
338
+ return false if @sync.nil?
339
+ return false if @mode.nil?
340
+ true
341
+ end
342
+
343
+ # Custom attribute writer method with validation
344
+ # @param [Object] id Value to be assigned
345
+ def id=(id)
346
+ if id.nil?
347
+ fail ArgumentError, 'id cannot be nil'
348
+ end
349
+
350
+ @id = id
351
+ end
352
+
353
+ # Custom attribute writer method with validation
354
+ # @param [Object] name Value to be assigned
355
+ def name=(name)
356
+ if name.nil?
357
+ fail ArgumentError, 'name cannot be nil'
358
+ end
359
+
360
+ @name = name
361
+ end
362
+
363
+ # Custom attribute writer method with validation
364
+ # @param [Object] mac_address Value to be assigned
365
+ def mac_address=(mac_address)
366
+ if mac_address.nil?
367
+ fail ArgumentError, 'mac_address cannot be nil'
368
+ end
369
+
370
+ pattern = Regexp.new(/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/)
371
+ if mac_address !~ pattern
372
+ fail ArgumentError, "invalid value for \"mac_address\", must conform to the pattern #{pattern}."
373
+ end
374
+
375
+ @mac_address = mac_address
376
+ end
377
+
378
+ # Custom attribute writer method checking allowed values (enum).
379
+ # @param [Object] status Object to be assigned
380
+ def status=(status)
381
+ validator = EnumAttributeValidator.new('String', ["online", "offline", "pending_encryption"])
382
+ unless validator.valid?(status)
383
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
384
+ end
385
+ @status = status
386
+ end
387
+
388
+ # Custom attribute writer method with validation
389
+ # @param [Object] unit Value to be assigned
390
+ def unit=(unit)
391
+ if unit.nil?
392
+ fail ArgumentError, 'unit cannot be nil'
393
+ end
394
+
395
+ @unit = unit
396
+ end
397
+
398
+ # Custom attribute writer method with validation
399
+ # @param [Object] sync Value to be assigned
400
+ def sync=(sync)
401
+ if sync.nil?
402
+ fail ArgumentError, 'sync cannot be nil'
403
+ end
404
+
405
+ @sync = sync
406
+ end
407
+
408
+ # Custom attribute writer method with validation
409
+ # @param [Object] mode Value to be assigned
410
+ def mode=(mode)
411
+ if mode.nil?
412
+ fail ArgumentError, 'mode cannot be nil'
413
+ end
414
+
415
+ @mode = mode
416
+ end
417
+
418
+ # Checks equality by comparing each attribute.
419
+ # @param [Object] Object to be compared
420
+ def ==(o)
421
+ return true if self.equal?(o)
422
+ self.class == o.class &&
423
+ id == o.id &&
424
+ name == o.name &&
425
+ mac_address == o.mac_address &&
426
+ status == o.status &&
427
+ unit == o.unit &&
428
+ model == o.model &&
429
+ model_long == o.model_long &&
430
+ serial_number == o.serial_number &&
431
+ card_format == o.card_format &&
432
+ pin_format == o.pin_format &&
433
+ freescale_version == o.freescale_version &&
434
+ pic_version == o.pic_version &&
435
+ reader_device_class_name == o.reader_device_class_name &&
436
+ site_id == o.site_id &&
437
+ updated_at == o.updated_at &&
438
+ created_at == o.created_at &&
439
+ sync == o.sync &&
440
+ lockdown == o.lockdown &&
441
+ mode == o.mode &&
442
+ auto_unlock == o.auto_unlock
443
+ end
444
+
445
+ # @see the `==` method
446
+ # @param [Object] Object to be compared
447
+ def eql?(o)
448
+ self == o
449
+ end
450
+
451
+ # Calculates hash code according to all attributes.
452
+ # @return [Integer] Hash code
453
+ def hash
454
+ [id, name, mac_address, status, unit, model, model_long, serial_number, card_format, pin_format, freescale_version, pic_version, reader_device_class_name, site_id, updated_at, created_at, sync, lockdown, mode, auto_unlock].hash
455
+ end
456
+
457
+ # Builds the object from hash
458
+ # @param [Hash] attributes Model attributes in the form of hash
459
+ # @return [Object] Returns the model itself
460
+ def self.build_from_hash(attributes)
461
+ return nil unless attributes.is_a?(Hash)
462
+ attributes = attributes.transform_keys(&:to_sym)
463
+ transformed_hash = {}
464
+ openapi_types.each_pair do |key, type|
465
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
466
+ transformed_hash["#{key}"] = nil
467
+ elsif type =~ /\AArray<(.*)>/i
468
+ # check to ensure the input is an array given that the attribute
469
+ # is documented as an array but the input is not
470
+ if attributes[attribute_map[key]].is_a?(Array)
471
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
472
+ end
473
+ elsif !attributes[attribute_map[key]].nil?
474
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
475
+ end
476
+ end
477
+ new(transformed_hash)
478
+ end
479
+
480
+ # Returns the object in the form of hash
481
+ # @return [Hash] Returns the object in the form of hash
482
+ def to_hash
483
+ hash = {}
484
+ self.class.attribute_map.each_pair do |attr, param|
485
+ value = self.send(attr)
486
+ if value.nil?
487
+ is_nullable = self.class.openapi_nullable.include?(attr)
488
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
489
+ end
490
+
491
+ hash[param] = _to_hash(value)
492
+ end
493
+ hash
494
+ end
495
+
496
+ end
497
+
498
+ end
@@ -0,0 +1,159 @@
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
+ # Auto-unlock shift configuration (null if not configured)
18
+ class ChannelAutoUnlock < ApiModelBase
19
+ # Shift ID
20
+ attr_accessor :id
21
+
22
+ # Shift name
23
+ attr_accessor :name
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'name' => :'name'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'id' => :'Integer',
47
+ :'name' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::ChannelAutoUnlock` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::ChannelAutoUnlock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'id')
74
+ self.id = attributes[:'id']
75
+ end
76
+
77
+ if attributes.key?(:'name')
78
+ self.name = attributes[:'name']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ id == o.id &&
103
+ name == o.name
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [id, name].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
133
+ end
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
136
+ end
137
+ end
138
+ new(transformed_hash)
139
+ end
140
+
141
+ # Returns the object in the form of hash
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_hash
144
+ hash = {}
145
+ self.class.attribute_map.each_pair do |attr, param|
146
+ value = self.send(attr)
147
+ if value.nil?
148
+ is_nullable = self.class.openapi_nullable.include?(attr)
149
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
150
+ end
151
+
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ end
158
+
159
+ end