castle-rb 8.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/lib/castle/api/list_items/archive.rb +23 -0
  3. data/lib/castle/api/list_items/count.rb +22 -0
  4. data/lib/castle/api/list_items/create.rb +22 -0
  5. data/lib/castle/api/list_items/get.rb +22 -0
  6. data/lib/castle/api/list_items/query.rb +22 -0
  7. data/lib/castle/api/list_items/unarchive.rb +22 -0
  8. data/lib/castle/api/list_items/update.rb +22 -0
  9. data/lib/castle/api/lists/create.rb +23 -0
  10. data/lib/castle/api/lists/delete.rb +22 -0
  11. data/lib/castle/api/lists/get.rb +22 -0
  12. data/lib/castle/api/lists/get_all.rb +22 -0
  13. data/lib/castle/api/lists/query.rb +22 -0
  14. data/lib/castle/api/lists/update.rb +22 -0
  15. data/lib/castle/client.rb +3 -0
  16. data/lib/castle/client_actions/list_items.rb +44 -0
  17. data/lib/castle/client_actions/lists.rb +39 -0
  18. data/lib/castle/commands/list_items/archive.rb +24 -0
  19. data/lib/castle/commands/list_items/count.rb +23 -0
  20. data/lib/castle/commands/list_items/create.rb +22 -0
  21. data/lib/castle/commands/list_items/get.rb +23 -0
  22. data/lib/castle/commands/list_items/query.rb +24 -0
  23. data/lib/castle/commands/list_items/unarchive.rb +23 -0
  24. data/lib/castle/commands/list_items/update.rb +22 -0
  25. data/lib/castle/commands/lists/create.rb +21 -0
  26. data/lib/castle/commands/lists/delete.rb +20 -0
  27. data/lib/castle/commands/lists/get.rb +20 -0
  28. data/lib/castle/commands/lists/get_all.rb +17 -0
  29. data/lib/castle/commands/lists/query.rb +21 -0
  30. data/lib/castle/commands/lists/update.rb +22 -0
  31. data/lib/castle/version.rb +1 -1
  32. data/lib/castle.rb +28 -0
  33. data/spec/lib/castle/api/approve_device_spec.rb +1 -1
  34. data/spec/lib/castle/api/authenticate_spec.rb +1 -1
  35. data/spec/lib/castle/api/end_impersonation_spec.rb +1 -1
  36. data/spec/lib/castle/api/filter_spec.rb +1 -1
  37. data/spec/lib/castle/api/get_device_spec.rb +1 -1
  38. data/spec/lib/castle/api/get_devices_for_user_spec.rb +1 -1
  39. data/spec/lib/castle/api/list_items/archive_spec.rb +18 -0
  40. data/spec/lib/castle/api/list_items/count_spec.rb +21 -0
  41. data/spec/lib/castle/api/list_items/create_spec.rb +22 -0
  42. data/spec/lib/castle/api/list_items/get_spec.rb +18 -0
  43. data/spec/lib/castle/api/list_items/query_spec.rb +21 -0
  44. data/spec/lib/castle/api/list_items/unarchive_spec.rb +18 -0
  45. data/spec/lib/castle/api/list_items/update_spec.rb +22 -0
  46. data/spec/lib/castle/api/lists/create_spec.rb +21 -0
  47. data/spec/lib/castle/api/lists/delete_spec.rb +17 -0
  48. data/spec/lib/castle/api/lists/get_all_spec.rb +17 -0
  49. data/spec/lib/castle/api/lists/get_spec.rb +17 -0
  50. data/spec/lib/castle/api/lists/query_spec.rb +21 -0
  51. data/spec/lib/castle/api/lists/update_spec.rb +21 -0
  52. data/spec/lib/castle/api/log_spec.rb +1 -1
  53. data/spec/lib/castle/api/report_device_spec.rb +1 -1
  54. data/spec/lib/castle/api/risk_spec.rb +1 -1
  55. data/spec/lib/castle/api/start_impersonation_spec.rb +1 -1
  56. data/spec/lib/castle/api/track_spec.rb +1 -1
  57. data/spec/lib/castle/api_spec.rb +1 -1
  58. data/spec/lib/castle/client_id/extract_spec.rb +1 -1
  59. data/spec/lib/castle/client_spec.rb +6 -1
  60. data/spec/lib/castle/command_spec.rb +1 -1
  61. data/spec/lib/castle/commands/approve_device_spec.rb +1 -1
  62. data/spec/lib/castle/commands/authenticate_spec.rb +1 -1
  63. data/spec/lib/castle/commands/end_impersonation_spec.rb +1 -1
  64. data/spec/lib/castle/commands/filter_spec.rb +1 -1
  65. data/spec/lib/castle/commands/get_device_spec.rb +1 -1
  66. data/spec/lib/castle/commands/get_devices_for_user_spec.rb +1 -1
  67. data/spec/lib/castle/commands/list_items/archive_spec.rb +21 -0
  68. data/spec/lib/castle/commands/list_items/count_spec.rb +21 -0
  69. data/spec/lib/castle/commands/list_items/create_spec.rb +22 -0
  70. data/spec/lib/castle/commands/list_items/get_spec.rb +21 -0
  71. data/spec/lib/castle/commands/list_items/query_spec.rb +27 -0
  72. data/spec/lib/castle/commands/list_items/unarchive_spec.rb +21 -0
  73. data/spec/lib/castle/commands/list_items/update_spec.rb +21 -0
  74. data/spec/lib/castle/commands/lists/create_spec.rb +33 -0
  75. data/spec/lib/castle/commands/lists/delete_spec.rb +21 -0
  76. data/spec/lib/castle/commands/lists/get_all_spec.rb +11 -0
  77. data/spec/lib/castle/commands/lists/get_spec.rb +21 -0
  78. data/spec/lib/castle/commands/lists/query_spec.rb +27 -0
  79. data/spec/lib/castle/commands/lists/update_spec.rb +29 -0
  80. data/spec/lib/castle/commands/log_spec.rb +1 -1
  81. data/spec/lib/castle/commands/report_device_spec.rb +1 -1
  82. data/spec/lib/castle/commands/risk_spec.rb +1 -1
  83. data/spec/lib/castle/commands/start_impersonation_spec.rb +1 -1
  84. data/spec/lib/castle/commands/track_spec.rb +1 -1
  85. data/spec/lib/castle/configuration_spec.rb +1 -1
  86. data/spec/lib/castle/context/get_default_spec.rb +1 -1
  87. data/spec/lib/castle/context/merge_spec.rb +1 -1
  88. data/spec/lib/castle/context/prepare_spec.rb +1 -1
  89. data/spec/lib/castle/context/sanitize_spec.rb +1 -1
  90. data/spec/lib/castle/core/get_connection_spec.rb +1 -1
  91. data/spec/lib/castle/core/process_response_spec.rb +1 -1
  92. data/spec/lib/castle/core/process_webhook_spec.rb +1 -1
  93. data/spec/lib/castle/core/send_request_spec.rb +1 -1
  94. data/spec/lib/castle/failover/strategy_spec.rb +1 -1
  95. data/spec/lib/castle/headers/extract_spec.rb +1 -1
  96. data/spec/lib/castle/headers/filter_spec.rb +1 -1
  97. data/spec/lib/castle/headers/format_spec.rb +1 -1
  98. data/spec/lib/castle/ips/extract_spec.rb +1 -1
  99. data/spec/lib/castle/logger_spec.rb +1 -1
  100. data/spec/lib/castle/payload/prepare_spec.rb +1 -1
  101. data/spec/lib/castle/secure_mode_spec.rb +1 -1
  102. data/spec/lib/castle/session_spec.rb +1 -1
  103. data/spec/lib/castle/singleton_configuration_spec.rb +1 -1
  104. data/spec/lib/castle/utils/clean_invalid_chars_spec.rb +1 -1
  105. data/spec/lib/castle/utils/clone_spec.rb +1 -1
  106. data/spec/lib/castle/utils/deep_symbolize_keys_spec.rb +1 -1
  107. data/spec/lib/castle/utils/get_timestamp_spec.rb +1 -1
  108. data/spec/lib/castle/utils/merge_spec.rb +1 -1
  109. data/spec/lib/castle/validators/not_supported_spec.rb +1 -1
  110. data/spec/lib/castle/validators/present_spec.rb +1 -1
  111. data/spec/lib/castle/verdict_spec.rb +1 -1
  112. data/spec/lib/castle/version_spec.rb +1 -1
  113. data/spec/lib/castle/webhooks/verify_spec.rb +1 -1
  114. data/spec/lib/castle_spec.rb +1 -1
  115. data/spec/spec_helper.rb +2 -0
  116. data/spec/support/shared_examples/list_items.rb +52 -0
  117. data/spec/support/shared_examples/lists.rb +45 -0
  118. metadata +87 -3
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'it has list actions' do
4
+ describe 'create_list' do
5
+ it do
6
+ client.create_list(name: 'list name', color: '$green', primary_field: 'user.email')
7
+ assert_requested :post, 'https://api.castle.io/v1/lists', times: 1
8
+ end
9
+ end
10
+
11
+ describe 'delete_list' do
12
+ it do
13
+ client.delete_list(list_id: 'list_id')
14
+ assert_requested :delete, 'https://api.castle.io/v1/lists/list_id', times: 1
15
+ end
16
+ end
17
+
18
+ describe 'get_all_lists' do
19
+ it do
20
+ client.get_all_lists
21
+ assert_requested :get, 'https://api.castle.io/v1/lists', times: 1
22
+ end
23
+ end
24
+
25
+ describe 'get_list' do
26
+ it do
27
+ client.get_list(list_id: 'list_id')
28
+ assert_requested :get, 'https://api.castle.io/v1/lists/list_id', times: 1
29
+ end
30
+ end
31
+
32
+ describe 'query_lists' do
33
+ it do
34
+ client.query_lists(filters: [{ field: 'user.email', op: 'eq', value: 'test' }])
35
+ assert_requested :post, 'https://api.castle.io/v1/lists/query', times: 1
36
+ end
37
+ end
38
+
39
+ describe 'update_list' do
40
+ it do
41
+ client.update_list(list_id: 'list_id', name: 'list name', color: '$green', primary_field: 'user.email')
42
+ assert_requested :put, 'https://api.castle.io/v1/lists/list_id', times: 1
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: castle-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Brissmyr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-12 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -40,12 +40,27 @@ files:
40
40
  - lib/castle/api/filter.rb
