castle-rb 8.1.0 → 9.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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +317 -0
  3. data/LICENSE +21 -0
  4. data/README.md +290 -112
  5. data/lib/castle/api/filter.rb +3 -1
  6. data/lib/castle/api/list_items/create_batch.rb +22 -0
  7. data/lib/castle/api/lists/create.rb +1 -1
  8. data/lib/castle/api/log.rb +2 -1
  9. data/lib/castle/api/privacy/delete_data.rb +23 -0
  10. data/lib/castle/api/privacy/request_data.rb +23 -0
  11. data/lib/castle/api/risk.rb +2 -1
  12. data/lib/castle/client.rb +12 -52
  13. data/lib/castle/client_actions/list_items.rb +7 -2
  14. data/lib/castle/client_actions/privacy.rb +20 -0
  15. data/lib/castle/commands/list_items/create_batch.rb +22 -0
  16. data/lib/castle/commands/privacy/delete_data.rb +20 -0
  17. data/lib/castle/commands/privacy/request_data.rb +20 -0
  18. data/lib/castle/core/get_connection.rb +5 -1
  19. data/lib/castle/core/process_response.rb +1 -0
  20. data/lib/castle/core/process_webhook.rb +1 -1
  21. data/lib/castle/core/send_request.rb +2 -1
  22. data/lib/castle/errors.rb +1 -5
  23. data/lib/castle/headers/filter.rb +1 -1
  24. data/lib/castle/version.rb +1 -1
  25. data/lib/castle.rb +8 -17
  26. metadata +34 -218
  27. data/lib/castle/api/approve_device.rb +0 -20
  28. data/lib/castle/api/authenticate.rb +0 -28
  29. data/lib/castle/api/end_impersonation.rb +0 -22
  30. data/lib/castle/api/get_device.rb +0 -20
  31. data/lib/castle/api/get_devices_for_user.rb +0 -20
  32. data/lib/castle/api/report_device.rb +0 -20
  33. data/lib/castle/api/start_impersonation.rb +0 -22
  34. data/lib/castle/api/track.rb +0 -19
  35. data/lib/castle/commands/approve_device.rb +0 -17
  36. data/lib/castle/commands/authenticate.rb +0 -23
  37. data/lib/castle/commands/end_impersonation.rb +0 -25
  38. data/lib/castle/commands/get_device.rb +0 -17
  39. data/lib/castle/commands/get_devices_for_user.rb +0 -17
  40. data/lib/castle/commands/report_device.rb +0 -17
  41. data/lib/castle/commands/start_impersonation.rb +0 -25
  42. data/lib/castle/commands/track.rb +0 -22
  43. data/lib/castle/support/hanami.rb +0 -15
  44. data/lib/castle/support/padrino.rb +0 -19
  45. data/spec/integration/rails/rails_spec.rb +0 -95
  46. data/spec/integration/rails/support/all.rb +0 -6
  47. data/spec/integration/rails/support/application.rb +0 -17
  48. data/spec/integration/rails/support/home_controller.rb +0 -39
  49. data/spec/lib/castle/api/approve_device_spec.rb +0 -17
  50. data/spec/lib/castle/api/authenticate_spec.rb +0 -133
  51. data/spec/lib/castle/api/end_impersonation_spec.rb +0 -59
  52. data/spec/lib/castle/api/filter_spec.rb +0 -5
  53. data/spec/lib/castle/api/get_device_spec.rb +0 -17
  54. data/spec/lib/castle/api/get_devices_for_user_spec.rb +0 -17
  55. data/spec/lib/castle/api/list_items/archive_spec.rb +0 -18
  56. data/spec/lib/castle/api/list_items/count_spec.rb +0 -21
  57. data/spec/lib/castle/api/list_items/create_spec.rb +0 -22
  58. data/spec/lib/castle/api/list_items/get_spec.rb +0 -18
  59. data/spec/lib/castle/api/list_items/query_spec.rb +0 -21
  60. data/spec/lib/castle/api/list_items/unarchive_spec.rb +0 -18
  61. data/spec/lib/castle/api/list_items/update_spec.rb +0 -22
  62. data/spec/lib/castle/api/lists/create_spec.rb +0 -21
  63. data/spec/lib/castle/api/lists/delete_spec.rb +0 -17
  64. data/spec/lib/castle/api/lists/get_all_spec.rb +0 -17
  65. data/spec/lib/castle/api/lists/get_spec.rb +0 -17
  66. data/spec/lib/castle/api/lists/query_spec.rb +0 -21
  67. data/spec/lib/castle/api/lists/update_spec.rb +0 -21
  68. data/spec/lib/castle/api/log_spec.rb +0 -5
  69. data/spec/lib/castle/api/report_device_spec.rb +0 -17
  70. data/spec/lib/castle/api/risk_spec.rb +0 -5
  71. data/spec/lib/castle/api/start_impersonation_spec.rb +0 -59
  72. data/spec/lib/castle/api/track_spec.rb +0 -65
  73. data/spec/lib/castle/api_spec.rb +0 -36
  74. data/spec/lib/castle/client_id/extract_spec.rb +0 -47
  75. data/spec/lib/castle/client_spec.rb +0 -342
  76. data/spec/lib/castle/command_spec.rb +0 -9
  77. data/spec/lib/castle/commands/approve_device_spec.rb +0 -24
  78. data/spec/lib/castle/commands/authenticate_spec.rb +0 -86
  79. data/spec/lib/castle/commands/end_impersonation_spec.rb +0 -72
  80. data/spec/lib/castle/commands/filter_spec.rb +0 -72
  81. data/spec/lib/castle/commands/get_device_spec.rb +0 -24
  82. data/spec/lib/castle/commands/get_devices_for_user_spec.rb +0 -24
  83. data/spec/lib/castle/commands/list_items/archive_spec.rb +0 -21
  84. data/spec/lib/castle/commands/list_items/count_spec.rb +0 -21
  85. data/spec/lib/castle/commands/list_items/create_spec.rb +0 -22
  86. data/spec/lib/castle/commands/list_items/get_spec.rb +0 -21
  87. data/spec/lib/castle/commands/list_items/query_spec.rb +0 -27
  88. data/spec/lib/castle/commands/list_items/unarchive_spec.rb +0 -21
  89. data/spec/lib/castle/commands/list_items/update_spec.rb +0 -21
  90. data/spec/lib/castle/commands/lists/create_spec.rb +0 -33
  91. data/spec/lib/castle/commands/lists/delete_spec.rb +0 -21
  92. data/spec/lib/castle/commands/lists/get_all_spec.rb +0 -11
  93. data/spec/lib/castle/commands/lists/get_spec.rb +0 -21
  94. data/spec/lib/castle/commands/lists/query_spec.rb +0 -27
  95. data/spec/lib/castle/commands/lists/update_spec.rb +0 -29
  96. data/spec/lib/castle/commands/log_spec.rb +0 -73
  97. data/spec/lib/castle/commands/report_device_spec.rb +0 -24
  98. data/spec/lib/castle/commands/risk_spec.rb +0 -73
  99. data/spec/lib/castle/commands/start_impersonation_spec.rb +0 -72
  100. data/spec/lib/castle/commands/track_spec.rb +0 -89
  101. data/spec/lib/castle/configuration_spec.rb +0 -14
  102. data/spec/lib/castle/context/get_default_spec.rb +0 -41
  103. data/spec/lib/castle/context/merge_spec.rb +0 -23
  104. data/spec/lib/castle/context/prepare_spec.rb +0 -42
  105. data/spec/lib/castle/context/sanitize_spec.rb +0 -27
  106. data/spec/lib/castle/core/get_connection_spec.rb +0 -43
  107. data/spec/lib/castle/core/process_response_spec.rb +0 -103
  108. data/spec/lib/castle/core/process_webhook_spec.rb +0 -52
  109. data/spec/lib/castle/core/send_request_spec.rb +0 -97
  110. data/spec/lib/castle/failover/strategy_spec.rb +0 -12
  111. data/spec/lib/castle/headers/extract_spec.rb +0 -103
  112. data/spec/lib/castle/headers/filter_spec.rb +0 -42
  113. data/spec/lib/castle/headers/format_spec.rb +0 -25
  114. data/spec/lib/castle/ips/extract_spec.rb +0 -91
  115. data/spec/lib/castle/logger_spec.rb +0 -39
  116. data/spec/lib/castle/payload/prepare_spec.rb +0 -52
  117. data/spec/lib/castle/secure_mode_spec.rb +0 -7
  118. data/spec/lib/castle/session_spec.rb +0 -61
  119. data/spec/lib/castle/singleton_configuration_spec.rb +0 -14
  120. data/spec/lib/castle/utils/clean_invalid_chars_spec.rb +0 -69
  121. data/spec/lib/castle/utils/clone_spec.rb +0 -19
  122. data/spec/lib/castle/utils/deep_symbolize_keys_spec.rb +0 -50
  123. data/spec/lib/castle/utils/get_timestamp_spec.rb +0 -16
  124. data/spec/lib/castle/utils/merge_spec.rb +0 -13
  125. data/spec/lib/castle/validators/not_supported_spec.rb +0 -19
  126. data/spec/lib/castle/validators/present_spec.rb +0 -25
  127. data/spec/lib/castle/verdict_spec.rb +0 -9
  128. data/spec/lib/castle/version_spec.rb +0 -5
  129. data/spec/lib/castle/webhooks/verify_spec.rb +0 -59
  130. data/spec/lib/castle_spec.rb +0 -58
  131. data/spec/spec_helper.rb +0 -26
  132. data/spec/support/shared_examples/action_request.rb +0 -167
  133. data/spec/support/shared_examples/configuration.rb +0 -99
  134. data/spec/support/shared_examples/list_items.rb +0 -52
  135. data/spec/support/shared_examples/lists.rb +0 -45
