prelude-sdk 0.2.0 → 0.4.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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +81 -0
  3. data/README.md +1 -1
  4. data/lib/prelude_sdk/client.rb +22 -1
  5. data/lib/prelude_sdk/internal/transport/pooled_net_requester.rb +13 -11
  6. data/lib/prelude_sdk/internal/util.rb +61 -10
  7. data/lib/prelude_sdk/models/lookup_lookup_params.rb +9 -1
  8. data/lib/prelude_sdk/models/notify_get_subscription_config_params.rb +7 -1
  9. data/lib/prelude_sdk/models/notify_get_subscription_phone_number_params.rb +7 -1
  10. data/lib/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rb +8 -1
  11. data/lib/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rb +8 -1
  12. data/lib/prelude_sdk/models/notify_send_batch_params.rb +55 -1
  13. data/lib/prelude_sdk/models/notify_send_batch_response.rb +39 -1
  14. data/lib/prelude_sdk/models/notify_send_params.rb +92 -1
  15. data/lib/prelude_sdk/models/notify_send_response.rb +36 -1
  16. data/lib/prelude_sdk/models/transactional_send_params.rb +54 -1
  17. data/lib/prelude_sdk/models/verification_create_params.rb +35 -48
  18. data/lib/prelude_sdk/models/verification_create_response.rb +66 -1
  19. data/lib/prelude_sdk/models/verification_management_delete_phone_number_params.rb +8 -1
  20. data/lib/prelude_sdk/models/verification_management_list_phone_numbers_params.rb +7 -1
  21. data/lib/prelude_sdk/models/verification_management_set_phone_number_params.rb +8 -1
  22. data/lib/prelude_sdk/models/watch_predict_params.rb +16 -12
  23. data/lib/prelude_sdk/models/watch_predict_response.rb +51 -1
  24. data/lib/prelude_sdk/models/watch_send_events_params.rb +6 -2
  25. data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +7 -130
  26. data/lib/prelude_sdk/resources/lookup.rb +4 -1
  27. data/lib/prelude_sdk/resources/notify.rb +19 -7
  28. data/lib/prelude_sdk/resources/transactional.rb +4 -1
  29. data/lib/prelude_sdk/resources/verification.rb +1 -0
  30. data/lib/prelude_sdk/resources/verification_management.rb +1 -0
  31. data/lib/prelude_sdk/resources/watch.rb +9 -2
  32. data/lib/prelude_sdk/version.rb +1 -1
  33. data/rbi/prelude_sdk/client.rbi +7 -0
  34. data/rbi/prelude_sdk/internal/util.rbi +29 -1
  35. data/rbi/prelude_sdk/models/lookup_lookup_params.rbi +8 -0
  36. data/rbi/prelude_sdk/models/notify_get_subscription_config_params.rbi +13 -5
  37. data/rbi/prelude_sdk/models/notify_get_subscription_phone_number_params.rbi +10 -2
  38. data/rbi/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbi +6 -0
  39. data/rbi/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbi +6 -0
  40. data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +88 -0
  41. data/rbi/prelude_sdk/models/notify_send_batch_response.rbi +80 -0
  42. data/rbi/prelude_sdk/models/notify_send_params.rbi +145 -0
  43. data/rbi/prelude_sdk/models/notify_send_response.rbi +75 -0
  44. data/rbi/prelude_sdk/models/transactional_send_params.rbi +83 -0
  45. data/rbi/prelude_sdk/models/verification_create_params.rbi +53 -93
  46. data/rbi/prelude_sdk/models/verification_create_response.rbi +178 -0
  47. data/rbi/prelude_sdk/models/verification_management_delete_phone_number_params.rbi +16 -1
  48. data/rbi/prelude_sdk/models/verification_management_list_phone_numbers_params.rbi +21 -4
  49. data/rbi/prelude_sdk/models/verification_management_set_phone_number_params.rbi +16 -1
  50. data/rbi/prelude_sdk/models/watch_predict_params.rbi +24 -16
  51. data/rbi/prelude_sdk/models/watch_predict_response.rbi +152 -3
  52. data/rbi/prelude_sdk/models/watch_send_events_params.rbi +4 -2
  53. data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +7 -245
  54. data/rbi/prelude_sdk/resources/lookup.rbi +2 -0
  55. data/rbi/prelude_sdk/resources/notify.rbi +36 -2
  56. data/rbi/prelude_sdk/resources/transactional.rbi +13 -0
  57. data/rbi/prelude_sdk/resources/verification.rbi +1 -0
  58. data/rbi/prelude_sdk/resources/verification_management.rbi +1 -0
  59. data/rbi/prelude_sdk/resources/watch.rbi +5 -2
  60. data/sig/prelude_sdk/internal/util.rbs +14 -0
  61. data/sig/prelude_sdk/models/lookup_lookup_params.rbs +8 -1
  62. data/sig/prelude_sdk/models/notify_get_subscription_config_params.rbs +11 -3
  63. data/sig/prelude_sdk/models/notify_get_subscription_phone_number_params.rbs +6 -1
  64. data/sig/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbs +10 -1
  65. data/sig/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbs +5 -0
  66. data/sig/prelude_sdk/models/notify_send_batch_params.rbs +25 -1
  67. data/sig/prelude_sdk/models/notify_send_batch_response.rbs +27 -0
  68. data/sig/prelude_sdk/models/notify_send_params.rbs +51 -1
  69. data/sig/prelude_sdk/models/notify_send_response.rbs +27 -0
  70. data/sig/prelude_sdk/models/transactional_send_params.rbs +23 -0
  71. data/sig/prelude_sdk/models/verification_create_params.rbs +2 -21
  72. data/sig/prelude_sdk/models/verification_create_response.rbs +40 -1
  73. data/sig/prelude_sdk/models/verification_management_delete_phone_number_params.rbs +9 -1
  74. data/sig/prelude_sdk/models/verification_management_list_phone_numbers_params.rbs +14 -3
  75. data/sig/prelude_sdk/models/verification_management_set_phone_number_params.rbs +9 -1
  76. data/sig/prelude_sdk/models/watch_predict_response.rbs +41 -3
  77. data/sig/prelude_sdk/models/watch_send_feedbacks_params.rbs +3 -110
  78. data/sig/prelude_sdk/resources/notify.rbs +4 -0
  79. data/sig/prelude_sdk/resources/transactional.rbs +1 -0
  80. metadata +16 -2