41
41
  - lib/castle/api/get_device.rb
42
42
  - lib/castle/api/get_devices_for_user.rb
43
+ - lib/castle/api/list_items/archive.rb
44
+ - lib/castle/api/list_items/count.rb
45
+ - lib/castle/api/list_items/create.rb
46
+ - lib/castle/api/list_items/get.rb
47
+ - lib/castle/api/list_items/query.rb
48
+ - lib/castle/api/list_items/unarchive.rb
49
+ - lib/castle/api/list_items/update.rb
50
+ - lib/castle/api/lists/create.rb
51
+ - lib/castle/api/lists/delete.rb
52
+ - lib/castle/api/lists/get.rb
53
+ - lib/castle/api/lists/get_all.rb
54
+ - lib/castle/api/lists/query.rb
55
+ - lib/castle/api/lists/update.rb
43
56
  - lib/castle/api/log.rb
44
57
  - lib/castle/api/report_device.rb
45
58
  - lib/castle/api/risk.rb
46
59
  - lib/castle/api/start_impersonation.rb
47
60
  - lib/castle/api/track.rb
48
61
  - lib/castle/client.rb
62
+ - lib/castle/client_actions/list_items.rb
63
+ - lib/castle/client_actions/lists.rb
49
64
  - lib/castle/client_id/extract.rb
