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,257 @@
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 GroupReservationInputGroupReservation < ApiModelBase
18
+ # ID of the person to assign to groups (must belong to the same account)
19
+ attr_accessor :person_id
20
+
21
+ # Start time of the group reservation
22
+ attr_accessor :start_time
23
+
24
+ # End time of the group reservation (must be after start time and in the future)
25
+ attr_accessor :end_time
26
+
27
+ # Array of group IDs to assign the person to (at least one required, all must belong to the account)
28
+ attr_accessor :group_ids
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'person_id' => :'person_id',
34
+ :'start_time' => :'start_time',
35
+ :'end_time' => :'end_time',
36
+ :'group_ids' => :'group_ids'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'person_id' => :'Integer',
54
+ :'start_time' => :'Time',
55
+ :'end_time' => :'Time',
56
+ :'group_ids' => :'Array<Integer>'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::GroupReservationInputGroupReservation` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::GroupReservationInputGroupReservation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'person_id')
83
+ self.person_id = attributes[:'person_id']
84
+ else
85
+ self.person_id = nil
86
+ end
87
+
88
+ if attributes.key?(:'start_time')
89
+ self.start_time = attributes[:'start_time']
90
+ else
91
+ self.start_time = nil
92
+ end
93
+
94
+ if attributes.key?(:'end_time')
95
+ self.end_time = attributes[:'end_time']
96
+ else
97
+ self.end_time = nil
98
+ end
99
+
100
+ if attributes.key?(:'group_ids')
101
+ if (value = attributes[:'group_ids']).is_a?(Array)
102
+ self.group_ids = value
103
+ end
104
+ else
105
+ self.group_ids = nil
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
113
+ invalid_properties = Array.new
114
+ if @person_id.nil?
115
+ invalid_properties.push('invalid value for "person_id", person_id cannot be nil.')
116
+ end
117
+
118
+ if @start_time.nil?
119
+ invalid_properties.push('invalid value for "start_time", start_time cannot be nil.')
120
+ end
121
+
122
+ if @end_time.nil?
123
+ invalid_properties.push('invalid value for "end_time", end_time cannot be nil.')
124
+ end
125
+
126
+ if @group_ids.nil?
127
+ invalid_properties.push('invalid value for "group_ids", group_ids cannot be nil.')
128
+ end
129
+
130
+ if @group_ids.length < 1
131
+ invalid_properties.push('invalid value for "group_ids", number of items must be greater than or equal to 1.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ warn '[DEPRECATED] the `valid?` method is obsolete'
141
+ return false if @person_id.nil?
142
+ return false if @start_time.nil?
143
+ return false if @end_time.nil?
144
+ return false if @group_ids.nil?
145
+ return false if @group_ids.length < 1
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] person_id Value to be assigned
151
+ def person_id=(person_id)
152
+ if person_id.nil?
153
+ fail ArgumentError, 'person_id cannot be nil'
154
+ end
155
+
156
+ @person_id = person_id
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] start_time Value to be assigned
161
+ def start_time=(start_time)
162
+ if start_time.nil?
163
+ fail ArgumentError, 'start_time cannot be nil'
164
+ end
165
+
166
+ @start_time = start_time
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] end_time Value to be assigned
171
+ def end_time=(end_time)
172
+ if end_time.nil?
173
+ fail ArgumentError, 'end_time cannot be nil'
174
+ end
175
+
176
+ @end_time = end_time
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] group_ids Value to be assigned
181
+ def group_ids=(group_ids)
182
+ if group_ids.nil?
183
+ fail ArgumentError, 'group_ids cannot be nil'
184
+ end
185
+
186
+ if group_ids.length < 1
187
+ fail ArgumentError, 'invalid value for "group_ids", number of items must be greater than or equal to 1.'
188
+ end
189
+
190
+ @group_ids = group_ids
191
+ end
192
+
193
+ # Checks equality by comparing each attribute.
194
+ # @param [Object] Object to be compared
195
+ def ==(o)
196
+ return true if self.equal?(o)
197
+ self.class == o.class &&
198
+ person_id == o.person_id &&
199
+ start_time == o.start_time &&
200
+ end_time == o.end_time &&
201
+ group_ids == o.group_ids
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Integer] Hash code
212
+ def hash
213
+ [person_id, start_time, end_time, group_ids].hash
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def self.build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ attributes = attributes.transform_keys(&:to_sym)
222
+ transformed_hash = {}
223
+ openapi_types.each_pair do |key, type|
224
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = nil
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[attribute_map[key]].is_a?(Array)
230
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
231
+ end
232
+ elsif !attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
234
+ end
235
+ end
236
+ new(transformed_hash)
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -0,0 +1,243 @@
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 InitiateSync429Response < ApiModelBase
18
+ # Error code indicating rate limiting
19
+ attr_accessor :error
20
+
21
+ # Human-readable description of the rate limit
22
+ attr_accessor :description
23
+
24
+ # Number of seconds to wait before retrying
25
+ attr_accessor :retry_in
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'error' => :'error',
53
+ :'description' => :'description',
54
+ :'retry_in' => :'retry_in'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'error' => :'String',
72
+ :'description' => :'String',
73
+ :'retry_in' => :'Integer'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::InitiateSync429Response` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!acceptable_attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::InitiateSync429Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'error')
100
+ self.error = attributes[:'error']
101
+ else
102
+ self.error = nil
103
+ end
104
+
105
+ if attributes.key?(:'description')
106
+ self.description = attributes[:'description']
107
+ else
108
+ self.description = nil
109
+ end
110
+
111
+ if attributes.key?(:'retry_in')
112
+ self.retry_in = attributes[:'retry_in']
113
+ else
114
+ self.retry_in = nil
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @error.nil?
124
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
125
+ end
126
+
127
+ if @description.nil?
128
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
129
+ end
130
+
131
+ if @retry_in.nil?
132
+ invalid_properties.push('invalid value for "retry_in", retry_in cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ warn '[DEPRECATED] the `valid?` method is obsolete'
142
+ return false if @error.nil?
143
+ error_validator = EnumAttributeValidator.new('String', ["rate_limited"])
144
+ return false unless error_validator.valid?(@error)
145
+ return false if @description.nil?
146
+ return false if @retry_in.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] error Object to be assigned
152
+ def error=(error)
153
+ validator = EnumAttributeValidator.new('String', ["rate_limited"])
154
+ unless validator.valid?(error)
155
+ fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @error = error
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] description Value to be assigned
162
+ def description=(description)
163
+ if description.nil?
164
+ fail ArgumentError, 'description cannot be nil'
165
+ end
166
+
167
+ @description = description
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] retry_in Value to be assigned
172
+ def retry_in=(retry_in)
173
+ if retry_in.nil?
174
+ fail ArgumentError, 'retry_in cannot be nil'
175
+ end
176
+
177
+ @retry_in = retry_in
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ error == o.error &&
186
+ description == o.description &&
187
+ retry_in == o.retry_in
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Integer] Hash code
198
+ def hash
199
+ [error, description, retry_in].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def self.build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ openapi_types.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
217
+ end
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
221
+ end
222
+ new(transformed_hash)
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,156 @@
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 ListEvents400Response < ApiModelBase
18
+ attr_accessor :error
19
+
20
+ attr_accessor :error_description
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'error' => :'error',
26
+ :'error_description' => :'error_description'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'error' => :'String',
44
+ :'error_description' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::ListEvents400Response` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::ListEvents400Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'error')
71
+ self.error = attributes[:'error']
72
+ end
73
+
74
+ if attributes.key?(:'error_description')
75
+ self.error_description = attributes[:'error_description']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ error == o.error &&
100
+ error_description == o.error_description
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [error, error_description].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ attributes = attributes.transform_keys(&:to_sym)
121
+ transformed_hash = {}
122
+ openapi_types.each_pair do |key, type|
123
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = nil
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[attribute_map[key]].is_a?(Array)
129
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+ new(transformed_hash)
136
+ end
137
+
138
+ # Returns the object in the form of hash
139
+ # @return [Hash] Returns the object in the form of hash
140
+ def to_hash
141
+ hash = {}
142
+ self.class.attribute_map.each_pair do |attr, param|
143
+ value = self.send(attr)
144
+ if value.nil?
145
+ is_nullable = self.class.openapi_nullable.include?(attr)
146
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
147
+ end
148
+
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ end
155
+
156
+ end