@@ -105,8 +105,9 @@ module PreludeSDK
105
105
  optional :app_version, String
106
106
 
107
107
  # @!attribute device_id
108
- # The unique identifier for the user's device. For Android, this corresponds to
109
- # the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
108
+ # A unique ID for the user's device. You should ensure that each user device has a
109
+ # unique `device_id` value. Ideally, for Android, this corresponds to the
110
+ # `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
110
111
  #
111
112
  # @return [String, nil]
112
113
  optional :device_id, String
@@ -124,23 +125,26 @@ module PreludeSDK
124
125
  optional :device_platform, enum: -> { PreludeSDK::WatchPredictParams::Signals::DevicePlatform }
125
126
 
126
127
  # @!attribute ip
127
- # The IP address of the user's device.
128
+ # The public IP v4 or v6 address of the end-user's device. You should collect this
129
+ # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
130
+ # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
131
+ # the actual public IP of the end-user's device.
128
132
  #
129
133
  # @return [String, nil]
130
134
  optional :ip, String
131
135
 
132
136
  # @!attribute is_trusted_user
133
- # This signal should provide a higher level of trust, indicating that the user is
134
- # genuine. Contact us to discuss your use case. For more details, refer to
137
+ # This signal should indicate a higher level of trust, explicitly stating that the
138
+ # user is genuine. Contact us to discuss your use case. For more details, refer to
135
139
  # [Signals](/verify/v2/documentation/prevent-fraud#signals).
136
140
  #
137
141
  # @return [Boolean, nil]
138
142
  optional :is_trusted_user, PreludeSDK::Internal::Type::Boolean
139
143
 
140
144
  # @!attribute ja4_fingerprint
141
- # The JA4 fingerprint observed for the connection. Prelude will infer it
142
- # automatically when requests go through our client SDK (which uses Prelude's
143
- # edge), but you can also provide it explicitly if you terminate TLS yourself.
145
+ # The JA4 fingerprint observed for the end-user's connection. Prelude will infer
146
+ # it automatically when you use our Frontend SDKs (which use Prelude's edge
147
+ # network), but you can also forward the value if you terminate TLS yourself.
144
148
  #