metadata CHANGED
@@ -1,48 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: castle-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Brissmyr
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: appraisal
13
+ name: base64
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
18
+ version: '0.2'
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">="
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
27
- description: Castle protects your users from account compromise
28
- email: johan@castle.io
25
+ version: '0.2'
26
+ description: |-
27
+ Castle protects web and mobile applications from account takeovers,
28
+ fake accounts, bots, and other forms of account abuse. This gem is
29
+ the official server-side Ruby SDK: it sends user events, retrieves
30
+ real-time risk decisions, manages trust and block lists, and
31
+ verifies webhook signatures.
32
+ email: team@castle.io
29
33
  executables: []
30
34
  extensions: []
31
35
  extra_rdoc_files: []
32
36
  files:
37
+ - CHANGELOG.md
38
+ - LICENSE
33
39
  - README.md
34
40
  - lib/castle-rb.rb
35
41
  - lib/castle.rb
36
42
  - lib/castle/api.rb
37
- - lib/castle/api/approve_device.rb
38
- - lib/castle/api/authenticate.rb
39
- - lib/castle/api/end_impersonation.rb
40
43
  - lib/castle/api/filter.rb
41
- - lib/castle/api/get_device.rb
42
- - lib/castle/api/get_devices_for_user.rb
43
44
  - lib/castle/api/list_items/archive.rb
