doorflow 1.0.0 → 1.1.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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +222 -316
  4. data/bin/post-generate +3 -1
  5. data/doorflow.gemspec +1 -1
  6. data/lib/doorflow/client/credentials_proxy.rb +6 -9
  7. data/lib/doorflow/client/element_sessions_proxy.rb +91 -0
  8. data/lib/doorflow/client.rb +13 -0
  9. data/lib/doorflow/errors/doorflow_error.rb +1 -1
  10. data/lib/doorflow/resources/credential.rb +4 -3
  11. data/lib/doorflow/resources/element_session.rb +28 -0
  12. data/lib/doorflow/webhooks/handler.rb +6 -6
  13. data/lib/doorflow/webhooks/signature_verifier.rb +8 -5
  14. data/lib/doorflow-api/api/accounts_api.rb +1 -1
  15. data/lib/doorflow-api/api/admission_requests_api.rb +2 -2
  16. data/lib/doorflow-api/api/card_designs_api.rb +347 -0
  17. data/lib/doorflow-api/api/card_template_types_api.rb +350 -0
  18. data/lib/doorflow-api/api/card_templates_api.rb +811 -0
  19. data/lib/doorflow-api/api/channels_api.rb +11 -11
  20. data/lib/doorflow-api/api/credential_types_api.rb +1 -1
  21. data/lib/doorflow-api/api/credentials_api.rb +6 -6
  22. data/lib/doorflow-api/api/element_sessions_api.rb +90 -0
  23. data/lib/doorflow-api/api/events_api.rb +2 -2
  24. data/lib/doorflow-api/api/group_reservations_api.rb +68 -5
  25. data/lib/doorflow-api/api/groups_api.rb +1 -1
  26. data/lib/doorflow-api/api/notification_rules_api.rb +7 -7
  27. data/lib/doorflow-api/api/oauth_api.rb +1 -1
  28. data/lib/doorflow-api/api/people_api.rb +7 -7
  29. data/lib/doorflow-api/api/reservations_api.rb +5 -5
  30. data/lib/doorflow-api/api/roles_api.rb +1 -1
  31. data/lib/doorflow-api/api/sites_api.rb +1 -1
  32. data/lib/doorflow-api/api/sync_api.rb +4 -4
  33. data/lib/doorflow-api/api_client.rb +8 -4
  34. data/lib/doorflow-api/api_error.rb +9 -14
  35. data/lib/doorflow-api/api_model_base.rb +1 -1
  36. data/lib/doorflow-api/configuration.rb +1 -1
  37. data/lib/doorflow-api/models/account.rb +1 -1
  38. data/lib/doorflow-api/models/account_passport.rb +1 -1
  39. data/lib/doorflow-api/models/account_reseller.rb +1 -1
  40. data/lib/doorflow-api/models/account_sync.rb +1 -1
  41. data/lib/doorflow-api/models/account_user.rb +1 -1
  42. data/lib/doorflow-api/models/admission_request.rb +1 -1
  43. data/lib/doorflow-api/models/admission_request_door_controller.rb +1 -1
  44. data/lib/doorflow-api/models/admission_request_person.rb +1 -1
  45. data/lib/doorflow-api/models/admit_channel202_response.rb +1 -1
  46. data/lib/doorflow-api/models/admit_person202_response.rb +1 -1
  47. data/lib/doorflow-api/models/admit_person403_response.rb +1 -1
  48. data/lib/doorflow-api/models/admit_person_request.rb +1 -1
  49. data/lib/doorflow-api/models/auto_unlock_channel400_response.rb +1 -1
  50. data/lib/doorflow-api/models/auto_unlock_channel_request.rb +1 -1
  51. data/lib/doorflow-api/models/card_design.rb +243 -0
  52. data/lib/doorflow-api/models/card_design_image_back.rb +179 -0
  53. data/lib/doorflow-api/models/card_design_image_front.rb +179 -0
  54. data/lib/doorflow-api/models/card_design_input.rb +181 -0
  55. data/lib/doorflow-api/models/card_template.rb +475 -0
  56. data/lib/doorflow-api/models/card_template_input.rb +147 -0
  57. data/lib/doorflow-api/models/card_template_input_card_template.rb +347 -0
  58. data/lib/doorflow-api/models/card_template_type.rb +321 -0
  59. data/lib/doorflow-api/models/card_template_type_input.rb +147 -0
  60. data/lib/doorflow-api/models/card_template_type_input_card_template_type.rb +251 -0
  61. data/lib/doorflow-api/models/card_template_type_input_card_template_type_non_printable_zones_inner.rb +183 -0
  62. data/lib/doorflow-api/models/card_template_type_non_printable_zones_inner.rb +188 -0
  63. data/lib/doorflow-api/models/channel.rb +1 -1
  64. data/lib/doorflow-api/models/channel_auto_unlock.rb +1 -1
  65. data/lib/doorflow-api/models/channel_lockdown.rb +1 -1
  66. data/lib/doorflow-api/models/channel_lockdown_aux_lockdown.rb +1 -1
  67. data/lib/doorflow-api/models/channel_lockdown_card_lockdown.rb +1 -1
  68. data/lib/doorflow-api/models/channel_lockdown_rex_lockdown.rb +1 -1
  69. data/lib/doorflow-api/models/channel_mode.rb +1 -1
  70. data/lib/doorflow-api/models/channel_sync.rb +5 -2
  71. data/lib/doorflow-api/models/{create_credential422_response.rb → create_card_design422_response.rb} +5 -5
  72. data/lib/doorflow-api/models/{create_credential422_response_errors.rb → create_card_design422_response_errors.rb} +4 -4
  73. data/lib/doorflow-api/models/credential.rb +4 -4
  74. data/lib/doorflow-api/models/credential_input.rb +1 -1
  75. data/lib/doorflow-api/models/credential_input_person_credential.rb +1 -1
  76. data/lib/doorflow-api/models/credential_type.rb +1 -1
  77. data/lib/doorflow-api/models/credential_update_input.rb +1 -1
  78. data/lib/doorflow-api/models/credential_update_input_person_credential.rb +1 -1
  79. data/lib/doorflow-api/models/{delete_group_reservation200_response.rb → delete_card_design200_response.rb} +4 -4
  80. data/lib/doorflow-api/models/delete_card_template_type409_response.rb +147 -0
  81. data/lib/doorflow-api/models/element_session.rb +192 -0
  82. data/lib/doorflow-api/models/element_session_config.rb +265 -0
  83. data/lib/doorflow-api/models/element_session_error.rb +199 -0
  84. data/lib/doorflow-api/models/element_session_input.rb +271 -0
  85. data/lib/doorflow-api/models/element_session_member.rb +186 -0
  86. data/lib/doorflow-api/models/error.rb +1 -1
  87. data/lib/doorflow-api/models/event.rb +1 -1
  88. data/lib/doorflow-api/models/get_access_token200_response.rb +1 -1
  89. data/lib/doorflow-api/models/get_access_token400_response.rb +1 -1
  90. data/lib/doorflow-api/models/get_access_token401_response.rb +1 -1
  91. data/lib/doorflow-api/models/get_admission_request401_response.rb +1 -1
  92. data/lib/doorflow-api/models/get_admission_request403_response.rb +1 -1
  93. data/lib/doorflow-api/models/get_admission_request404_response.rb +1 -1
  94. data/lib/doorflow-api/models/get_admission_request500_response.rb +1 -1
  95. data/lib/doorflow-api/models/get_token_info200_response.rb +1 -1
  96. data/lib/doorflow-api/models/get_token_info200_response_application.rb +1 -1
  97. data/lib/doorflow-api/models/get_token_info401_response.rb +1 -1
  98. data/lib/doorflow-api/models/group.rb +1 -1
  99. data/lib/doorflow-api/models/group_reservation.rb +1 -1
  100. data/lib/doorflow-api/models/group_reservation_input.rb +1 -1
  101. data/lib/doorflow-api/models/group_reservation_input_group_reservation.rb +1 -1
  102. data/lib/doorflow-api/models/initiate_sync429_response.rb +1 -1
  103. data/lib/doorflow-api/models/linked_file.rb +217 -0
  104. data/lib/doorflow-api/models/list_events400_response.rb +1 -1
  105. data/lib/doorflow-api/models/lockdown_channel_request.rb +1 -1
  106. data/lib/doorflow-api/models/notification_rule.rb +1 -1
  107. data/lib/doorflow-api/models/notification_rule_actions_inner.rb +1 -1
  108. data/lib/doorflow-api/models/notification_rule_conditions_inner.rb +1 -1
  109. data/lib/doorflow-api/models/notification_rule_events_inner.rb +1 -1
  110. data/lib/doorflow-api/models/notification_rule_input.rb +1 -1
  111. data/lib/doorflow-api/models/person.rb +30 -8
  112. data/lib/doorflow-api/models/person_input.rb +1 -1
  113. data/lib/doorflow-api/models/reservation.rb +1 -1
  114. data/lib/doorflow-api/models/reservation_input.rb +1 -1
  115. data/lib/doorflow-api/models/revoke_token403_response.rb +1 -1
  116. data/lib/doorflow-api/models/role.rb +1 -1
  117. data/lib/doorflow-api/models/site.rb +1 -1
  118. data/lib/doorflow-api/models/site_site_ips_inner.rb +1 -1
  119. data/lib/doorflow-api/models/unlock_channel_request.rb +1 -1
  120. data/lib/doorflow-api/version.rb +2 -2
  121. data/lib/doorflow-api.rb +28 -9
  122. data/lib/doorflow.rb +8 -2
  123. metadata +45 -154
  124. data/spec/api/admission_requests_api_spec.rb +0 -47
  125. data/spec/api/channels_api_spec.rb +0 -174
  126. data/spec/api/credential_types_api_spec.rb +0 -49
  127. data/spec/api/group_reservations_api_spec.rb +0 -75
  128. data/spec/api/oauth_api_spec.rb +0 -97
  129. data/spec/doorflow/client_spec.rb +0 -109
  130. data/spec/doorflow_spec.rb +0 -22
  131. data/spec/fixtures/vcr_cassettes/channel/list.yml +0 -70
  132. data/spec/fixtures/vcr_cassettes/channel/retrieve.yml +0 -131
  133. data/spec/fixtures/vcr_cassettes/person/auto_pagination.yml +0 -87
  134. data/spec/fixtures/vcr_cassettes/person/create.yml +0 -64
  135. data/spec/fixtures/vcr_cassettes/person/delete.yml +0 -125
  136. data/spec/fixtures/vcr_cassettes/person/list.yml +0 -90
  137. data/spec/fixtures/vcr_cassettes/person/not_found.yml +0 -62
  138. data/spec/fixtures/vcr_cassettes/person/retrieve.yml +0 -136
  139. data/spec/fixtures/vcr_cassettes/person/update.yml +0 -260
  140. data/spec/fixtures/vcr_cassettes/person/validation_error.yml +0 -62
  141. data/spec/integration/channel_spec.rb +0 -88
  142. data/spec/integration/person_spec.rb +0 -99
  143. data/spec/models/account_passport_spec.rb +0 -42
  144. data/spec/models/account_reseller_spec.rb +0 -60
  145. data/spec/models/account_sync_spec.rb +0 -52
  146. data/spec/models/account_user_spec.rb +0 -54
  147. data/spec/models/admission_request_door_controller_spec.rb +0 -42
  148. data/spec/models/admission_request_person_spec.rb +0 -42
  149. data/spec/models/admission_request_spec.rb +0 -82
  150. data/spec/models/admit_channel202_response_spec.rb +0 -46
  151. data/spec/models/admit_person202_response_spec.rb +0 -46
  152. data/spec/models/admit_person403_response_spec.rb +0 -42
  153. data/spec/models/admit_person_request_spec.rb +0 -36
  154. data/spec/models/auto_unlock_channel400_response_spec.rb +0 -42
  155. data/spec/models/auto_unlock_channel_request_spec.rb +0 -36
  156. data/spec/models/channel_auto_unlock_spec.rb +0 -42
  157. data/spec/models/channel_lockdown_aux_lockdown_spec.rb +0 -36
  158. data/spec/models/channel_lockdown_card_lockdown_spec.rb +0 -36
  159. data/spec/models/channel_lockdown_rex_lockdown_spec.rb +0 -36
  160. data/spec/models/channel_lockdown_spec.rb +0 -54
  161. data/spec/models/channel_mode_spec.rb +0 -52
  162. data/spec/models/channel_sync_spec.rb +0 -46
  163. data/spec/models/create_credential422_response_errors_spec.rb +0 -48
  164. data/spec/models/create_credential422_response_spec.rb +0 -42
  165. data/spec/models/credential_input_person_credential_spec.rb +0 -48
  166. data/spec/models/credential_input_spec.rb +0 -36
  167. data/spec/models/credential_spec.rb +0 -86
  168. data/spec/models/credential_update_input_person_credential_spec.rb +0 -36
  169. data/spec/models/credential_update_input_spec.rb +0 -36
  170. data/spec/models/delete_group_reservation200_response_spec.rb +0 -36
  171. data/spec/models/error_spec.rb +0 -42
  172. data/spec/models/get_access_token200_response_spec.rb +0 -66
  173. data/spec/models/get_access_token400_response_spec.rb +0 -46
  174. data/spec/models/get_access_token401_response_spec.rb +0 -42
  175. data/spec/models/get_admission_request401_response_spec.rb +0 -42
  176. data/spec/models/get_admission_request403_response_spec.rb +0 -42
  177. data/spec/models/get_admission_request404_response_spec.rb +0 -42
  178. data/spec/models/get_admission_request500_response_spec.rb +0 -42
  179. data/spec/models/get_token_info200_response_application_spec.rb +0 -36
  180. data/spec/models/get_token_info200_response_spec.rb +0 -66
  181. data/spec/models/get_token_info401_response_spec.rb +0 -42
  182. data/spec/models/group_reservation_input_group_reservation_spec.rb +0 -54
  183. data/spec/models/group_reservation_input_spec.rb +0 -36
  184. data/spec/models/group_reservation_spec.rb +0 -82
  185. data/spec/models/initiate_sync429_response_spec.rb +0 -52
  186. data/spec/models/list_events400_response_spec.rb +0 -42
  187. data/spec/models/lockdown_channel_request_spec.rb +0 -48
  188. data/spec/models/notification_rule_actions_inner_spec.rb +0 -48
  189. data/spec/models/notification_rule_conditions_inner_spec.rb +0 -48
  190. data/spec/models/notification_rule_events_inner_spec.rb +0 -42
  191. data/spec/models/notification_rule_input_spec.rb +0 -60
  192. data/spec/models/person_input_spec.rb +0 -180
  193. data/spec/models/reservation_input_spec.rb +0 -60
  194. data/spec/models/revoke_token403_response_spec.rb +0 -42
  195. data/spec/models/site_site_ips_inner_spec.rb +0 -36
  196. data/spec/models/unlock_channel_request_spec.rb +0 -36
  197. data/spec/spec_helper.rb +0 -160