145
149
  # @return [String, nil]
146
150
  optional :ja4_fingerprint, String
@@ -168,17 +172,17 @@ module PreludeSDK
168
172
  #
169
173
  # @param app_version [String] The version of your application.
170
174
  #
171
- # @param device_id [String] The unique identifier for the user's device. For Android, this corresponds to th
175
+ # @param device_id [String] A unique ID for the user's device. You should ensure that each user device has a
172
176
  #
173
177
  # @param device_model [String] The model of the user's device.
174
178
  #
175
179
  # @param device_platform [Symbol, PreludeSDK::Models::WatchPredictParams::Signals::DevicePlatform] The type of the user's device.
176
180
  #
177
- # @param ip [String] The IP address of the user's device.
181
+ # @param ip [String] The public IP v4 or v6 address of the end-user's device. You should collect this
178
182
  #
179
- # @param is_trusted_user [Boolean] This signal should provide a higher level of trust, indicating that the user is
183
+ # @param is_trusted_user [Boolean] This signal should indicate a higher level of trust, explicitly stating that the
180
184
  #
181
- # @param ja4_fingerprint [String] The JA4 fingerprint observed for the connection. Prelude will infer it automatic
185
+ # @param ja4_fingerprint [String] The JA4 fingerprint observed for the end-user's connection. Prelude will infer i
182
186
  #
183
187
  # @param os_version [String] The version of the user's device operating system.
184
188
  #
@@ -23,7 +23,37 @@ module PreludeSDK
23
23
  # @return [String]
24
24
  required :request_id, String
25
25
 
26
- # @!method initialize(id:, prediction:, request_id:)
26
+ # @!attribute risk_factors
27
+ # The risk factors that contributed to the suspicious prediction. Only present
28
+ # when prediction is "suspicious" and the anti-fraud system detected specific risk
29
+ # signals.
30
+ #
31
+ # - `behavioral_pattern` - The phone number past behavior during verification
32
+ # flows exhibits suspicious patterns.
33
+ # - `device_attribute` - The device exhibits characteristics associated with
34
+ # suspicious activity patterns.
35
+ # - `fraud_database` - The phone number has been flagged as suspicious in one or
36
+ # more of our fraud databases.
37
+ # - `location_discrepancy` - The phone number prefix and IP address discrepancy
38
+ # indicates potential fraud.
39
+ # - `network_fingerprint` - The network connection exhibits characteristics
40
+ # associated with suspicious activity patterns.
41
+ # - `poor_conversion_history` - The phone number has a history of poorly
42
+ # converting to a verified phone number.
43
+ # - `prefix_concentration` - The phone number is part of a range known to be
44
+ # associated with suspicious activity patterns.
45
+ # - `suspected_request_tampering` - The SDK signature is invalid and the request
46
+ # is considered to be tampered with.
47
+ # - `suspicious_ip_address` - The IP address is deemed to be associated with
48
+ # suspicious activity patterns.
49
+ # - `temporary_phone_number` - The phone number is known to be a temporary or
50
+ # disposable number.
51
+ #
52
+ # @return [Array<Symbol, PreludeSDK::Models::WatchPredictResponse::RiskFactor>, nil]
53
+ optional :risk_factors,
54
+ -> { PreludeSDK::Internal::Type::ArrayOf[enum: PreludeSDK::Models::WatchPredictResponse::RiskFactor] }
55
+
56
+ # @!method initialize(id:, prediction:, request_id:, risk_factors: nil)
27
57
  # Some parameter documentations has been truncated, see
28
58
  # {PreludeSDK::Models::WatchPredictResponse} for more details.
29
59
  #
@@ -32,6 +62,8 @@ module PreludeSDK
32
62
  # @param prediction [Symbol, PreludeSDK::Models::WatchPredictResponse::Prediction] The prediction outcome.
33
63
  #
34
64
  # @param request_id [String] A string that identifies this specific request. Report it back to us to help us
65
+ #
66
+ # @param risk_factors [Array<Symbol, PreludeSDK::Models::WatchPredictResponse::RiskFactor>] The risk factors that contributed to the suspicious prediction. Only present whe
35
67
 
36
68
  # The prediction outcome.