50
65
  - lib/castle/command.rb
51
66
  - lib/castle/commands/approve_device.rb
@@ -54,6 +69,19 @@ files:
54
69
  - lib/castle/commands/filter.rb
55
70
  - lib/castle/commands/get_device.rb
56
71
  - lib/castle/commands/get_devices_for_user.rb
72
+ - lib/castle/commands/list_items/archive.rb
73
+ - lib/castle/commands/list_items/count.rb
74
+ - lib/castle/commands/list_items/create.rb
75
+ - lib/castle/commands/list_items/get.rb
76
+ - lib/castle/commands/list_items/query.rb
77
+ - lib/castle/commands/list_items/unarchive.rb
78
+ - lib/castle/commands/list_items/update.rb
79
+ - lib/castle/commands/lists/create.rb
80
+ - lib/castle/commands/lists/delete.rb
81
+ - lib/castle/commands/lists/get.rb
82
+ - lib/castle/commands/lists/get_all.rb
83
+ - lib/castle/commands/lists/query.rb
84
+ - lib/castle/commands/lists/update.rb
57
85
  - lib/castle/commands/log.rb
58
86
  - lib/castle/commands/report_device.rb
59
87
  - lib/castle/commands/risk.rb
@@ -105,6 +133,19 @@ files:
105
133
  - spec/lib/castle/api/filter_spec.rb