44
45
  - lib/castle/api/list_items/count.rb
45
46
  - lib/castle/api/list_items/create.rb
47
+ - lib/castle/api/list_items/create_batch.rb
46
48
  - lib/castle/api/list_items/get.rb
47
49
  - lib/castle/api/list_items/query.rb
48
50
  - lib/castle/api/list_items/unarchive.rb
@@ -54,24 +56,20 @@ files:
54
56
  - lib/castle/api/lists/query.rb
55
57
  - lib/castle/api/lists/update.rb
56
58
  - lib/castle/api/log.rb
57
- - lib/castle/api/report_device.rb
59
+ - lib/castle/api/privacy/delete_data.rb
60
+ - lib/castle/api/privacy/request_data.rb
58
61
  - lib/castle/api/risk.rb
59
- - lib/castle/api/start_impersonation.rb
60
- - lib/castle/api/track.rb
61
62
  - lib/castle/client.rb
62
63
  - lib/castle/client_actions/list_items.rb
63
64
  - lib/castle/client_actions/lists.rb
65
+ - lib/castle/client_actions/privacy.rb
64
66
  - lib/castle/client_id/extract.rb
65
67
  - lib/castle/command.rb
66
- - lib/castle/commands/approve_device.rb
67
- - lib/castle/commands/authenticate.rb
68
- - lib/castle/commands/end_impersonation.rb
69
68
  - lib/castle/commands/filter.rb