37
69
  #
@@ -45,6 +77,24 @@ module PreludeSDK
45
77
  # @!method self.values
46
78
  # @return [Array<Symbol>]
47
79
  end
80
+
81
+ module RiskFactor
82
+ extend PreludeSDK::Internal::Type::Enum
83
+
84
+ BEHAVIORAL_PATTERN = :behavioral_pattern
85
+ DEVICE_ATTRIBUTE = :device_attribute
86
+ FRAUD_DATABASE = :fraud_database
87
+ LOCATION_DISCREPANCY = :location_discrepancy
88
+ NETWORK_FINGERPRINT = :network_fingerprint
89
+ POOR_CONVERSION_HISTORY = :poor_conversion_history
90
+ PREFIX_CONCENTRATION = :prefix_concentration
91
+ SUSPECTED_REQUEST_TAMPERING = :suspected_request_tampering
92
+ SUSPICIOUS_IP_ADDRESS = :suspicious_ip_address
93
+ TEMPORARY_PHONE_NUMBER = :temporary_phone_number
94
+
95
+ # @!method self.values
96
+ # @return [Array<Symbol>]
97
+ end
48
98
  end
49
99
  end
50
100
  end
@@ -8,13 +8,17 @@ module PreludeSDK
8
8
  include PreludeSDK::Internal::Type::RequestParameters
9
9
 
10
10
  # @!attribute events
11
- # A list of events to dispatch.
11
+ # A list of events to dispatch. A maximum of 100 events can be sent in a single
12
+ # request.
12
13
  #
13
14
  # @return [Array<PreludeSDK::Models::WatchSendEventsParams::Event>]
14
15
  required :events, -> { PreludeSDK::Internal::Type::ArrayOf[PreludeSDK::WatchSendEventsParams::Event] }
15
16
 
16
17
  # @!method initialize(events:, request_options: {})
17
- # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch.
18
+ # Some parameter documentations has been truncated, see
19
+ # {PreludeSDK::Models::WatchSendEventsParams} for more details.
20
+ #
21
+ # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch. A maximum of 100 events can be sent in a single re
18
22
  #
19
23
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
20
24
 
@@ -8,14 +8,18 @@ module PreludeSDK
8
8
  include PreludeSDK::Internal::Type::RequestParameters
9
9
 
10
10
  # @!attribute feedbacks
11
- # A list of feedbacks to send.
11
+ # A list of feedbacks to send. A maximum of 100 feedbacks can be sent in a single
12
+ # request.
12
13
  #
13
14
  # @return [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>]
14
15
  required :feedbacks,
15
16
  -> { PreludeSDK::Internal::Type::ArrayOf[PreludeSDK::WatchSendFeedbacksParams::Feedback] }
16
17
 
17
18
  # @!method initialize(feedbacks:, request_options: {})
18
- # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send.
19
+ # Some parameter documentations has been truncated, see
20
+ # {PreludeSDK::Models::WatchSendFeedbacksParams} for more details.
21
+ #
22
+ # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send. A maximum of 100 feedbacks can be sent in a single
19
23
  #
20
24
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
21
25
 
@@ -32,38 +36,18 @@ module PreludeSDK
32
36
  # @return [Symbol, PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Type]
33
37
  required :type, enum: -> { PreludeSDK::WatchSendFeedbacksParams::Feedback::Type }
34
38
 
35
- # @!attribute dispatch_id
36
- # The identifier of the dispatch that came from the front-end SDK.
37
- #
38
- # @return [String, nil]
39
- optional :dispatch_id, String
40
-
41
39
  # @!attribute metadata
42
40
  # The metadata for this feedback.
43
41
  #
44
42
  # @return [PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Metadata, nil]
45
43
  optional :metadata, -> { PreludeSDK::WatchSendFeedbacksParams::Feedback::Metadata }
46
44
 
47
- # @!attribute signals
48
- # The signals used for anti-fraud. For more details, refer to
49
- # [Signals](/verify/v2/documentation/prevent-fraud#signals).
50
- #
51
- # @return [PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals, nil]
52
- optional :signals, -> { PreludeSDK::WatchSendFeedbacksParams::Feedback::Signals }
53
-
54
- # @!method initialize(target:, type:, dispatch_id: nil, metadata: nil, signals: nil)
55
- # Some parameter documentations has been truncated, see
56
- # {PreludeSDK::Models::WatchSendFeedbacksParams::Feedback} for more details.
57
- #
45
+ # @!method initialize(target:, type:, metadata: nil)
58
46
  # @param target [PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Target] The feedback target. Only supports phone numbers for now.