106
134
  - spec/lib/castle/api/get_device_spec.rb
107
135
  - spec/lib/castle/api/get_devices_for_user_spec.rb
136
+ - spec/lib/castle/api/list_items/archive_spec.rb
137
+ - spec/lib/castle/api/list_items/count_spec.rb
138
+ - spec/lib/castle/api/list_items/create_spec.rb
139
+ - spec/lib/castle/api/list_items/get_spec.rb
140
+ - spec/lib/castle/api/list_items/query_spec.rb
141
+ - spec/lib/castle/api/list_items/unarchive_spec.rb
142
+ - spec/lib/castle/api/list_items/update_spec.rb
143
+ - spec/lib/castle/api/lists/create_spec.rb
144
+ - spec/lib/castle/api/lists/delete_spec.rb
145
+ - spec/lib/castle/api/lists/get_all_spec.rb
146
+ - spec/lib/castle/api/lists/get_spec.rb
147
+ - spec/lib/castle/api/lists/query_spec.rb
148
+ - spec/lib/castle/api/lists/update_spec.rb
108
149
  - spec/lib/castle/api/log_spec.rb
109
150
  - spec/lib/castle/api/report_device_spec.rb
110
151
  - spec/lib/castle/api/risk_spec.rb
@@ -120,6 +161,19 @@ files:
120
161
  - spec/lib/castle/commands/filter_spec.rb
121
162
  - spec/lib/castle/commands/get_device_spec.rb
122
163
  - spec/lib/castle/commands/get_devices_for_user_spec.rb
164
+ - spec/lib/castle/commands/list_items/archive_spec.rb
165
+ - spec/lib/castle/commands/list_items/count_spec.rb
166
+ - spec/lib/castle/commands/list_items/create_spec.rb
167
+ - spec/lib/castle/commands/list_items/get_spec.rb
168
+ - spec/lib/castle/commands/list_items/query_spec.rb
169
+ - spec/lib/castle/commands/list_items/unarchive_spec.rb
170
+ - spec/lib/castle/commands/list_items/update_spec.rb
171
+ - spec/lib/castle/commands/lists/create_spec.rb
172
+ - spec/lib/castle/commands/lists/delete_spec.rb
173
+ - spec/lib/castle/commands/lists/get_all_spec.rb
174
+ - spec/lib/castle/commands/lists/get_spec.rb
175
+ - spec/lib/castle/commands/lists/query_spec.rb
176
+ - spec/lib/castle/commands/lists/update_spec.rb
123
177
  - spec/lib/castle/commands/log_spec.rb