@@ -0,0 +1,347 @@
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.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DoorFlow
17
+ class CardTemplateInputCardTemplate < ApiModelBase
18
+ # Client-generated UUID (required for creation)
19
+ attr_accessor :uuid
20
+
21
+ # Template display name (required for creation)
22
+ attr_accessor :name
23
+
24
+ # ID of the template type. Prefer template_type_code for portability across environments
25
+ attr_accessor :template_type_id
26
+
27
+ # Code of the template type (e.g. ISO_CARD_STANDARD). Resolved server-side; takes precedence over template_type_id if both are given
28
+ attr_accessor :template_type_code
29
+
30
+ attr_accessor :card_type
31
+
32
+ attr_accessor :double_sided
33
+
34
+ attr_accessor :orientation_front
35
+
36
+ attr_accessor :orientation_back
37
+
38
+ attr_accessor :default_template
39
+
40
+ # Free-form JSONB objects representing layout elements. Replaces the entire array on update
41
+ attr_accessor :template_objects
42
+
43
+ # Who can edit this template
44
+ attr_accessor :editable_by
45
+
46
+ # Reassign ownership. Allowed for the current owner or any admin in the account. The new owner must be an admin in the same account. Ignored on create (owner is set server-side from the authenticated user).
47
+ attr_accessor :owner_id
48
+
49
+ # Soft-delete timestamp. PATCH only. Setting a non-null value soft-deletes the template; setting null restores it. The deleted_by_id field is set server-side. For permanent deletion, use DELETE /card_templates/{id}.
50
+ attr_accessor :deleted_at
51
+
52
+ # Idempotency key for this change request
53
+ attr_accessor :change_request_id
54
+
55
+ class EnumAttributeValidator
56
+ attr_reader :datatype
57
+ attr_reader :allowable_values
58
+
59
+ def initialize(datatype, allowable_values)
60
+ @allowable_values = allowable_values.map do |value|
61
+ case datatype.to_s
62
+ when /Integer/i
63
+ value.to_i
64
+ when /Float/i
65
+ value.to_f
66
+ else
67
+ value
68
+ end
69
+ end
70
+ end
71
+
72
+ def valid?(value)
73
+ !value || allowable_values.include?(value)
74
+ end
75
+ end
76
+
77
+ # Attribute mapping from ruby-style variable name to JSON key.
78
+ def self.attribute_map
79
+ {
80
+ :'uuid' => :'uuid',
81
+ :'name' => :'name',
82
+ :'template_type_id' => :'template_type_id',
83
+ :'template_type_code' => :'template_type_code',
84
+ :'card_type' => :'card_type',
85
+ :'double_sided' => :'double_sided',
86
+ :'orientation_front' => :'orientation_front',
87
+ :'orientation_back' => :'orientation_back',
88
+ :'default_template' => :'default_template',
89
+ :'template_objects' => :'template_objects',
90
+ :'editable_by' => :'editable_by',
91
+ :'owner_id' => :'owner_id',
92
+ :'deleted_at' => :'deleted_at',
93
+ :'change_request_id' => :'change_request_id'
94
+ }
95
+ end
96
+
97
+ # Returns attribute mapping this model knows about
98
+ def self.acceptable_attribute_map
99
+ attribute_map
100
+ end
101
+
102
+ # Returns all the JSON keys this model knows about
103
+ def self.acceptable_attributes
104
+ acceptable_attribute_map.values
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.openapi_types
109
+ {
110
+ :'uuid' => :'String',
111
+ :'name' => :'String',
112
+ :'template_type_id' => :'Integer',
113
+ :'template_type_code' => :'String',
114
+ :'card_type' => :'String',
115
+ :'double_sided' => :'Boolean',
116
+ :'orientation_front' => :'String',
117
+ :'orientation_back' => :'String',
118
+ :'default_template' => :'Boolean',
119
+ :'template_objects' => :'Array<Object>',
120
+ :'editable_by' => :'String',
121
+ :'owner_id' => :'Integer',
122
+ :'deleted_at' => :'Time',
123
+ :'change_request_id' => :'String'
124
+ }
125
+ end
126
+
127
+ # List of attributes with nullable: true
128
+ def self.openapi_nullable
129
+ Set.new([
130
+ :'owner_id',
131
+ :'deleted_at',
132
+ ])
133
+ end
134
+
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ def initialize(attributes = {})
138
+ if (!attributes.is_a?(Hash))
139
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::CardTemplateInputCardTemplate` initialize method"
140
+ end
141
+
142
+ # check to see if the attribute exists and convert string to symbol for hash key
143
+ acceptable_attribute_map = self.class.acceptable_attribute_map
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!acceptable_attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::CardTemplateInputCardTemplate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'uuid')
152
+ self.uuid = attributes[:'uuid']
153
+ end
154
+
155
+ if attributes.key?(:'name')
156
+ self.name = attributes[:'name']
157
+ end
158
+
159
+ if attributes.key?(:'template_type_id')
160
+ self.template_type_id = attributes[:'template_type_id']
161
+ end
162
+
163
+ if attributes.key?(:'template_type_code')
164
+ self.template_type_code = attributes[:'template_type_code']
165
+ end
166
+
167
+ if attributes.key?(:'card_type')
168
+ self.card_type = attributes[:'card_type']
169
+ end
170
+
171
+ if attributes.key?(:'double_sided')
172
+ self.double_sided = attributes[:'double_sided']
173
+ end
174
+
175
+ if attributes.key?(:'orientation_front')
176
+ self.orientation_front = attributes[:'orientation_front']
177
+ end
178
+
179
+ if attributes.key?(:'orientation_back')
180
+ self.orientation_back = attributes[:'orientation_back']
181
+ end
182
+
183
+ if attributes.key?(:'default_template')
184
+ self.default_template = attributes[:'default_template']
185
+ end
186
+
187
+ if attributes.key?(:'template_objects')
188
+ if (value = attributes[:'template_objects']).is_a?(Array)
189
+ self.template_objects = value
190
+ end
191
+ end
192
+
193
+ if attributes.key?(:'editable_by')
194
+ self.editable_by = attributes[:'editable_by']
195
+ end
196
+
197
+ if attributes.key?(:'owner_id')
198
+ self.owner_id = attributes[:'owner_id']
199
+ end
200
+
201
+ if attributes.key?(:'deleted_at')
202
+ self.deleted_at = attributes[:'deleted_at']
203
+ end
204
+
205
+ if attributes.key?(:'change_request_id')
206
+ self.change_request_id = attributes[:'change_request_id']
207
+ end
208
+ end
209
+
210
+ # Show invalid properties with the reasons. Usually used together with valid?
211
+ # @return Array for valid properties with the reasons
212
+ def list_invalid_properties
213
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
214
+ invalid_properties = Array.new
215
+ invalid_properties
216
+ end
217
+
218
+ # Check to see if the all the properties in the model are valid
219
+ # @return true if the model is valid
220
+ def valid?
221
+ warn '[DEPRECATED] the `valid?` method is obsolete'
222
+ card_type_validator = EnumAttributeValidator.new('String', ["standard", "signature_stripe"])
223
+ return false unless card_type_validator.valid?(@card_type)
224
+ orientation_front_validator = EnumAttributeValidator.new('String', ["P", "L"])
225
+ return false unless orientation_front_validator.valid?(@orientation_front)
226
+ orientation_back_validator = EnumAttributeValidator.new('String', ["P", "L"])
227
+ return false unless orientation_back_validator.valid?(@orientation_back)
228
+ editable_by_validator = EnumAttributeValidator.new('String', ["owner_only", "any_admin"])
229
+ return false unless editable_by_validator.valid?(@editable_by)
230
+ true
231
+ end
232
+
233
+ # Custom attribute writer method checking allowed values (enum).
234
+ # @param [Object] card_type Object to be assigned
235
+ def card_type=(card_type)
236
+ validator = EnumAttributeValidator.new('String', ["standard", "signature_stripe"])
237
+ unless validator.valid?(card_type)
238
+ fail ArgumentError, "invalid value for \"card_type\", must be one of #{validator.allowable_values}."
239
+ end
240
+ @card_type = card_type
241
+ end
242
+
243
+ # Custom attribute writer method checking allowed values (enum).
244
+ # @param [Object] orientation_front Object to be assigned
245
+ def orientation_front=(orientation_front)
246
+ validator = EnumAttributeValidator.new('String', ["P", "L"])
247
+ unless validator.valid?(orientation_front)
248
+ fail ArgumentError, "invalid value for \"orientation_front\", must be one of #{validator.allowable_values}."
249
+ end
250
+ @orientation_front = orientation_front
251
+ end
252
+
253
+ # Custom attribute writer method checking allowed values (enum).
254
+ # @param [Object] orientation_back Object to be assigned
255
+ def orientation_back=(orientation_back)
256
+ validator = EnumAttributeValidator.new('String', ["P", "L"])
257
+ unless validator.valid?(orientation_back)
258
+ fail ArgumentError, "invalid value for \"orientation_back\", must be one of #{validator.allowable_values}."
259
+ end
260
+ @orientation_back = orientation_back
261
+ end
262
+
263
+ # Custom attribute writer method checking allowed values (enum).
264
+ # @param [Object] editable_by Object to be assigned
265
+ def editable_by=(editable_by)
266
+ validator = EnumAttributeValidator.new('String', ["owner_only", "any_admin"])
267
+ unless validator.valid?(editable_by)
268
+ fail ArgumentError, "invalid value for \"editable_by\", must be one of #{validator.allowable_values}."
269
+ end
270
+ @editable_by = editable_by
271
+ end
272
+
273
+ # Checks equality by comparing each attribute.
274
+ # @param [Object] Object to be compared
275
+ def ==(o)
276
+ return true if self.equal?(o)
277
+ self.class == o.class &&
278
+ uuid == o.uuid &&
279
+ name == o.name &&
280
+ template_type_id == o.template_type_id &&
281
+ template_type_code == o.template_type_code &&
282
+ card_type == o.card_type &&
283
+ double_sided == o.double_sided &&
284
+ orientation_front == o.orientation_front &&
285
+ orientation_back == o.orientation_back &&
286
+ default_template == o.default_template &&
287
+ template_objects == o.template_objects &&
288
+ editable_by == o.editable_by &&
289
+ owner_id == o.owner_id &&
290
+ deleted_at == o.deleted_at &&
291
+ change_request_id == o.change_request_id
292
+ end
293
+
294
+ # @see the `==` method
295
+ # @param [Object] Object to be compared
296
+ def eql?(o)
297
+ self == o
298
+ end
299
+
300
+ # Calculates hash code according to all attributes.
301
+ # @return [Integer] Hash code
302
+ def hash
303
+ [uuid, name, template_type_id, template_type_code, card_type, double_sided, orientation_front, orientation_back, default_template, template_objects, editable_by, owner_id, deleted_at, change_request_id].hash
304
+ end
305
+
306
+ # Builds the object from hash
307
+ # @param [Hash] attributes Model attributes in the form of hash
308
+ # @return [Object] Returns the model itself
309
+ def self.build_from_hash(attributes)
310
+ return nil unless attributes.is_a?(Hash)
311
+ attributes = attributes.transform_keys(&:to_sym)
312
+ transformed_hash = {}
313
+ openapi_types.each_pair do |key, type|
314
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
315
+ transformed_hash["#{key}"] = nil
316
+ elsif type =~ /\AArray<(.*)>/i
317
+ # check to ensure the input is an array given that the attribute
318
+ # is documented as an array but the input is not
319
+ if attributes[attribute_map[key]].is_a?(Array)
320
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
321
+ end
322
+ elsif !attributes[attribute_map[key]].nil?
323
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
324
+ end
325
+ end
326
+ new(transformed_hash)
327
+ end
328
+
329
+ # Returns the object in the form of hash
330
+ # @return [Hash] Returns the object in the form of hash
331
+ def to_hash
332
+ hash = {}
333
+ self.class.attribute_map.each_pair do |attr, param|
334
+ value = self.send(attr)
335
+ if value.nil?
336
+ is_nullable = self.class.openapi_nullable.include?(attr)
337
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
338
+ end
339
+
340
+ hash[param] = _to_hash(value)
341
+ end
342
+ hash
343
+ end
344
+
345
+ end
346
+
347
+ end
@@ -0,0 +1,321 @@
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.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DoorFlow
17
+ class CardTemplateType < ApiModelBase
18
+ # Unique identifier for this type
19
+ attr_accessor :code
20
+
21
+ # Display name
22
+ attr_accessor :name
23
+
24
+ # Physical page size category
25
+ attr_accessor :page_size
26
+
27
+ # Physical width in millimetres
28
+ attr_accessor :width_mm
29
+
30
+ # Physical height in millimetres
31
+ attr_accessor :height_mm
32
+
33
+ # Default orientation: P = Portrait, L = Landscape
34
+ attr_accessor :orientation_default
35
+
36
+ # URL to a preview image, or null if not set
37
+ attr_accessor :preview_image_url
38
+
39
+ # Non-printable zone definitions
40
+ attr_accessor :non_printable_zones
41
+
42
+ # When the record was created
43
+ attr_accessor :created_at
44
+
45
+ # When the record was last updated
46
+ attr_accessor :updated_at
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'code' => :'code',
74
+ :'name' => :'name',
75
+ :'page_size' => :'page_size',
76
+ :'width_mm' => :'width_mm',
77
+ :'height_mm' => :'height_mm',
78
+ :'orientation_default' => :'orientation_default',
79
+ :'preview_image_url' => :'preview_image_url',
80
+ :'non_printable_zones' => :'non_printable_zones',
81
+ :'created_at' => :'created_at',
82
+ :'updated_at' => :'updated_at'
83
+ }
84
+ end
85
+
86
+ # Returns attribute mapping this model knows about
87
+ def self.acceptable_attribute_map
88
+ attribute_map
89
+ end
90
+
91
+ # Returns all the JSON keys this model knows about
92
+ def self.acceptable_attributes
93
+ acceptable_attribute_map.values
94
+ end
95
+
96
+ # Attribute type mapping.
97
+ def self.openapi_types
98
+ {
99
+ :'code' => :'String',
100
+ :'name' => :'String',
101
+ :'page_size' => :'String',
102
+ :'width_mm' => :'Float',
103
+ :'height_mm' => :'Float',
104
+ :'orientation_default' => :'String',
105
+ :'preview_image_url' => :'String',
106
+ :'non_printable_zones' => :'Array<CardTemplateTypeNonPrintableZonesInner>',
107
+ :'created_at' => :'Time',
108
+ :'updated_at' => :'Time'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ :'preview_image_url',
116
+ ])
117
+ end
118
+
119
+ # Initializes the object
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ def initialize(attributes = {})
122
+ if (!attributes.is_a?(Hash))
123
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DoorFlow::CardTemplateType` initialize method"
124
+ end
125
+
126
+ # check to see if the attribute exists and convert string to symbol for hash key
127
+ acceptable_attribute_map = self.class.acceptable_attribute_map
128
+ attributes = attributes.each_with_object({}) { |(k, v), h|
129
+ if (!acceptable_attribute_map.key?(k.to_sym))
130
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DoorFlow::CardTemplateType`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
131
+ end
132
+ h[k.to_sym] = v
133
+ }
134
+
135
+ if attributes.key?(:'code')
136
+ self.code = attributes[:'code']
137
+ else
138
+ self.code = nil
139
+ end
140
+
141
+ if attributes.key?(:'name')
142
+ self.name = attributes[:'name']
143
+ else
144
+ self.name = nil
145
+ end
146
+
147
+ if attributes.key?(:'page_size')
148
+ self.page_size = attributes[:'page_size']
149
+ end
150
+
151
+ if attributes.key?(:'width_mm')
152
+ self.width_mm = attributes[:'width_mm']
153
+ end
154
+
155
+ if attributes.key?(:'height_mm')
156
+ self.height_mm = attributes[:'height_mm']
157
+ end
158
+
159
+ if attributes.key?(:'orientation_default')
160
+ self.orientation_default = attributes[:'orientation_default']
161
+ end
162
+
163
+ if attributes.key?(:'preview_image_url')
164
+ self.preview_image_url = attributes[:'preview_image_url']
165
+ end
166
+
167
+ if attributes.key?(:'non_printable_zones')
168
+ if (value = attributes[:'non_printable_zones']).is_a?(Array)
169
+ self.non_printable_zones = value
170
+ end
171
+ end
172
+
173
+ if attributes.key?(:'created_at')
174
+ self.created_at = attributes[:'created_at']
175
+ end
176
+
177
+ if attributes.key?(:'updated_at')
178
+ self.updated_at = attributes[:'updated_at']
179
+ end
180
+ end
181
+
182
+ # Show invalid properties with the reasons. Usually used together with valid?
183
+ # @return Array for valid properties with the reasons
184
+ def list_invalid_properties
185
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
186
+ invalid_properties = Array.new
187
+ if @code.nil?
188
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
189
+ end
190
+
191
+ if @name.nil?
192
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
193
+ end
194
+
195
+ invalid_properties
196
+ end
197
+
198
+ # Check to see if the all the properties in the model are valid
199
+ # @return true if the model is valid
200
+ def valid?
201
+ warn '[DEPRECATED] the `valid?` method is obsolete'
202
+ return false if @code.nil?
203
+ return false if @name.nil?
204
+ page_size_validator = EnumAttributeValidator.new('String', ["ISO_CARD", "A4", "A5", "LETTER"])
205
+ return false unless page_size_validator.valid?(@page_size)
206
+ orientation_default_validator = EnumAttributeValidator.new('String', ["P", "L"])
207
+ return false unless orientation_default_validator.valid?(@orientation_default)
208
+ true
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] code Value to be assigned
213
+ def code=(code)
214
+ if code.nil?
215
+ fail ArgumentError, 'code cannot be nil'
216
+ end
217
+
218
+ @code = code
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] name Value to be assigned
223
+ def name=(name)
224
+ if name.nil?
225
+ fail ArgumentError, 'name cannot be nil'
226
+ end
227
+
228
+ @name = name
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] page_size Object to be assigned
233
+ def page_size=(page_size)
234
+ validator = EnumAttributeValidator.new('String', ["ISO_CARD", "A4", "A5", "LETTER"])
235
+ unless validator.valid?(page_size)
236
+ fail ArgumentError, "invalid value for \"page_size\", must be one of #{validator.allowable_values}."
237
+ end
238
+ @page_size = page_size
239
+ end
240
+
241
+ # Custom attribute writer method checking allowed values (enum).
242
+ # @param [Object] orientation_default Object to be assigned
243
+ def orientation_default=(orientation_default)
244
+ validator = EnumAttributeValidator.new('String', ["P", "L"])
245
+ unless validator.valid?(orientation_default)
246
+ fail ArgumentError, "invalid value for \"orientation_default\", must be one of #{validator.allowable_values}."
247
+ end
248
+ @orientation_default = orientation_default
249
+ end
250
+
251
+ # Checks equality by comparing each attribute.
252
+ # @param [Object] Object to be compared
253
+ def ==(o)
254
+ return true if self.equal?(o)
255
+ self.class == o.class &&
256
+ code == o.code &&
257
+ name == o.name &&
258
+ page_size == o.page_size &&
259
+ width_mm == o.width_mm &&
260
+ height_mm == o.height_mm &&
261
+ orientation_default == o.orientation_default &&
262
+ preview_image_url == o.preview_image_url &&
263
+ non_printable_zones == o.non_printable_zones &&
264
+ created_at == o.created_at &&
265
+ updated_at == o.updated_at
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Integer] Hash code
276
+ def hash
277
+ [code, name, page_size, width_mm, height_mm, orientation_default, preview_image_url, non_printable_zones, created_at, updated_at].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def self.build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ transformed_hash = {}
287
+ openapi_types.each_pair do |key, type|
288
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = nil
290
+ elsif type =~ /\AArray<(.*)>/i
291
+ # check to ensure the input is an array given that the attribute
292
+ # is documented as an array but the input is not
293
+ if attributes[attribute_map[key]].is_a?(Array)
294
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
295
+ end
296
+ elsif !attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
298
+ end
299
+ end
300
+ new(transformed_hash)
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ end
320
+
321
+ end