59
47
  #
60
48
  # @param type [Symbol, PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Type] The type of feedback.
61
49
  #
62
- # @param dispatch_id [String] The identifier of the dispatch that came from the front-end SDK.
63
- #
64
50
  # @param metadata [PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Metadata] The metadata for this feedback.
65
- #
66
- # @param signals [PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals] The signals used for anti-fraud. For more details, refer to [Signals](/verify/v2
67
51
 
68
52
  # @see PreludeSDK::Models::WatchSendFeedbacksParams::Feedback#target
69
53
  class Target < PreludeSDK::Internal::Type::BaseModel
@@ -131,113 +115,6 @@ module PreludeSDK
131
115
  #
132
116
  # @param correlation_id [String] A user-defined identifier to correlate this feedback with. It is returned in the
133
117
  end
134
-
135
- # @see PreludeSDK::Models::WatchSendFeedbacksParams::Feedback#signals
136
- class Signals < PreludeSDK::Internal::Type::BaseModel
137
- # @!attribute app_version
138
- # The version of your application.
139
- #
140
- # @return [String, nil]
141
- optional :app_version, String
142
-
143
- # @!attribute device_id
144
- # The unique identifier for the user's device. For Android, this corresponds to
145
- # the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
146
- #
147
- # @return [String, nil]
148
- optional :device_id, String
149
-
150
- # @!attribute device_model
151
- # The model of the user's device.
152
- #
153
- # @return [String, nil]
154
- optional :device_model, String
155
-
156
- # @!attribute device_platform
157
- # The type of the user's device.
158
- #
159
- # @return [Symbol, PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals::DevicePlatform, nil]
160
- optional :device_platform,
161
- enum: -> { PreludeSDK::WatchSendFeedbacksParams::Feedback::Signals::DevicePlatform }
162
-
163
- # @!attribute ip
164
- # The IP address of the user's device.
165
- #
166
- # @return [String, nil]
167
- optional :ip, String
168
-
169
- # @!attribute is_trusted_user
170
- # This signal should provide a higher level of trust, indicating that the user is
171
- # genuine. Contact us to discuss your use case. For more details, refer to
172
- # [Signals](/verify/v2/documentation/prevent-fraud#signals).
173
- #
174
- # @return [Boolean, nil]
175
- optional :is_trusted_user, PreludeSDK::Internal::Type::Boolean
176
-
177
- # @!attribute ja4_fingerprint
178
- # The JA4 fingerprint observed for the connection. Prelude will infer it
179
- # automatically when requests go through our client SDK (which uses Prelude's
180
- # edge), but you can also provide it explicitly if you terminate TLS yourself.
181
- #
182
- # @return [String, nil]
183
- optional :ja4_fingerprint, String
184
-
185
- # @!attribute os_version
186
- # The version of the user's device operating system.
187
- #
188
- # @return [String, nil]
189
- optional :os_version, String
190
-
191
- # @!attribute user_agent
192
- # The user agent of the user's device. If the individual fields (os_version,
193
- # device_platform, device_model) are provided, we will prioritize those values
194
- # instead of parsing them from the user agent string.
195
- #
196
- # @return [String, nil]
197
- optional :user_agent, String
198
-
199
- # @!method initialize(app_version: nil, device_id: nil, device_model: nil, device_platform: nil, ip: nil, is_trusted_user: nil, ja4_fingerprint: nil, os_version: nil, user_agent: nil)
200
- # Some parameter documentations has been truncated, see
201
- # {PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals} for more
202
- # details.
203
- #
204
- # The signals used for anti-fraud. For more details, refer to
205
- # [Signals](/verify/v2/documentation/prevent-fraud#signals).
206
- #
207
- # @param app_version [String] The version of your application.
208
- #
209
- # @param device_id [String] The unique identifier for the user's device. For Android, this corresponds to th
210
- #
211
- # @param device_model [String] The model of the user's device.
212
- #
213
- # @param device_platform [Symbol, PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals::DevicePlatform] The type of the user's device.
214
- #
215
- # @param ip [String] The IP address of the user's device.
216
- #
217
- # @param is_trusted_user [Boolean] This signal should provide a higher level of trust, indicating that the user is
218
- #
219
- # @param ja4_fingerprint [String] The JA4 fingerprint observed for the connection. Prelude will infer it automatic
220
- #
221
- # @param os_version [String] The version of the user's device operating system.
222
- #
223
- # @param user_agent [String] The user agent of the user's device. If the individual fields (os_version, devic
224
-
225
- # The type of the user's device.
226
- #
227
- # @see PreludeSDK::Models::WatchSendFeedbacksParams::Feedback::Signals#device_platform
228
- module DevicePlatform
229
- extend PreludeSDK::Internal::Type::Enum
230
-
231
- ANDROID = :android
232
- IOS = :ios
233
- IPADOS = :ipados
234
- TVOS = :tvos
235
- WEB = :web
236
-
237
- # @!method self.values
238
- # @return [Array<Symbol>]
239
- end
240
- end
241
118
  end