124
178
  - spec/lib/castle/commands/report_device_spec.rb
125
179
  - spec/lib/castle/commands/risk_spec.rb
@@ -158,6 +212,8 @@ files:
158
212
  - spec/spec_helper.rb
159
213
  - spec/support/shared_examples/action_request.rb
160
214
  - spec/support/shared_examples/configuration.rb
215
+ - spec/support/shared_examples/list_items.rb
216
+ - spec/support/shared_examples/lists.rb
161
217
  homepage: https://castle.io
162
218
  licenses:
163
219
  - MIT
@@ -177,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
233
  - !ruby/object:Gem::Version
178
234
  version: '0'
179
235
  requirements: []
180
- rubygems_version: 3.5.17
236
+ rubygems_version: 3.5.21
181
237
  signing_key:
182
238
  specification_version: 4
183
239
  summary: Castle
@@ -192,6 +248,19 @@ test_files:
192
248
  - spec/lib/castle/api/filter_spec.rb
193
249
  - spec/lib/castle/api/get_device_spec.rb
194
250
  - spec/lib/castle/api/get_devices_for_user_spec.rb
251
+ - spec/lib/castle/api/list_items/archive_spec.rb
252
+ - spec/lib/castle/api/list_items/count_spec.rb
253
+ - spec/lib/castle/api/list_items/create_spec.rb
254
+ - spec/lib/castle/api/list_items/get_spec.rb
255
+ - spec/lib/castle/api/list_items/query_spec.rb
256
+ - spec/lib/castle/api/list_items/unarchive_spec.rb
257
+ - spec/lib/castle/api/list_items/update_spec.rb
258
+ - spec/lib/castle/api/lists/create_spec.rb
259
+ - spec/lib/castle/api/lists/delete_spec.rb
260
+ - spec/lib/castle/api/lists/get_all_spec.rb
261
+ - spec/lib/castle/api/lists/get_spec.rb
262
+ - spec/lib/castle/api/lists/query_spec.rb
263
+ - spec/lib/castle/api/lists/update_spec.rb
195
264
  - spec/lib/castle/api/log_spec.rb
196
265
  - spec/lib/castle/api/report_device_spec.rb
197
266
  - spec/lib/castle/api/risk_spec.rb
@@ -207,6 +276,19 @@ test_files:
207
276
  - spec/lib/castle/commands/filter_spec.rb
208
277
  - spec/lib/castle/commands/get_device_spec.rb
209
278
  - spec/lib/castle/commands/get_devices_for_user_spec.rb
279
+ - spec/lib/castle/commands/list_items/archive_spec.rb
280
+ - spec/lib/castle/commands/list_items/count_spec.rb
281
+ - spec/lib/castle/commands/list_items/create_spec.rb
282
+ - spec/lib/castle/commands/list_items/get_spec.rb
283
+ - spec/lib/castle/commands/list_items/query_spec.rb
284
+ - spec/lib/castle/commands/list_items/unarchive_spec.rb
285
+ - spec/lib/castle/commands/list_items/update_spec.rb
286
+ - spec/lib/castle/commands/lists/create_spec.rb
287
+ - spec/lib/castle/commands/lists/delete_spec.rb
288
+ - spec/lib/castle/commands/lists/get_all_spec.rb
289
+ - spec/lib/castle/commands/lists/get_spec.rb
290
+ - spec/lib/castle/commands/lists/query_spec.rb
291
+ - spec/lib/castle/commands/lists/update_spec.rb
210
292
  - spec/lib/castle/commands/log_spec.rb
211
293
  - spec/lib/castle/commands/report_device_spec.rb
212
294
  - spec/lib/castle/commands/risk_spec.rb
@@ -245,3 +327,5 @@ test_files:
245
327
  - spec/spec_helper.rb
246
328
  - spec/support/shared_examples/action_request.rb
247
329
  - spec/support/shared_examples/configuration.rb
330
+ - spec/support/shared_examples/list_items.rb
331
+ - spec/support/shared_examples/lists.rb