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,174 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DoorFlow::ChannelsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'ChannelsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = DoorFlow::ChannelsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ChannelsApi' do
30
+ it 'should create an instance of ChannelsApi' do
31
+ expect(@api_instance).to be_instance_of(DoorFlow::ChannelsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for admit_channel
36
+ # Admit through channel (any person)
37
+ # Requests immediate admission through a channel without specifying a person. This creates an admission request that momentarily unlocks the door. Returns an admission_request_id that can be used to track the status via GET /api/3/admission_requests/:id. Only works when the channel is in normal mode (not in unlock mode).
38
+ # @param id Channel ID
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [AdmitChannel202Response]
41
+ describe 'admit_channel test' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
44
+ end
45
+ end
46
+
47
+ # unit tests for admit_person
48
+ # Admit specific person through channel
49
+ # Requests admission for a specific person through a channel. This checks if the person has valid credentials and access rights before admitting. Returns an admission_request_id for tracking via GET /api/3/admission_requests/:id.
50
+ # @param id Channel ID
51
+ # @param admit_person_request
52
+ # @param [Hash] opts the optional parameters
53
+ # @return [AdmitPerson202Response]
54
+ describe 'admit_person test' do
55
+ it 'should work' do
56
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
57
+ end
58
+ end
59
+
60
+ # unit tests for auto_unlock_channel
61
+ # Set auto-unlock shift
62
+ # Configures a shift during which the channel automatically unlocks. Provide a shift_id to enable auto-unlock, or omit it to disable.
63
+ # @param id Channel ID
64
+ # @param [Hash] opts the optional parameters
65
+ # @option opts [AutoUnlockChannelRequest] :auto_unlock_channel_request
66
+ # @return [Channel]
67
+ describe 'auto_unlock_channel test' do
68
+ it 'should work' do
69
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
70
+ end
71
+ end
72
+
73
+ # unit tests for get_channel
74
+ # Get channel details
75
+ # Returns details for a specific channel (door controller)
76
+ # @param id Channel ID
77
+ # @param [Hash] opts the optional parameters
78
+ # @return [Channel]
79
+ describe 'get_channel test' do
80
+ it 'should work' do
81
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
82
+ end
83
+ end
84
+
85
+ # unit tests for list_channels
86
+ # List channels (door controllers)
87
+ # Returns a paginated list of channels (door controllers) accessible to the authenticated user
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [Integer] :site_id Filter channels by site ID
90
+ # @option opts [Integer] :per_page Number of results per page
91
+ # @option opts [Integer] :page Page number for pagination
92
+ # @option opts [Boolean] :skip_pagination Skip pagination and return all results
93
+ # @return [Array<Channel>]
94
+ describe 'list_channels test' do
95
+ it 'should work' do
96
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
97
+ end
98
+ end
99
+
100
+ # unit tests for lockdown_channel
101
+ # Enable lockdown mode
102
+ # Puts a channel into lockdown mode, restricting various types of access. You can selectively lock down card access, REX (Request to Exit), and AUX inputs.
103
+ # @param id Channel ID
104
+ # @param [Hash] opts the optional parameters
105
+ # @option opts [LockdownChannelRequest] :lockdown_channel_request
106
+ # @return [Channel]
107
+ describe 'lockdown_channel test' do
108
+ it 'should work' do
109
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
110
+ end
111
+ end
112
+
113
+ # unit tests for normal_channel
114
+ # Return channel to normal mode
115
+ # Cancels unlock mode and returns the channel to normal access control mode
116
+ # @param id Channel ID
117
+ # @param [Hash] opts the optional parameters
118
+ # @return [Channel]
119
+ describe 'normal_channel test' do
120
+ it 'should work' do
121
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
122
+ end
123
+ end
124
+
125
+ # unit tests for regenerate_encryption_key
126
+ # Regenerate encryption key
127
+ # Generates a new encryption key for secure communication with the channel
128
+ # @param id Channel ID
129
+ # @param [Hash] opts the optional parameters
130
+ # @return [Channel]
131
+ describe 'regenerate_encryption_key test' do
132
+ it 'should work' do
133
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
134
+ end
135
+ end
136
+
137
+ # unit tests for remove_encryption_key
138
+ # Remove encryption key
139
+ # Removes the encryption key, disabling encrypted communication with the channel
140
+ # @param id Channel ID
141
+ # @param [Hash] opts the optional parameters
142
+ # @return [Channel]
143
+ describe 'remove_encryption_key test' do
144
+ it 'should work' do
145
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
146
+ end
147
+ end
148
+
149
+ # unit tests for unlock_channel
150
+ # Unlock channel (unlock mode)
151
+ # Puts a channel into unlock mode, where the door remains unlocked until a specified time. If no relock_at time is provided, the door remains unlocked until normal mode is restored.
152
+ # @param id Channel ID
153
+ # @param [Hash] opts the optional parameters
154
+ # @option opts [UnlockChannelRequest] :unlock_channel_request
155
+ # @return [Channel]
156
+ describe 'unlock_channel test' do
157
+ it 'should work' do
158
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
159
+ end
160
+ end
161
+
162
+ # unit tests for unlockdown_channel
163
+ # Disable lockdown mode
164
+ # Removes lockdown mode from a channel, restoring normal access control
165
+ # @param id Channel ID
166
+ # @param [Hash] opts the optional parameters
167
+ # @return [Channel]
168
+ describe 'unlockdown_channel test' do
169
+ it 'should work' do
170
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
171
+ end
172
+ end
173
+
174
+ end
@@ -0,0 +1,49 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DoorFlow::CredentialTypesApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'CredentialTypesApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = DoorFlow::CredentialTypesApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of CredentialTypesApi' do
30
+ it 'should create an instance of CredentialTypesApi' do
31
+ expect(@api_instance).to be_instance_of(DoorFlow::CredentialTypesApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for list_credential_types
36
+ # List credential types
37
+ # Returns a paginated list of credential types configured for the authenticated user&#39;s account. Credential types define the formats and types of credentials (cards, PINs, mobile access, etc.) that can be used. Each credential type is based on a global credential type and can be customized per account.
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Integer] :per_page Number of results per page
40
+ # @option opts [Integer] :page Page number for pagination
41
+ # @option opts [Boolean] :skip_pagination Skip pagination and return all results
42
+ # @return [Array<CredentialType>]
43
+ describe 'list_credential_types test' do
44
+ it 'should work' do
45
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
46
+ end
47
+ end
48
+
49
+ end
@@ -0,0 +1,75 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DoorFlow::GroupReservationsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'GroupReservationsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = DoorFlow::GroupReservationsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of GroupReservationsApi' do
30
+ it 'should create an instance of GroupReservationsApi' do
31
+ expect(@api_instance).to be_instance_of(DoorFlow::GroupReservationsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for create_group_reservation
36
+ # Create group reservation
37
+ # Creates a new group reservation to temporarily assign a person to one or more groups. The person will be automatically added to the specified groups during the reservation period.
38
+ # @param group_reservation_input
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [GroupReservation]
41
+ describe 'create_group_reservation test' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
44
+ end
45
+ end
46
+
47
+ # unit tests for delete_group_reservation
48
+ # Delete group reservation
49
+ # Deletes or deactivates a group reservation. If the reservation is pending (not yet started), it will be permanently deleted. If it&#39;s already active, it will be deactivated and the person will be removed from the assigned groups.
50
+ # @param id Group reservation ID
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [DeleteGroupReservation200Response]
53
+ describe 'delete_group_reservation test' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
56
+ end
57
+ end
58
+
59
+ # unit tests for list_group_reservations
60
+ # List group reservations
61
+ # Returns a paginated list of present and future group reservations. Group reservations temporarily assign people to groups for a specified time period. Supports incremental sync via &#x60;since&#x60; or &#x60;since_utc&#x60; parameters.
62
+ # @param [Hash] opts the optional parameters
63
+ # @option opts [Time] :since Return only group reservations updated since this timestamp (local time)
64
+ # @option opts [Time] :since_utc Return only group reservations updated since this timestamp (UTC)
65
+ # @option opts [Integer] :per_page Number of results per page
66
+ # @option opts [Integer] :page Page number for pagination
67
+ # @option opts [Boolean] :skip_pagination Skip pagination and return all results
68
+ # @return [Array<GroupReservation>]
69
+ describe 'list_group_reservations test' do
70
+ it 'should work' do
71
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
72
+ end
73
+ end
74
+
75
+ end
@@ -0,0 +1,97 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DoorFlow::OauthApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'OauthApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = DoorFlow::OauthApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of OauthApi' do
30
+ it 'should create an instance of OauthApi' do
31
+ expect(@api_instance).to be_instance_of(DoorFlow::OauthApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for authorize_o_auth
36
+ # Authorization endpoint
37
+ # Initiates the OAuth 2.0 authorization code flow. Direct users to this endpoint to request authorization. **Authorization Code Flow Steps:** 1. Direct the user&#39;s browser to this endpoint with required parameters 2. User logs in (if not already authenticated) and authorizes your application 3. User is redirected to your &#x60;redirect_uri&#x60; with an authorization &#x60;code&#x60; parameter 4. Exchange the code for an access token at &#x60;/oauth/token&#x60; **PKCE (Proof Key for Code Exchange):** For public clients (mobile/SPA applications), PKCE is recommended for security: 1. Generate a random &#x60;code_verifier&#x60; (43-128 characters) 2. Create &#x60;code_challenge&#x60; &#x3D; BASE64URL(SHA256(code_verifier)) 3. Include &#x60;code_challenge&#x60; and &#x60;code_challenge_method&#x3D;S256&#x60; in this request 4. Include &#x60;code_verifier&#x60; when exchanging the code at &#x60;/oauth/token&#x60; **Important Notes:** - This is a browser-based flow - users will see a login/authorization screen - The &#x60;redirect_uri&#x60; must be pre-registered with your OAuth application - The authorization code expires after 10 minutes - Some applications may be configured to skip the authorization screen (auto-approve)
38
+ # @param response_type OAuth response type (must be \&quot;code\&quot; for authorization code flow)
39
+ # @param client_id Your OAuth application&#39;s client ID
40
+ # @param redirect_uri URI to redirect to after authorization (must match registered redirect URI)
41
+ # @param scope Space-separated list of requested scopes (see available scopes in security schemes section)
42
+ # @param [Hash] opts the optional parameters
43
+ # @option opts [String] :state Opaque value to maintain state between request and callback (recommended for CSRF protection)
44
+ # @option opts [String] :code_challenge PKCE code challenge (BASE64URL(SHA256(code_verifier)))
45
+ # @option opts [String] :code_challenge_method PKCE code challenge method (must be S256)
46
+ # @return [nil]
47
+ describe 'authorize_o_auth test' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
50
+ end
51
+ end
52
+
53
+ # unit tests for get_access_token
54
+ # Obtain access token
55
+ # Exchange authorization code for an access token, or refresh an existing token. **Authorization Code Flow:** 1. Direct users to &#x60;/oauth/authorize&#x60; with your client_id, redirect_uri, and requested scopes 2. User authorizes your application 3. You receive an authorization code at your redirect_uri 4. Exchange the code for an access token using this endpoint with &#x60;grant_type&#x3D;authorization_code&#x60; **Refreshing Tokens:** - Use &#x60;grant_type&#x3D;refresh_token&#x60; with a valid refresh_token to obtain a new access token - Access tokens expire after 1 hour - Refresh tokens are long-lived and should be stored securely
56
+ # @param grant_type OAuth grant type (use \\\&quot;authorization_code\\\&quot; to exchange an authorization code, or \\\&quot;refresh_token\\\&quot; to refresh an access token)
57
+ # @param [Hash] opts the optional parameters
58
+ # @option opts [String] :client_id OAuth client ID (required for all grant types)
59
+ # @option opts [String] :client_secret OAuth client secret (required for confidential clients)
60
+ # @option opts [String] :code Authorization code (required when grant_type&#x3D;authorization_code)
61
+ # @option opts [String] :redirect_uri Redirect URI (required when grant_type&#x3D;authorization_code, must match the one used in authorization request)
62
+ # @option opts [String] :code_verifier PKCE code verifier (required if PKCE was used in authorization request)
63
+ # @option opts [String] :refresh_token Refresh token (required when grant_type&#x3D;refresh_token)
64
+ # @option opts [String] :scope Space-separated list of requested scopes (optional, defaults to application&#39;s configured scopes)
65
+ # @return [GetAccessToken200Response]
66
+ describe 'get_access_token test' do
67
+ it 'should work' do
68
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
69
+ end
70
+ end
71
+
72
+ # unit tests for get_token_info
73
+ # Get token information
74
+ # Returns information about the current access token being used for authentication. This endpoint provides metadata about the access token including the resource owner, account, scopes, and expiration. **Authentication:** Requires a valid OAuth2 access token in the Authorization header.
75
+ # @param [Hash] opts the optional parameters
76
+ # @return [GetTokenInfo200Response]
77
+ describe 'get_token_info test' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
80
+ end
81
+ end
82
+
83
+ # unit tests for revoke_token
84
+ # Revoke access token or refresh token
85
+ # Revokes an access token or refresh token, immediately invalidating it and blocking associated tokens from making further requests. **When to revoke:** - User disconnects their DoorFlow account from your integration - User logs out - Security breach - revoke compromised tokens - Application uninstall **Important:** - **We recommend revoking the refresh_token** - this will invalidate all associated access tokens - Returns HTTP 200 even if the token was already invalid (prevents token scanning attacks) - Client authentication is required via HTTP Basic Auth header **Authentication:** You must authenticate using HTTP Basic Authentication with your client credentials: 1. Combine your client_id and client_secret as: &#x60;{client_id}:{client_secret}&#x60; 2. Encode using URL-safe Base64 3. Include in Authorization header: &#x60;Authorization: Basic {encoded_credentials}&#x60;
86
+ # @param authorization HTTP Basic Authentication using client_id:client_secret encoded with URL-safe Base64
87
+ # @param token The access token or refresh token to revoke (we recommend using refresh_token)
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :token_type_hint Optional hint about the type of token being revoked. We recommend using &#39;refresh_token&#39; for all revocations as it invalidates all associated tokens. Invalid token type hint values are ignored and do not affect the revocation response.
90
+ # @return [Object]
91
+ describe 'revoke_token test' do
92
+ it 'should work' do
93
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
94
+ end
95
+ end
96
+
97
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe DoorFlow::Client do
6
+ describe 'resource instance methods use instance client' do
7
+ it 'Person#update uses the instance client, not class-level client' do
8
+ # Create a mock people_api
9
+ people_api = double('people_api')
10
+ allow(people_api).to receive(:update_person).and_return(
11
+ double('response', to_hash: { 'id' => 123, 'first_name' => 'Updated' })
12
+ )
13
+
14
+ # Create a client with the mock
15
+ auth = double('auth', access_token: 'instance_token', authenticated?: true)
16
+ client = DoorFlow::Client.new(auth: auth)
17
+ allow(client).to receive(:people_api).and_return(people_api)
18
+
19
+ # Create a person as if retrieved via client.people.retrieve
20
+ person = DoorFlow::Resources::Person.new({ 'id' => 123, 'first_name' => 'Test' })
21
+ person.instance_variable_set(:@_client, client)
22
+
23
+ # Call update - this should use the instance client's people_api
24
+ person.update(first_name: 'Updated')
25
+
26
+ # Verify the instance client's people_api was called, not class-level
27
+ expect(people_api).to have_received(:update_person).with(123, { first_name: 'Updated' })
28
+ end
29
+ end
30
+
31
+
32
+ describe '#access_token' do
33
+ context 'with an auth object' do
34
+ it 'delegates to auth.access_token' do
35
+ auth = double('auth', access_token: 'token_from_auth')
36
+ client = DoorFlow::Client.new(auth: auth)
37
+
38
+ expect(client.access_token).to eq('token_from_auth')
39
+ end
40
+ end
41
+
42
+ context 'with a static access token' do
43
+ it 'returns the static token' do
44
+ client = DoorFlow::Client.new(access_token: 'static_token')
45
+
46
+ expect(client.access_token).to eq('static_token')
47
+ end
48
+ end
49
+ end
50
+
51
+ describe '#authenticated?' do
52
+ context 'with an auth object that responds to authenticated?' do
53
+ it 'delegates to auth.authenticated?' do
54
+ auth = double('auth', authenticated?: true)
55
+ client = DoorFlow::Client.new(auth: auth)
56
+
57
+ expect(client.authenticated?).to be true
58
+ end
59
+ end
60
+
61
+ context 'with a static access token' do
62
+ it 'returns true when token is present' do
63
+ client = DoorFlow::Client.new(access_token: 'token')
64
+ # The SDK uses .present? which requires ActiveSupport
65
+ # In non-Rails context, we just check if it doesn't raise
66
+ expect { client.authenticated? }.not_to raise_error
67
+ end
68
+
69
+ it 'returns false when token is nil' do
70
+ client = DoorFlow::Client.new(access_token: nil)
71
+
72
+ expect(client.authenticated?).to be false
73
+ end
74
+ end
75
+ end
76
+
77
+ describe 'dynamic token refresh' do
78
+ it 'fetches fresh token on each API call, not cached at client creation' do
79
+ call_count = 0
80
+ tokens = ['first_token', 'refreshed_token']
81
+
82
+ # Auth object that returns different tokens on each call (simulating refresh)
83
+ auth = double('auth')
84
+ allow(auth).to receive(:access_token) do
85
+ token = tokens[call_count] || tokens.last
86
+ call_count += 1
87
+ token
88
+ end
89
+ allow(auth).to receive(:authenticated?).and_return(true)
90
+
91
+ client = DoorFlow::Client.new(auth: auth)
92
+
93
+ # Access the api_client to trigger config setup
94
+ api_client = client.send(:api_client)
95
+ config = api_client.config
96
+
97
+ # First call should get first token
98
+ first_token = config.access_token_with_refresh
99
+ expect(first_token).to eq('first_token')
100
+
101
+ # Second call should get refreshed token (not cached first token)
102
+ second_token = config.access_token_with_refresh
103
+ expect(second_token).to eq('refreshed_token')
104
+
105
+ # Verify auth.access_token was called multiple times
106
+ expect(call_count).to be >= 2
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe DoorFlow do
4
+ describe '.access_token=' do
5
+ it 'sets the access token' do
6
+ DoorFlow.access_token = 'test_token'
7
+ expect(DoorFlow.access_token).to eq('test_token')
8
+ end
9
+
10
+ it 'configures the generated client' do
11
+ DoorFlow.access_token = 'test_token'
12
+ expect(DoorFlow.configuration.access_token).to eq('test_token')
13
+ end
14
+ end
15
+
16
+ describe '.api_base=' do
17
+ it 'sets the API base' do
18
+ DoorFlow.api_base = 'https://api.test.com'
19
+ expect(DoorFlow.api_base).to eq('https://api.test.com')
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.doorflow.com/api/3/channels
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - doorflow-ruby/1.0.0
14
+ Accept:
15
+ - application/json
16
+ Authorization:
17
+ - "<ACCESS_TOKEN>"
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 05 Feb 2026 20:21:52 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '1111'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Etag:
36
+ - W/"548dffeeb5158920a534882c96f449ba"
37
+ Referrer-Policy:
38
+ - strict-origin-when-cross-origin
39
+ Strict-Transport-Security:
40
+ - max-age=31536000; includeSubDomains
41
+ Vary:
42
+ - Origin
43
+ X-Cache:
44
+ - miss
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ X-Download-Options:
48
+ - noopen
49
+ X-Frame-Options:
50
+ - ALLOWALL
51
+ X-Page:
52
+ - '1'
53
+ X-Per-Page:
54
+ - '500'
55
+ X-Permitted-Cross-Domain-Policies:
56
+ - none
57
+ X-Request-Id:
58
+ - 3feec5159c7ed68cbb8bb01d317b7ccc
59
+ X-Runtime:
60
+ - '0.036802'
61
+ X-Total-Results:
62
+ - '2'
63
+ X-Xss-Protection:
64
+ - 1; mode=block
65
+ body:
66
+ encoding: ASCII-8BIT
67
+ string: '[{"id":8114,"name":"Meeting Room","mac_address":"df:df:df:ef:cb:1b","status":"online","unit":1,"model":"A9188","model_long":"Unknown","serial_number":"","card_format":"","pin_format":"","freescale_version":null,"pic_version":null,"reader_device_class_name":"AA-C100-B","site_id":625,"updated_at":"2026-02-05T20:21:13+00:00","created_at":"2024-08-09T11:56:22+01:00","sync":{"status":"sync_complete","last_sync_completed_at":"2025-04-11T20:42:16+01:00"},"lockdown":null,"mode":{"description":"normal","relock_at":null,"change_stamp":null},"auto_unlock":null},{"id":8113,"name":"Front
68
+ Door","mac_address":"df:df:df:82:41:ab","status":"online","unit":1,"model":"A9188","model_long":"Unknown","serial_number":"","card_format":"","pin_format":"","freescale_version":null,"pic_version":null,"reader_device_class_name":"AA-C100-B","site_id":625,"updated_at":"2026-02-05T20:21:12+00:00","created_at":"2024-08-09T11:56:22+01:00","sync":{"status":"sync_complete","last_sync_completed_at":"2025-04-11T20:42:17+01:00"},"lockdown":null,"mode":{"description":"normal","relock_at":null,"change_stamp":null},"auto_unlock":null}]'
69
+ recorded_at: Thu, 05 Feb 2026 20:21:52 GMT
70
+ recorded_with: VCR 6.4.0