242
119
  end
243
120
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Retrieve detailed information about a phone number including carrier data, line
6
+ # type, and portability status.
5
7
  class Lookup
6
8
  # Some parameter documentations has been truncated, see
7
9
  # {PreludeSDK::Models::LookupLookupParams} for more details.
@@ -22,10 +24,11 @@ module PreludeSDK
22
24
  # @see PreludeSDK::Models::LookupLookupParams
23
25
  def lookup(phone_number, params = {})
24
26
  parsed, options = PreludeSDK::LookupLookupParams.dump_request(params)
27
+ query = PreludeSDK::Internal::Util.encode_query_params(parsed)
25
28
  @client.request(
26
29
  method: :get,
27
30
  path: ["v2/lookup/%1$s", phone_number],
28
- query: parsed,
31
+ query: query,
29
32
  model: PreludeSDK::Models::LookupLookupResponse,
30
33
  options: options
31
34
  )
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Send transactional and marketing messages with compliance enforcement.
5
6
  class Notify
6
7
  # Retrieve a specific subscription management configuration by its ID.
7
8
  #
@@ -70,10 +71,11 @@ module PreludeSDK
70
71
  # @see PreludeSDK::Models::NotifyListSubscriptionConfigsParams
71
72
  def list_subscription_configs(params = {})
72
73
  parsed, options = PreludeSDK::NotifyListSubscriptionConfigsParams.dump_request(params)
74
+ query = PreludeSDK::Internal::Util.encode_query_params(parsed)
73
75
  @client.request(
74
76
  method: :get,
75
77
  path: "v2/notify/management/subscriptions",
76
- query: parsed,
78
+ query: query,
77
79
  model: PreludeSDK::Models::NotifyListSubscriptionConfigsResponse,
78
80
  options: options
79
81
  )
@@ -101,6 +103,7 @@ module PreludeSDK
101
103
  # @see PreludeSDK::Models::NotifyListSubscriptionPhoneNumberEventsParams
102
104
  def list_subscription_phone_number_events(phone_number, params)
103
105
  parsed, options = PreludeSDK::NotifyListSubscriptionPhoneNumberEventsParams.dump_request(params)
106
+ query = PreludeSDK::Internal::Util.encode_query_params(parsed)
104
107
  config_id =
105
108
  parsed.delete(:config_id) do
106
109
  raise ArgumentError.new("missing required path argument #{_1}")
@@ -112,7 +115,7 @@ module PreludeSDK
112
115
  config_id,
113
116
  phone_number
114
117
  ],
115
- query: parsed,
118
+ query: query,
116
119
  model: PreludeSDK::Models::NotifyListSubscriptionPhoneNumberEventsResponse,
117
120
  options: options
118
121
  )
@@ -140,10 +143,11 @@ module PreludeSDK
140
143
  # @see PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersParams
141
144
  def list_subscription_phone_numbers(config_id, params = {})
142
145
  parsed, options = PreludeSDK::NotifyListSubscriptionPhoneNumbersParams.dump_request(params)