70
- - lib/castle/commands/get_device.rb
71
- - lib/castle/commands/get_devices_for_user.rb
72
69
  - lib/castle/commands/list_items/archive.rb
73
70
  - lib/castle/commands/list_items/count.rb
74
71
  - lib/castle/commands/list_items/create.rb
72
+ - lib/castle/commands/list_items/create_batch.rb
75
73
  - lib/castle/commands/list_items/get.rb
76
74
  - lib/castle/commands/list_items/query.rb
77
75
  - lib/castle/commands/list_items/unarchive.rb
@@ -83,10 +81,9 @@ files:
83
81
  - lib/castle/commands/lists/query.rb
84
82
  - lib/castle/commands/lists/update.rb
85
83
  - lib/castle/commands/log.rb
86
- - lib/castle/commands/report_device.rb
84
+ - lib/castle/commands/privacy/delete_data.rb
85
+ - lib/castle/commands/privacy/request_data.rb
87
86
  - lib/castle/commands/risk.rb
88
- - lib/castle/commands/start_impersonation.rb
89
- - lib/castle/commands/track.rb
90
87
  - lib/castle/configuration.rb
91
88
  - lib/castle/context/get_default.rb
92
89
  - lib/castle/context/merge.rb
@@ -108,8 +105,6 @@ files:
108
105
  - lib/castle/secure_mode.rb
109
106
  - lib/castle/session.rb
110
107
  - lib/castle/singleton_configuration.rb
111
- - lib/castle/support/hanami.rb
112
- - lib/castle/support/padrino.rb
113
108
  - lib/castle/support/rails.rb
114
109
  - lib/castle/support/sinatra.rb
115
110
  - lib/castle/utils/clean_invalid_chars.rb
@@ -123,102 +118,15 @@ files:
123
118
  - lib/castle/verdict.rb
124
119
  - lib/castle/version.rb
125
120
  - lib/castle/webhooks/verify.rb
126
- - spec/integration/rails/rails_spec.rb
127
- - spec/integration/rails/support/all.rb
128
- - spec/integration/rails/support/application.rb
129
- - spec/integration/rails/support/home_controller.rb
130
- - spec/lib/castle/api/approve_device_spec.rb
131
- - spec/lib/castle/api/authenticate_spec.rb
132
- - spec/lib/castle/api/end_impersonation_spec.rb
133
- - spec/lib/castle/api/filter_spec.rb
134
- - spec/lib/castle/api/get_device_spec.rb
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
149
- - spec/lib/castle/api/log_spec.rb
150
- - spec/lib/castle/api/report_device_spec.rb
151
- - spec/lib/castle/api/risk_spec.rb
152
- - spec/lib/castle/api/start_impersonation_spec.rb
153
- - spec/lib/castle/api/track_spec.rb
154
- - spec/lib/castle/api_spec.rb
155
- - spec/lib/castle/client_id/extract_spec.rb
156
- - spec/lib/castle/client_spec.rb
157
- - spec/lib/castle/command_spec.rb
158
- - spec/lib/castle/commands/approve_device_spec.rb
159
- - spec/lib/castle/commands/authenticate_spec.rb
160
- - spec/lib/castle/commands/end_impersonation_spec.rb
161
- - spec/lib/castle/commands/filter_spec.rb
162
- - spec/lib/castle/commands/get_device_spec.rb
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
177
- - spec/lib/castle/commands/log_spec.rb
178
- - spec/lib/castle/commands/report_device_spec.rb
179
- - spec/lib/castle/commands/risk_spec.rb
180
- - spec/lib/castle/commands/start_impersonation_spec.rb
181
- - spec/lib/castle/commands/track_spec.rb
182
- - spec/lib/castle/configuration_spec.rb
183
- - spec/lib/castle/context/get_default_spec.rb
184
- - spec/lib/castle/context/merge_spec.rb
185
- - spec/lib/castle/context/prepare_spec.rb
186
- - spec/lib/castle/context/sanitize_spec.rb
187
- - spec/lib/castle/core/get_connection_spec.rb
188
- - spec/lib/castle/core/process_response_spec.rb
189
- - spec/lib/castle/core/process_webhook_spec.rb
190
- - spec/lib/castle/core/send_request_spec.rb
191
- - spec/lib/castle/failover/strategy_spec.rb
192
- - spec/lib/castle/headers/extract_spec.rb
193
- - spec/lib/castle/headers/filter_spec.rb
194
- - spec/lib/castle/headers/format_spec.rb
195
- - spec/lib/castle/ips/extract_spec.rb
196
- - spec/lib/castle/logger_spec.rb
197
- - spec/lib/castle/payload/prepare_spec.rb
198
- - spec/lib/castle/secure_mode_spec.rb
199
- - spec/lib/castle/session_spec.rb
200
- - spec/lib/castle/singleton_configuration_spec.rb
201
- - spec/lib/castle/utils/clean_invalid_chars_spec.rb
202
- - spec/lib/castle/utils/clone_spec.rb
203
- - spec/lib/castle/utils/deep_symbolize_keys_spec.rb
204
- - spec/lib/castle/utils/get_timestamp_spec.rb
205
- - spec/lib/castle/utils/merge_spec.rb
206
- - spec/lib/castle/validators/not_supported_spec.rb
207
- - spec/lib/castle/validators/present_spec.rb
208
- - spec/lib/castle/verdict_spec.rb
209
- - spec/lib/castle/version_spec.rb
210
- - spec/lib/castle/webhooks/verify_spec.rb
211
- - spec/lib/castle_spec.rb
212
- - spec/spec_helper.rb
213
- - spec/support/shared_examples/action_request.rb
214
- - spec/support/shared_examples/configuration.rb
215
- - spec/support/shared_examples/list_items.rb
216
- - spec/support/shared_examples/lists.rb
217
121
  homepage: https://castle.io