146
+ query = PreludeSDK::Internal::Util.encode_query_params(parsed)
143
147
  @client.request(
144
148
  method: :get,
145
149
  path: ["v2/notify/management/subscriptions/%1$s/phone_numbers", config_id],
146
- query: parsed,
150
+ query: query,
147
151
  model: PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersResponse,
148
152
  options: options
149
153
  )
@@ -152,10 +156,10 @@ module PreludeSDK
152
156
  # Some parameter documentations has been truncated, see
153
157
  # {PreludeSDK::Models::NotifySendParams} for more details.
154
158
  #
155
- # Send transactional and marketing messages to your users via SMS and WhatsApp
156
- # with automatic compliance enforcement.
159
+ # Send transactional and marketing messages to your users via SMS, RCS and
160
+ # WhatsApp with automatic compliance enforcement.
157
161
  #
158
- # @overload send_(template_id:, to:, callback_url: nil, correlation_id: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {})
162
+ # @overload send_(template_id:, to:, callback_url: nil, context: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, text: nil, variables: nil, request_options: {})
159
163
  #
160
164
  # @param template_id [String] The template identifier configured by your Customer Success team.
161
165
  #
@@ -163,8 +167,12 @@ module PreludeSDK
163
167
  #
164
168
  # @param callback_url [String] The URL where webhooks will be sent for message delivery events.
165
169
  #
170
+ # @param context [PreludeSDK::Models::NotifySendParams::Context] Context for replying to an inbound message. When provided, the message is sent a
171
+ #
166
172
  # @param correlation_id [String] A user-defined identifier to correlate this message with your internal systems.
167
173
  #
174
+ # @param document [PreludeSDK::Models::NotifySendParams::Document] A media attachment to include in the message header. Supported on
175
+ #
168
176
  # @param expires_at [Time] The message expiration date in RFC3339 format. The message will not be sent if t
169
177
  #
170
178
  # @param from [String] The Sender ID. Must be approved for your account.
@@ -175,6 +183,8 @@ module PreludeSDK
175
183
  #
176
184
  # @param schedule_at [Time] Schedule the message for future delivery in RFC3339 format. Marketing messages c
177
185
  #
186
+ # @param text [String] The reply message body. Required when `context.reply_to` is provided. Used for 2
187
+ #
178
188
  # @param variables [Hash{Symbol=>String}] The variables to be replaced in the template.
179
189
  #
180
190
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -198,7 +208,7 @@ module PreludeSDK
198
208
  #
199
209
  # Send the same message to multiple recipients in a single request.
200
210
  #
201
- # @overload send_batch(template_id:, to:, callback_url: nil, correlation_id: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {})
211
+ # @overload send_batch(template_id:, to:, callback_url: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {})
202
212
  #
203
213
  # @param template_id [String] The template identifier configured by your Customer Success team.
204
214
  #
@@ -208,6 +218,8 @@ module PreludeSDK
208
218
  #
209
219
  # @param correlation_id [String] A user-defined identifier to correlate this request with your internal systems.
210
220
  #
221
+ # @param document [PreludeSDK::Models::NotifySendBatchParams::Document] A media attachment to include in the message header. Supported on
222
+ #
211
223
  # @param expires_at [Time] The message expiration date in RFC3339 format. Messages will not be sent after t
212
224
  #
213
225
  # @param from [String] The Sender ID. Must be approved for your account.
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Send transactional messages (deprecated - use Notify API instead).
5
6
  class Transactional
6
7
  # @deprecated
7
8
  #
@@ -11,7 +12,7 @@ module PreludeSDK
11
12
  # Legacy route maintained for backward compatibility. Migrate to `/v2/notify`
12
13
  # instead.
13
14
  #
14
- # @overload send_(template_id:, to:, callback_url: nil, correlation_id: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, variables: nil, request_options: {})
15
+ # @overload send_(template_id:, to:, callback_url: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, variables: nil, request_options: {})
15
16
  #
16
17
  # @param template_id [String] The template identifier.
17
18
  #
@@ -21,6 +22,8 @@ module PreludeSDK
21
22
  #
22
23
  # @param correlation_id [String] A user-defined identifier to correlate this transactional message with. It is re
23
24
  #
25
+ # @param document [PreludeSDK::Models::TransactionalSendParams::Document] A media attachment to include in the message header. Supported on
26
+ #
24
27
  # @param expires_at [String] The message expiration date.