218
122
  licenses:
219
123
  - MIT
220
- metadata: {}
221
- post_install_message:
124
+ metadata:
125
+ homepage_uri: https://castle.io
126
+ source_code_uri: https://github.com/castle/castle-ruby
127
+ changelog_uri: https://github.com/castle/castle-ruby/blob/master/CHANGELOG.md
128
+ bug_tracker_uri: https://github.com/castle/castle-ruby/issues
129
+ rubygems_mfa_required: 'true'
222
130
  rdoc_options: []
223
131
  require_paths:
224
132
  - lib
@@ -226,106 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
134
  requirements:
227
135
  - - ">="
228
136
  - !ruby/object:Gem::Version
229
- version: '2.7'
137
+ version: '3.2'
230
138
  required_rubygems_version: !ruby/object:Gem::Requirement
231
139
  requirements:
232
140
  - - ">="
233
141
  - !ruby/object:Gem::Version
234
142
  version: '0'
235
143
  requirements: []
236
- rubygems_version: 3.5.21
237
- signing_key:
144
+ rubygems_version: 3.6.9
238
145
  specification_version: 4
239
- summary: Castle
240
- test_files:
241
- - spec/integration/rails/rails_spec.rb
242
- - spec/integration/rails/support/all.rb
243
- - spec/integration/rails/support/application.rb
244
- - spec/integration/rails/support/home_controller.rb
245
- - spec/lib/castle/api/approve_device_spec.rb
246
- - spec/lib/castle/api/authenticate_spec.rb
247
- - spec/lib/castle/api/end_impersonation_spec.rb
248
- - spec/lib/castle/api/filter_spec.rb
249
- - spec/lib/castle/api/get_device_spec.rb
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
264
- - spec/lib/castle/api/log_spec.rb
265
- - spec/lib/castle/api/report_device_spec.rb
266
- - spec/lib/castle/api/risk_spec.rb
267
- - spec/lib/castle/api/start_impersonation_spec.rb
268
- - spec/lib/castle/api/track_spec.rb
269
- - spec/lib/castle/api_spec.rb
270
- - spec/lib/castle/client_id/extract_spec.rb
271
- - spec/lib/castle/client_spec.rb
272
- - spec/lib/castle/command_spec.rb
273
- - spec/lib/castle/commands/approve_device_spec.rb
274
- - spec/lib/castle/commands/authenticate_spec.rb
275
- - spec/lib/castle/commands/end_impersonation_spec.rb
276
- - spec/lib/castle/commands/filter_spec.rb
277
- - spec/lib/castle/commands/get_device_spec.rb
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
292
- - spec/lib/castle/commands/log_spec.rb
293
- - spec/lib/castle/commands/report_device_spec.rb
294
- - spec/lib/castle/commands/risk_spec.rb
295
- - spec/lib/castle/commands/start_impersonation_spec.rb
296
- - spec/lib/castle/commands/track_spec.rb
297
- - spec/lib/castle/configuration_spec.rb
298
- - spec/lib/castle/context/get_default_spec.rb
299
- - spec/lib/castle/context/merge_spec.rb
300
- - spec/lib/castle/context/prepare_spec.rb
301
- - spec/lib/castle/context/sanitize_spec.rb
302
- - spec/lib/castle/core/get_connection_spec.rb
303
- - spec/lib/castle/core/process_response_spec.rb
304
- - spec/lib/castle/core/process_webhook_spec.rb
305
- - spec/lib/castle/core/send_request_spec.rb
306
- - spec/lib/castle/failover/strategy_spec.rb
307
- - spec/lib/castle/headers/extract_spec.rb
308
- - spec/lib/castle/headers/filter_spec.rb
309
- - spec/lib/castle/headers/format_spec.rb
310
- - spec/lib/castle/ips/extract_spec.rb
311
- - spec/lib/castle/logger_spec.rb
312
- - spec/lib/castle/payload/prepare_spec.rb
313
- - spec/lib/castle/secure_mode_spec.rb
314
- - spec/lib/castle/session_spec.rb
315
- - spec/lib/castle/singleton_configuration_spec.rb
316
- - spec/lib/castle/utils/clean_invalid_chars_spec.rb
317
- - spec/lib/castle/utils/clone_spec.rb
318
- - spec/lib/castle/utils/deep_symbolize_keys_spec.rb
319
- - spec/lib/castle/utils/get_timestamp_spec.rb
320
- - spec/lib/castle/utils/merge_spec.rb
321
- - spec/lib/castle/validators/not_supported_spec.rb
322
- - spec/lib/castle/validators/present_spec.rb
323
- - spec/lib/castle/verdict_spec.rb
324
- - spec/lib/castle/version_spec.rb
325
- - spec/lib/castle/webhooks/verify_spec.rb
326
- - spec/lib/castle_spec.rb
327
- - spec/spec_helper.rb
328
- - spec/support/shared_examples/action_request.rb
329
- - spec/support/shared_examples/configuration.rb
330
- - spec/support/shared_examples/list_items.rb
331
- - spec/support/shared_examples/lists.rb
146
+ summary: Official Ruby SDK for the Castle fraud and account-abuse prevention platform
147
+ test_files: []
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends PUT devices/#{device_token}/approve request
6
- module ApproveDevice
7
- class << self
8
- # @param options [Hash]
9
- # return [Hash]
10
- def call(options = {})
11
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {})
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API.call(Castle::Commands::ApproveDevice.build(options), {}, http, config)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- module Authenticate
6
- class << self
7
- # @param options [Hash]
8
- # return [Hash]
9
- def call(options = {})
10
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {}) unless options[:no_symbolize]
11
- options.delete(:no_symbolize)
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- response = Castle::API.call(Castle::Commands::Authenticate.build(options), {}, http, config)
16
- response.merge(failover: false, failover_reason: nil)
17
- rescue Castle::RequestError, Castle::InternalServerError => e
18
- unless config.failover_strategy == :throw
19
- strategy = (config || Castle.config).failover_strategy
20
- return(Castle::Failover::PrepareResponse.new(options[:user_id], reason: e.to_s, strategy: strategy).call)
21
- end
22
-
23
- raise e
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends DELETE impersonate request
6
- module EndImpersonation
7
- class << self
8
- # @param options [Hash]
9
- def call(options = {})
10
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {}) unless options[:no_symbolize]
11
- options.delete(:no_symbolize)
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API
16
- .call(Castle::Commands::EndImpersonation.build(options), {}, http, config)
17
- .tap { |response| raise Castle::ImpersonationFailed unless response[:success] }
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends GET devices/#{device_token} request
6
- module GetDevice
7
- class << self
8
- # @param options [Hash]
9
- # return [Hash]
10
- def call(options = {})
11
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {})
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API.call(Castle::Commands::GetDevice.build(options), {}, http, config)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends GET users/#{user_id}/devices request
6
- module GetDevicesForUser
7
- class << self
8
- # @param options [Hash]
9
- # return [Hash]
10
- def call(options = {})
11
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {})
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API.call(Castle::Commands::GetDevicesForUser.build(options), {}, http, config)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends PUT devices/#{device_token}/report request
6
- module ReportDevice
7
- class << self
8
- # @param options [Hash]
9
- # return [Hash]
10
- def call(options = {})
11
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {})
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API.call(Castle::Commands::ReportDevice.build(options), {}, http, config)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- # Sends POST impersonate request
6
- module StartImpersonation
7
- class << self
8
- # @param options [Hash]
9
- def call(options = {})
10
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {}) unless options[:no_symbolize]
11
- options.delete(:no_symbolize)
12
- http = options.delete(:http)
13
- config = options.delete(:config) || Castle.config
14
-
15
- Castle::API
16
- .call(Castle::Commands::StartImpersonation.build(options), {}, http, config)
17
- .tap { |response| raise Castle::ImpersonationFailed unless response[:success] }
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module API
5
- module Track
6
- class << self
7
- # @param options [Hash]
8
- def call(options = {})
9
- options = Castle::Utils::DeepSymbolizeKeys.call(options || {}) unless options[:no_symbolize]
10
- options.delete(:no_symbolize)
11
- http = options.delete(:http)
12
- config = options.delete(:config) || Castle.config
13
-
14
- Castle::API.call(Castle::Commands::Track.build(options), {}, http, config)
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # Generates the payload for the PUT devices/#{device_token}/approve request
6
- class ApproveDevice
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[device_token])
12
- Castle::Command.new("devices/#{options[:device_token]}/approve", nil, :put)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # Generates the payload for the authenticate request
6
- class Authenticate
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[event])
12
- context = Castle::Context::Sanitize.call(options[:context])
13
-
14
- Castle::Command.new(
15
- 'authenticate',
16
- options.merge(context: context, sent_at: Castle::Utils::GetTimestamp.call),
17
- :post
18
- )
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # builder for impersonate command
6
- class EndImpersonation
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[user_id])
12
- context = Castle::Context::Sanitize.call(options[:context])
13
-
14
- Castle::Validators::Present.call(context, %i[user_agent ip])
15
-
16
- Castle::Command.new(
17
- 'impersonate',
18
- options.merge(context: context, sent_at: Castle::Utils::GetTimestamp.call),
19
- :delete
20
- )
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # Generates the payload for the GET devices/#{device_token} request
6
- class GetDevice
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[device_token])
12
- Castle::Command.new("devices/#{options[:device_token]}", nil, :get)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # Generates the payload for the GET users/#{user_id}/devices request
6
- class GetDevicesForUser
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[user_id])
12
- Castle::Command.new("users/#{options[:user_id]}/devices", nil, :get)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # Generates the payload for the PUT devices/#{device_token}/report request
6
- class ReportDevice
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[device_token])
12
- Castle::Command.new("devices/#{options[:device_token]}/report", nil, :put)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Castle
4
- module Commands
5
- # builder for impersonate command
6
- class StartImpersonation
7
- class << self
8
- # @param options [Hash]
9
- # @return [Castle::Command]
10
- def build(options = {})
11
- Castle::Validators::Present.call(options, %i[user_id])
12
- context = Castle::Context::Sanitize.call(options[:context])
13
-
14
- Castle::Validators::Present.call(context, %i[user_agent ip])
15
-
16
- Castle::Command.new(
17
- 'impersonate',
18
- options.merge(context: context, sent_at: Castle::Utils::GetTimestamp.call),
19
- :post
20
- )
21
- end
22
- end
23
- end
24
- end
25
- end