25
28
  #
26
29
  # @param from [String] The Sender ID.
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Verify phone numbers.
5
6
  class Verification
6
7
  # Some parameter documentations has been truncated, see
7
8
  # {PreludeSDK::Models::VerificationCreateParams} for more details.
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Verify phone numbers.
5
6
  class VerificationManagement
6
7
  # Remove a phone number from the allow or block list.
7
8
  #
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PreludeSDK
4
4
  module Resources
5
+ # Evaluate email addresses and phone numbers for trustworthiness.
5
6
  class Watch
6
7
  # Some parameter documentations has been truncated, see
7
8
  # {PreludeSDK::Models::WatchPredictParams} for more details.
@@ -34,12 +35,15 @@ module PreludeSDK
34
35
  )
35
36
  end
36
37
 
38
+ # Some parameter documentations has been truncated, see
39
+ # {PreludeSDK::Models::WatchSendEventsParams} for more details.
40
+ #
37
41
  # Send real-time event data from end-user interactions within your application.
38
42
  # Events will be analyzed for proactive fraud prevention and risk scoring.
39
43
  #
40
44
  # @overload send_events(events:, request_options: {})
41
45
  #
42
- # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch.
46
+ # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch. A maximum of 100 events can be sent in a single re
43
47
  #
44
48
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
45
49
  #
@@ -57,12 +61,15 @@ module PreludeSDK
57
61
  )
58
62
  end
59
63
 
64
+ # Some parameter documentations has been truncated, see
65
+ # {PreludeSDK::Models::WatchSendFeedbacksParams} for more details.
66
+ #
60
67
  # Send feedback regarding your end-users verification funnel. Events will be
61
68
  # analyzed for proactive fraud prevention and risk scoring.
62
69
  #
63
70
  # @overload send_feedbacks(feedbacks:, request_options: {})
64
71
  #
65
- # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send.
72
+ # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send. A maximum of 100 feedbacks can be sent in a single
66
73
  #
67
74
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
68
75
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PreludeSDK
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -14,21 +14,28 @@ module PreludeSDK
14
14
  sig { returns(String) }
15
15
  attr_reader :api_token
16
16
 
17
+ # Retrieve detailed information about a phone number including carrier data, line
18
+ # type, and portability status.
17
19
  sig { returns(PreludeSDK::Resources::Lookup) }
18
20
  attr_reader :lookup
19
21
 
22
+ # Send transactional and marketing messages with compliance enforcement.
20
23
  sig { returns(PreludeSDK::Resources::Notify) }
21
24
  attr_reader :notify
22
25
 
26
+ # Send transactional messages (deprecated - use Notify API instead).
23
27
  sig { returns(PreludeSDK::Resources::Transactional) }
24
28
  attr_reader :transactional
25
29
 
30
+ # Verify phone numbers.
26
31
  sig { returns(PreludeSDK::Resources::Verification) }
27
32
  attr_reader :verification
28
33
 
34
+ # Verify phone numbers.
29
35
  sig { returns(PreludeSDK::Resources::VerificationManagement) }
30
36
  attr_reader :verification_management
31
37
 
38
+ # Evaluate email addresses and phone numbers for trustworthiness.
32
39
  sig { returns(PreludeSDK::Resources::Watch) }
33
40
  attr_reader :watch
34
41
 
@@ -148,12 +148,20 @@ module PreludeSDK
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -296,11 +304,31 @@ module PreludeSDK
296
304
  end
297
305
 
298
306
  JSON_CONTENT =
299
- T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp)
307
+ T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp)
300
308
  JSONL_CONTENT =
301
309
  T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
302
310
 
303
311
  class << self
312
+ # @api private
313
+ sig do
314
+ params(query: PreludeSDK::Internal::AnyHash).returns(
315
+ PreludeSDK::Internal::AnyHash
316
+ )
317
+ end
318
+ def encode_query_params(query)
319
+ end
320
+
321
+ # @api private
322
+ sig do
323
+ params(
324
+ collection: PreludeSDK::Internal::AnyHash,
325
+ key: String,
326
+ element: T.anything
327
+ ).void
328
+ end
329
+ private def write_query_param_element!(collection, key, element)
330
+ end
331
+
304
332
  # @api private
305
333
  sig do
306
334
  params(