prelude-sdk 0.1.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -0
- data/README.md +9 -9
- data/lib/prelude_sdk/client.rb +11 -0
- data/lib/prelude_sdk/internal/transport/pooled_net_requester.rb +13 -11
- data/lib/prelude_sdk/internal/util.rb +39 -3
- data/lib/prelude_sdk/models/lookup_lookup_params.rb +9 -1
- data/lib/prelude_sdk/models/notify_get_subscription_config_params.rb +20 -0
- data/lib/prelude_sdk/models/notify_get_subscription_config_response.rb +120 -0
- data/lib/prelude_sdk/models/notify_get_subscription_phone_number_params.rb +26 -0
- data/lib/prelude_sdk/models/notify_get_subscription_phone_number_response.rb +104 -0
- data/lib/prelude_sdk/models/notify_list_subscription_configs_params.rb +30 -0
- data/lib/prelude_sdk/models/notify_list_subscription_configs_response.rb +144 -0
- data/lib/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rb +44 -0
- data/lib/prelude_sdk/models/notify_list_subscription_phone_number_events_response.rb +132 -0
- data/lib/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rb +56 -0
- data/lib/prelude_sdk/models/notify_list_subscription_phone_numbers_response.rb +132 -0
- data/lib/prelude_sdk/models/notify_send_batch_params.rb +141 -0
- data/lib/prelude_sdk/models/notify_send_batch_response.rb +239 -0
- data/lib/prelude_sdk/models/notify_send_params.rb +149 -0
- data/lib/prelude_sdk/models/notify_send_response.rb +129 -0
- data/lib/prelude_sdk/models/transactional_send_params.rb +32 -1
- data/lib/prelude_sdk/models/verification_create_params.rb +35 -48
- data/lib/prelude_sdk/models/verification_create_response.rb +15 -0
- data/lib/prelude_sdk/models/verification_management_delete_phone_number_params.rb +8 -1
- data/lib/prelude_sdk/models/verification_management_list_phone_numbers_params.rb +7 -1
- data/lib/prelude_sdk/models/verification_management_set_phone_number_params.rb +8 -1
- data/lib/prelude_sdk/models/watch_predict_params.rb +16 -12
- data/lib/prelude_sdk/models/watch_predict_response.rb +51 -1
- data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +1 -128
- data/lib/prelude_sdk/models.rb +15 -0
- data/lib/prelude_sdk/resources/lookup.rb +4 -1
- data/lib/prelude_sdk/resources/notify.rb +255 -0
- data/lib/prelude_sdk/resources/transactional.rb +4 -1
- data/lib/prelude_sdk/resources/verification.rb +1 -0
- data/lib/prelude_sdk/resources/verification_management.rb +1 -0
- data/lib/prelude_sdk/resources/watch.rb +1 -0
- data/lib/prelude_sdk/version.rb +1 -1
- data/lib/prelude_sdk.rb +16 -0
- data/manifest.yaml +1 -0
- data/rbi/prelude_sdk/client.rbi +10 -0
- data/rbi/prelude_sdk/internal/util.rbi +21 -1
- data/rbi/prelude_sdk/models/lookup_lookup_params.rbi +8 -0
- data/rbi/prelude_sdk/models/notify_get_subscription_config_params.rbi +38 -0
- data/rbi/prelude_sdk/models/notify_get_subscription_config_response.rbi +224 -0
- data/rbi/prelude_sdk/models/notify_get_subscription_phone_number_params.rbi +46 -0
- data/rbi/prelude_sdk/models/notify_get_subscription_phone_number_response.rbi +199 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_configs_params.rbi +60 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_configs_response.rbi +286 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbi +72 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_number_events_response.rbi +259 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbi +125 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_numbers_response.rbi +259 -0
- data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +241 -0
- data/rbi/prelude_sdk/models/notify_send_batch_response.rbi +440 -0
- data/rbi/prelude_sdk/models/notify_send_params.rbi +249 -0
- data/rbi/prelude_sdk/models/notify_send_response.rbi +203 -0
- data/rbi/prelude_sdk/models/transactional_send_params.rbi +50 -0
- data/rbi/prelude_sdk/models/verification_create_params.rbi +53 -93
- data/rbi/prelude_sdk/models/verification_create_response.rbi +26 -0
- data/rbi/prelude_sdk/models/verification_management_delete_phone_number_params.rbi +16 -1
- data/rbi/prelude_sdk/models/verification_management_list_phone_numbers_params.rbi +21 -4
- data/rbi/prelude_sdk/models/verification_management_set_phone_number_params.rbi +16 -1
- data/rbi/prelude_sdk/models/watch_predict_params.rbi +24 -16
- data/rbi/prelude_sdk/models/watch_predict_response.rbi +152 -3
- data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +3 -243
- data/rbi/prelude_sdk/models.rbi +19 -0
- data/rbi/prelude_sdk/resources/lookup.rbi +2 -0
- data/rbi/prelude_sdk/resources/notify.rbi +227 -0
- data/rbi/prelude_sdk/resources/transactional.rbi +5 -0
- data/rbi/prelude_sdk/resources/verification.rbi +1 -0
- data/rbi/prelude_sdk/resources/verification_management.rbi +1 -0
- data/rbi/prelude_sdk/resources/watch.rbi +1 -0
- data/sig/prelude_sdk/client.rbs +2 -0
- data/sig/prelude_sdk/internal/util.rbs +10 -0
- data/sig/prelude_sdk/models/lookup_lookup_params.rbs +8 -1
- data/sig/prelude_sdk/models/notify_get_subscription_config_params.rbs +23 -0
- data/sig/prelude_sdk/models/notify_get_subscription_config_response.rbs +95 -0
- data/sig/prelude_sdk/models/notify_get_subscription_phone_number_params.rbs +28 -0
- data/sig/prelude_sdk/models/notify_get_subscription_phone_number_response.rbs +71 -0
- data/sig/prelude_sdk/models/notify_list_subscription_configs_params.rbs +32 -0
- data/sig/prelude_sdk/models/notify_list_subscription_configs_response.rbs +119 -0
- data/sig/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbs +45 -0
- data/sig/prelude_sdk/models/notify_list_subscription_phone_number_events_response.rbs +95 -0
- data/sig/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbs +60 -0
- data/sig/prelude_sdk/models/notify_list_subscription_phone_numbers_response.rbs +95 -0
- data/sig/prelude_sdk/models/notify_send_batch_params.rbs +121 -0
- data/sig/prelude_sdk/models/notify_send_batch_response.rbs +214 -0
- data/sig/prelude_sdk/models/notify_send_params.rbs +121 -0
- data/sig/prelude_sdk/models/notify_send_response.rbs +100 -0
- data/sig/prelude_sdk/models/transactional_send_params.rbs +21 -0
- data/sig/prelude_sdk/models/verification_create_params.rbs +2 -21
- data/sig/prelude_sdk/models/verification_create_response.rbs +2 -1
- data/sig/prelude_sdk/models/verification_management_delete_phone_number_params.rbs +9 -1
- data/sig/prelude_sdk/models/verification_management_list_phone_numbers_params.rbs +14 -3
- data/sig/prelude_sdk/models/verification_management_set_phone_number_params.rbs +9 -1
- data/sig/prelude_sdk/models/watch_predict_response.rbs +41 -3
- data/sig/prelude_sdk/models/watch_send_feedbacks_params.rbs +3 -110
- data/sig/prelude_sdk/models.rbs +14 -0
- data/sig/prelude_sdk/resources/notify.rbs +70 -0
- data/sig/prelude_sdk/resources/transactional.rbs +1 -0
- metadata +61 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0442af375a6b077b348b680c39f073a48a66ff185d57f5f20ee53300531a8bf7
|
|
4
|
+
data.tar.gz: 60d8b444c65e5e55b487f61d158c9531fcb02435c66a1f9eaa3688640789d08f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c337ee4e3c9f6d13391ae942cda76beaef0ff292b14b5416f66450005908bfe09d250fad09444635eaabf1fb3e02eb3ad8d356740218a0a7188729487c65639
|
|
7
|
+
data.tar.gz: cb6ae9f844d4a6d5313e001802b40b0624e93da2cfdbbefaec0cfa68f2cd14f74a0397dd8ac51d338f52b24c478f350d19d9eb77a8cf4d17d12e9fe7778ffcea
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2026-03-23)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/prelude-so/ruby-sdk/compare/v0.2.0...v0.3.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([24553b3](https://github.com/prelude-so/ruby-sdk/commit/24553b346bf3e424aa565b58dfc0a5ff339d0ffd))
|
|
10
|
+
* **api:** api update ([c8e488b](https://github.com/prelude-so/ruby-sdk/commit/c8e488bc5106f22fd3c3e1e996aa865bf51ff3a1))
|
|
11
|
+
* **api:** api update ([bc9d8d4](https://github.com/prelude-so/ruby-sdk/commit/bc9d8d41c941879192c531c1b5f07d619d4bfc7b))
|
|
12
|
+
* **api:** api update ([1e8ea21](https://github.com/prelude-so/ruby-sdk/commit/1e8ea213c96c039d76722d6bc522e84e0ff0278f))
|
|
13
|
+
* **api:** api update ([c339306](https://github.com/prelude-so/ruby-sdk/commit/c3393069dc67ed5ecaecb276b26c2308a00356d1))
|
|
14
|
+
* **api:** api update ([ec6ca20](https://github.com/prelude-so/ruby-sdk/commit/ec6ca2085c7628b495b9486bd46c27656432e9eb))
|
|
15
|
+
* **api:** api update ([64ca50e](https://github.com/prelude-so/ruby-sdk/commit/64ca50eae743d655d253c2ab6564eade851b60be))
|
|
16
|
+
* **api:** api update ([240811f](https://github.com/prelude-so/ruby-sdk/commit/240811ffbc8caabaad46ce164bdb9ac3c6cbf9b0))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* calling `break` out of streams should be instantaneous ([a880e79](https://github.com/prelude-so/ruby-sdk/commit/a880e79694d57969c34395666edbd365d5a65483))
|
|
22
|
+
* **client:** add types for path params, and update structure of unions nested in params ([dff25fc](https://github.com/prelude-so/ruby-sdk/commit/dff25fc4134005a9e8a7f84d8fc6fbd5f9ac8098))
|
|
23
|
+
* **client:** always add content-length to post body, even when empty ([73b8b98](https://github.com/prelude-so/ruby-sdk/commit/73b8b98d2f14602fb5b297a697d3894699659b84))
|
|
24
|
+
* **client:** loosen json header parsing ([144e10b](https://github.com/prelude-so/ruby-sdk/commit/144e10bb50679a7748df724edf574a86fc8fbc9e))
|
|
25
|
+
* **client:** serialize query parameters properly ([e59d46e](https://github.com/prelude-so/ruby-sdk/commit/e59d46eaa39b1033807c4c000cfb4220b1c8d0ff))
|
|
26
|
+
* issue where json.parse errors when receiving HTTP 204 with nobody ([5960180](https://github.com/prelude-so/ruby-sdk/commit/59601805484363ad564d640ae2dec6a2eff08f26))
|
|
27
|
+
* properly mock time in ruby ci tests ([19a7259](https://github.com/prelude-so/ruby-sdk/commit/19a7259d6c21e24e6773487981154c17215846f0))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Chores
|
|
31
|
+
|
|
32
|
+
* **ci:** add build step ([9517e54](https://github.com/prelude-so/ruby-sdk/commit/9517e54b4ad0cf6bfeefdb9c227217f5f732cf27))
|
|
33
|
+
* **ci:** skip uploading artifacts on stainless-internal branches ([b239f23](https://github.com/prelude-so/ruby-sdk/commit/b239f237e3b67cc6a01f992028fc5885336f6538))
|
|
34
|
+
* **docs:** add missing descriptions ([874587d](https://github.com/prelude-so/ruby-sdk/commit/874587d45083a9a5e0fc188b378a9b8d58dd39a5))
|
|
35
|
+
* **docs:** remove www prefix ([9c41466](https://github.com/prelude-so/ruby-sdk/commit/9c41466d86710318107d52692f8efb93515e9738))
|
|
36
|
+
* **internal:** codegen related update ([4721c32](https://github.com/prelude-so/ruby-sdk/commit/4721c32fbc82220da55e561f4ad10ac22223108b))
|
|
37
|
+
* **internal:** codegen related update ([d227583](https://github.com/prelude-so/ruby-sdk/commit/d227583e5a4a92a1cbc4bd75ed70b18df8a2f0ff))
|
|
38
|
+
* **internal:** tweak CI branches ([1a3bb89](https://github.com/prelude-so/ruby-sdk/commit/1a3bb8905066138aec8da0bba42d3f699da7144f))
|
|
39
|
+
* **internal:** update `actions/checkout` version ([dd49de2](https://github.com/prelude-so/ruby-sdk/commit/dd49de2c037b0f622d7cdead21ab464a1455363f))
|
|
40
|
+
* **internal:** update gitignore ([603a4c6](https://github.com/prelude-so/ruby-sdk/commit/603a4c69350448463dae3f8d99d6aa09d0c48b1b))
|
|
41
|
+
* **test:** do not count install time for mock server timeout ([77b5e70](https://github.com/prelude-so/ruby-sdk/commit/77b5e70ec2a773c70e55ca4cb3e527e8d2446459))
|
|
42
|
+
* **tests:** bump steady to v0.19.4 ([001f050](https://github.com/prelude-so/ruby-sdk/commit/001f050d338b3015dba4527bc278795fadb04ac2))
|
|
43
|
+
* **tests:** bump steady to v0.19.5 ([e824cb0](https://github.com/prelude-so/ruby-sdk/commit/e824cb0c8e2f3f601a4e07f7c36afeafcfff9b28))
|
|
44
|
+
* update mock server docs ([6fa353c](https://github.com/prelude-so/ruby-sdk/commit/6fa353cd9d0112786119b6a50d96fc48c77253c3))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Refactors
|
|
48
|
+
|
|
49
|
+
* **tests:** switch from prism to steady ([4f1499f](https://github.com/prelude-so/ruby-sdk/commit/4f1499f85472caac00731960ba4a9623131c57f6))
|
|
50
|
+
|
|
51
|
+
## 0.2.0 (2025-12-05)
|
|
52
|
+
|
|
53
|
+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/prelude-so/ruby-sdk/compare/v0.1.0...v0.2.0)
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* **api:** add Notify API methods ([8ce7793](https://github.com/prelude-so/ruby-sdk/commit/8ce7793912b2b074deaa66c32e4cc2b7d0873623))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Chores
|
|
61
|
+
|
|
62
|
+
* explicitly require "base64" gem ([ce6be23](https://github.com/prelude-so/ruby-sdk/commit/ce6be23941786dfe0ed1356b31eb65014da48407))
|
|
63
|
+
|
|
3
64
|
## 0.1.0 (2025-11-17)
|
|
4
65
|
|
|
5
66
|
Full Changelog: [v0.1.0-alpha.3...v0.1.0](https://github.com/prelude-so/ruby-sdk/compare/v0.1.0-alpha.3...v0.1.0)
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
17
17
|
<!-- x-release-please-start-version -->
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "prelude-sdk", "~> 0.
|
|
20
|
+
gem "prelude-sdk", "~> 0.3.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
|
@@ -207,25 +207,25 @@ prelude.verification.create(**params)
|
|
|
207
207
|
Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
|
|
208
208
|
|
|
209
209
|
```ruby
|
|
210
|
-
# :
|
|
211
|
-
puts(PreludeSDK::
|
|
210
|
+
# :SUB
|
|
211
|
+
puts(PreludeSDK::NotifyListSubscriptionPhoneNumbersParams::State::SUB)
|
|
212
212
|
|
|
213
|
-
# Revealed type: `T.all(PreludeSDK::
|
|
214
|
-
T.reveal_type(PreludeSDK::
|
|
213
|
+
# Revealed type: `T.all(PreludeSDK::NotifyListSubscriptionPhoneNumbersParams::State, Symbol)`
|
|
214
|
+
T.reveal_type(PreludeSDK::NotifyListSubscriptionPhoneNumbersParams::State::SUB)
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
|
|
218
218
|
|
|
219
219
|
```ruby
|
|
220
220
|
# Using the enum constants preserves the tagged type information:
|
|
221
|
-
prelude.
|
|
222
|
-
|
|
221
|
+
prelude.notify.list_subscription_phone_numbers(
|
|
222
|
+
state: PreludeSDK::NotifyListSubscriptionPhoneNumbersParams::State::SUB,
|
|
223
223
|
# …
|
|
224
224
|
)
|
|
225
225
|
|
|
226
226
|
# Literal values are also permissible:
|
|
227
|
-
prelude.
|
|
228
|
-
|
|
227
|
+
prelude.notify.list_subscription_phone_numbers(
|
|
228
|
+
state: :SUB,
|
|
229
229
|
# …
|
|
230
230
|
)
|
|
231
231
|
```
|
data/lib/prelude_sdk/client.rb
CHANGED
|
@@ -19,18 +19,28 @@ module PreludeSDK
|
|
|
19
19
|
# @return [String]
|
|
20
20
|
attr_reader :api_token
|
|
21
21
|
|
|
22
|
+
# Retrieve detailed information about a phone number including carrier data, line
|
|
23
|
+
# type, and portability status.
|
|
22
24
|
# @return [PreludeSDK::Resources::Lookup]
|
|
23
25
|
attr_reader :lookup
|
|
24
26
|
|
|
27
|
+
# Send transactional and marketing messages with compliance enforcement.
|
|
28
|
+
# @return [PreludeSDK::Resources::Notify]
|
|
29
|
+
attr_reader :notify
|
|
30
|
+
|
|
31
|
+
# Send transactional messages (deprecated - use Notify API instead).
|
|
25
32
|
# @return [PreludeSDK::Resources::Transactional]
|
|
26
33
|
attr_reader :transactional
|
|
27
34
|
|
|
35
|
+
# Verify phone numbers.
|
|
28
36
|
# @return [PreludeSDK::Resources::Verification]
|
|
29
37
|
attr_reader :verification
|
|
30
38
|
|
|
39
|
+
# Verify phone numbers.
|
|
31
40
|
# @return [PreludeSDK::Resources::VerificationManagement]
|
|
32
41
|
attr_reader :verification_management
|
|
33
42
|
|
|
43
|
+
# Evaluate email addresses and phone numbers for trustworthiness.
|
|
34
44
|
# @return [PreludeSDK::Resources::Watch]
|
|
35
45
|
attr_reader :watch
|
|
36
46
|
|
|
@@ -82,6 +92,7 @@ module PreludeSDK
|
|
|
82
92
|
)
|
|
83
93
|
|
|
84
94
|
@lookup = PreludeSDK::Resources::Lookup.new(client: self)
|
|
95
|
+
@notify = PreludeSDK::Resources::Notify.new(client: self)
|
|
85
96
|
@transactional = PreludeSDK::Resources::Transactional.new(client: self)
|
|
86
97
|
@verification = PreludeSDK::Resources::Verification.new(client: self)
|
|
87
98
|
@verification_management = PreludeSDK::Resources::VerificationManagement.new(client: self)
|
|
@@ -75,7 +75,7 @@ module PreludeSDK
|
|
|
75
75
|
|
|
76
76
|
case body
|
|
77
77
|
in nil
|
|
78
|
-
|
|
78
|
+
req["content-length"] ||= 0 unless req["transfer-encoding"]
|
|
79
79
|
in String
|
|
80
80
|
req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
|
|
81
81
|
req.body_stream = PreludeSDK::Internal::Util::ReadIOAdapter.new(body, &blk)
|
|
@@ -153,17 +153,19 @@ module PreludeSDK
|
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
::Kernel.catch(:jump) do
|
|
157
|
+
conn.request(req) do |rsp|
|
|
158
|
+
y << [req, rsp]
|
|
159
|
+
::Kernel.throw(:jump) if finished
|
|
160
|
+
|
|
161
|
+
rsp.read_body do |bytes|
|
|
162
|
+
y << bytes.force_encoding(Encoding::BINARY)
|
|
163
|
+
::Kernel.throw(:jump) if finished
|
|
164
|
+
|
|
165
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
166
|
+
end
|
|
167
|
+
eof = true
|
|
165
168
|
end
|
|
166
|
-
eof = true
|
|
167
169
|
end
|
|
168
170
|
end
|
|
169
171
|
ensure
|
|
@@ -485,11 +485,42 @@ module PreludeSDK
|
|
|
485
485
|
end
|
|
486
486
|
|
|
487
487
|
# @type [Regexp]
|
|
488
|
-
JSON_CONTENT = %r{^application/(?:
|
|
488
|
+
JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
|
|
489
489
|
# @type [Regexp]
|
|
490
490
|
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
|
491
491
|
|
|
492
492
|
class << self
|
|
493
|
+
# @api private
|
|
494
|
+
#
|
|
495
|
+
# @param query [Hash{Symbol=>Object}]
|
|
496
|
+
#
|
|
497
|
+
# @return [Hash{Symbol=>Object}]
|
|
498
|
+
def encode_query_params(query)
|
|
499
|
+
out = {}
|
|
500
|
+
query.each { write_query_param_element!(out, _1, _2) }
|
|
501
|
+
out
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
# @api private
|
|
505
|
+
#
|
|
506
|
+
# @param collection [Hash{Symbol=>Object}]
|
|
507
|
+
# @param key [String]
|
|
508
|
+
# @param element [Object]
|
|
509
|
+
#
|
|
510
|
+
# @return [nil]
|
|
511
|
+
private def write_query_param_element!(collection, key, element)
|
|
512
|
+
case element
|
|
513
|
+
in Hash
|
|
514
|
+
element.each do |name, value|
|
|
515
|
+
write_query_param_element!(collection, "#{key}[#{name}]", value)
|
|
516
|
+
end
|
|
517
|
+
in Array
|
|
518
|
+
collection[key] = element.map(&:to_s).join(",")
|
|
519
|
+
else
|
|
520
|
+
collection[key] = element.to_s
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
493
524
|
# @api private
|
|
494
525
|
#
|
|
495
526
|
# @param y [Enumerator::Yielder]
|
|
@@ -657,7 +688,8 @@ module PreludeSDK
|
|
|
657
688
|
def decode_content(headers, stream:, suppress_error: false)
|
|
658
689
|
case (content_type = headers["content-type"])
|
|
659
690
|
in PreludeSDK::Internal::Util::JSON_CONTENT
|
|
660
|
-
json = stream.to_a.join
|
|
691
|
+
return nil if (json = stream.to_a.join).empty?
|
|
692
|
+
|
|
661
693
|
begin
|
|
662
694
|
JSON.parse(json, symbolize_names: true)
|
|
663
695
|
rescue JSON::ParserError => e
|
|
@@ -667,7 +699,11 @@ module PreludeSDK
|
|
|
667
699
|
in PreludeSDK::Internal::Util::JSONL_CONTENT
|
|
668
700
|
lines = decode_lines(stream)
|
|
669
701
|
chain_fused(lines) do |y|
|
|
670
|
-
lines.each
|
|
702
|
+
lines.each do
|
|
703
|
+
next if _1.empty?
|
|
704
|
+
|
|
705
|
+
y << JSON.parse(_1, symbolize_names: true)
|
|
706
|
+
end
|
|
671
707
|
end
|
|
672
708
|
in %r{^text/event-stream}
|
|
673
709
|
lines = decode_lines(stream)
|
|
@@ -7,6 +7,12 @@ module PreludeSDK
|
|
|
7
7
|
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute phone_number
|
|
11
|
+
# An E.164 formatted phone number to look up.
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :phone_number, String
|
|
15
|
+
|
|
10
16
|
# @!attribute type
|
|
11
17
|
# Optional features. Possible values are:
|
|
12
18
|
#
|
|
@@ -16,10 +22,12 @@ module PreludeSDK
|
|
|
16
22
|
# @return [Array<Symbol, PreludeSDK::Models::LookupLookupParams::Type>, nil]
|
|
17
23
|
optional :type, -> { PreludeSDK::Internal::Type::ArrayOf[enum: PreludeSDK::LookupLookupParams::Type] }
|
|
18
24
|
|
|
19
|
-
# @!method initialize(type: nil, request_options: {})
|
|
25
|
+
# @!method initialize(phone_number:, type: nil, request_options: {})
|
|
20
26
|
# Some parameter documentations has been truncated, see
|
|
21
27
|
# {PreludeSDK::Models::LookupLookupParams} for more details.
|
|
22
28
|
#
|
|
29
|
+
# @param phone_number [String] An E.164 formatted phone number to look up.
|
|
30
|
+
#
|
|
23
31
|
# @param type [Array<Symbol, PreludeSDK::Models::LookupLookupParams::Type>] Optional features. Possible values are:
|
|
24
32
|
#
|
|
25
33
|
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PreludeSDK
|
|
4
|
+
module Models
|
|
5
|
+
# @see PreludeSDK::Resources::Notify#get_subscription_config
|
|
6
|
+
class NotifyGetSubscriptionConfigParams < PreludeSDK::Internal::Type::BaseModel
|
|
7
|
+
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute config_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :config_id, String
|
|
14
|
+
|
|
15
|
+
# @!method initialize(config_id:, request_options: {})
|
|
16
|
+
# @param config_id [String]
|
|
17
|
+
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PreludeSDK
|
|
4
|
+
module Models
|
|
5
|
+
# @see PreludeSDK::Resources::Notify#get_subscription_config
|
|
6
|
+
class NotifyGetSubscriptionConfigResponse < PreludeSDK::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# The subscription configuration ID.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute callback_url
|
|
14
|
+
# The URL to call when subscription status changes.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :callback_url, String
|
|
18
|
+
|
|
19
|
+
# @!attribute created_at
|
|
20
|
+
# The date and time when the configuration was created.
|
|
21
|
+
#
|
|
22
|
+
# @return [Time]
|
|
23
|
+
required :created_at, Time
|
|
24
|
+
|
|
25
|
+
# @!attribute messages
|
|
26
|
+
# The subscription messages configuration.
|
|
27
|
+
#
|
|
28
|
+
# @return [PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::Messages]
|
|
29
|
+
required :messages, -> { PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::Messages }
|
|
30
|
+
|
|
31
|
+
# @!attribute name
|
|
32
|
+
# The human-readable name for the subscription configuration.
|
|
33
|
+
#
|
|
34
|
+
# @return [String]
|
|
35
|
+
required :name, String
|
|
36
|
+
|
|
37
|
+
# @!attribute updated_at
|
|
38
|
+
# The date and time when the configuration was last updated.
|
|
39
|
+
#
|
|
40
|
+
# @return [Time]
|
|
41
|
+
required :updated_at, Time
|
|
42
|
+
|
|
43
|
+
# @!attribute mo_phone_numbers
|
|
44
|
+
# A list of phone numbers for receiving inbound messages.
|
|
45
|
+
#
|
|
46
|
+
# @return [Array<PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::MoPhoneNumber>, nil]
|
|
47
|
+
optional :mo_phone_numbers,
|
|
48
|
+
-> { PreludeSDK::Internal::Type::ArrayOf[PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::MoPhoneNumber] }
|
|
49
|
+
|
|
50
|
+
# @!method initialize(id:, callback_url:, created_at:, messages:, name:, updated_at:, mo_phone_numbers: nil)
|
|
51
|
+
# @param id [String] The subscription configuration ID.
|
|
52
|
+
#
|
|
53
|
+
# @param callback_url [String] The URL to call when subscription status changes.
|
|
54
|
+
#
|
|
55
|
+
# @param created_at [Time] The date and time when the configuration was created.
|
|
56
|
+
#
|
|
57
|
+
# @param messages [PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::Messages] The subscription messages configuration.
|
|
58
|
+
#
|
|
59
|
+
# @param name [String] The human-readable name for the subscription configuration.
|
|
60
|
+
#
|
|
61
|
+
# @param updated_at [Time] The date and time when the configuration was last updated.
|
|
62
|
+
#
|
|
63
|
+
# @param mo_phone_numbers [Array<PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::MoPhoneNumber>] A list of phone numbers for receiving inbound messages.
|
|
64
|
+
|
|
65
|
+
# @see PreludeSDK::Models::NotifyGetSubscriptionConfigResponse#messages
|
|
66
|
+
class Messages < PreludeSDK::Internal::Type::BaseModel
|
|
67
|
+
# @!attribute help_message
|
|
68
|
+
# Message sent when user requests help.
|
|
69
|
+
#
|
|
70
|
+
# @return [String, nil]
|
|
71
|
+
optional :help_message, String
|
|
72
|
+
|
|
73
|
+
# @!attribute start_message
|
|
74
|
+
# Message sent when user subscribes.
|
|
75
|
+
#
|
|
76
|
+
# @return [String, nil]
|
|
77
|
+
optional :start_message, String
|
|
78
|
+
|
|
79
|
+
# @!attribute stop_message
|
|
80
|
+
# Message sent when user unsubscribes.
|
|
81
|
+
#
|
|
82
|
+
# @return [String, nil]
|
|
83
|
+
optional :stop_message, String
|
|
84
|
+
|
|
85
|
+
# @!method initialize(help_message: nil, start_message: nil, stop_message: nil)
|
|
86
|
+
# The subscription messages configuration.
|
|
87
|
+
#
|
|
88
|
+
# @param help_message [String] Message sent when user requests help.
|
|
89
|
+
#
|
|
90
|
+
# @param start_message [String] Message sent when user subscribes.
|
|
91
|
+
#
|
|
92
|
+
# @param stop_message [String] Message sent when user unsubscribes.
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class MoPhoneNumber < PreludeSDK::Internal::Type::BaseModel
|
|
96
|
+
# @!attribute country_code
|
|
97
|
+
# The ISO 3166-1 alpha-2 country code.
|
|
98
|
+
#
|
|
99
|
+
# @return [String]
|
|
100
|
+
required :country_code, String
|
|
101
|
+
|
|
102
|
+
# @!attribute phone_number
|
|
103
|
+
# The phone number in E.164 format for long codes, or short code format for short
|
|
104
|
+
# codes.
|
|
105
|
+
#
|
|
106
|
+
# @return [String]
|
|
107
|
+
required :phone_number, String
|
|
108
|
+
|
|
109
|
+
# @!method initialize(country_code:, phone_number:)
|
|
110
|
+
# Some parameter documentations has been truncated, see
|
|
111
|
+
# {PreludeSDK::Models::NotifyGetSubscriptionConfigResponse::MoPhoneNumber} for
|
|
112
|
+
# more details.
|
|
113
|
+
#
|
|
114
|
+
# @param country_code [String] The ISO 3166-1 alpha-2 country code.
|
|
115
|
+
#
|
|
116
|
+
# @param phone_number [String] The phone number in E.164 format for long codes, or short code format for short
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PreludeSDK
|
|
4
|
+
module Models
|
|
5
|
+
# @see PreludeSDK::Resources::Notify#get_subscription_phone_number
|
|
6
|
+
class NotifyGetSubscriptionPhoneNumberParams < PreludeSDK::Internal::Type::BaseModel
|
|
7
|
+
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute config_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :config_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute phone_number
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :phone_number, String
|
|
19
|
+
|
|
20
|
+
# @!method initialize(config_id:, phone_number:, request_options: {})
|
|
21
|
+
# @param config_id [String]
|
|
22
|
+
# @param phone_number [String]
|
|
23
|
+
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PreludeSDK
|
|
4
|
+
module Models
|
|
5
|
+
# @see PreludeSDK::Resources::Notify#get_subscription_phone_number
|
|
6
|
+
class NotifyGetSubscriptionPhoneNumberResponse < PreludeSDK::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute config_id
|
|
8
|
+
# The subscription configuration ID.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :config_id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute phone_number
|
|
14
|
+
# The phone number in E.164 format.
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :phone_number, String
|
|
18
|
+
|
|
19
|
+
# @!attribute source
|
|
20
|
+
# How the subscription state was changed:
|
|
21
|
+
#
|
|
22
|
+
# - `MO_KEYWORD` - User sent a keyword (STOP/START)
|
|
23
|
+
# - `API` - Changed via API
|
|
24
|
+
# - `CSV_IMPORT` - Imported from CSV
|
|
25
|
+
# - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect
|
|
26
|
+
#
|
|
27
|
+
# @return [Symbol, PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::Source]
|
|
28
|
+
required :source, enum: -> { PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::Source }
|
|
29
|
+
|
|
30
|
+
# @!attribute state
|
|
31
|
+
# The subscription state:
|
|
32
|
+
#
|
|
33
|
+
# - `SUB` - Subscribed (user can receive marketing messages)
|
|
34
|
+
# - `UNSUB` - Unsubscribed (user has opted out)
|
|
35
|
+
#
|
|
36
|
+
# @return [Symbol, PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::State]
|
|
37
|
+
required :state, enum: -> { PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::State }
|
|
38
|
+
|
|
39
|
+
# @!attribute updated_at
|
|
40
|
+
# The date and time when the subscription status was last updated.
|
|
41
|
+
#
|
|
42
|
+
# @return [Time]
|
|
43
|
+
required :updated_at, Time
|
|
44
|
+
|
|
45
|
+
# @!attribute reason
|
|
46
|
+
# Additional context about the state change (e.g., the keyword that was sent).
|
|
47
|
+
#
|
|
48
|
+
# @return [String, nil]
|
|
49
|
+
optional :reason, String
|
|
50
|
+
|
|
51
|
+
# @!method initialize(config_id:, phone_number:, source:, state:, updated_at:, reason: nil)
|
|
52
|
+
# Some parameter documentations has been truncated, see
|
|
53
|
+
# {PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse} for more details.
|
|
54
|
+
#
|
|
55
|
+
# @param config_id [String] The subscription configuration ID.
|
|
56
|
+
#
|
|
57
|
+
# @param phone_number [String] The phone number in E.164 format.
|
|
58
|
+
#
|
|
59
|
+
# @param source [Symbol, PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::Source] How the subscription state was changed:
|
|
60
|
+
#
|
|
61
|
+
# @param state [Symbol, PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse::State] The subscription state:
|
|
62
|
+
#
|
|
63
|
+
# @param updated_at [Time] The date and time when the subscription status was last updated.
|
|
64
|
+
#
|
|
65
|
+
# @param reason [String] Additional context about the state change (e.g., the keyword that was sent).
|
|
66
|
+
|
|
67
|
+
# How the subscription state was changed:
|
|
68
|
+
#
|
|
69
|
+
# - `MO_KEYWORD` - User sent a keyword (STOP/START)
|
|
70
|
+
# - `API` - Changed via API
|
|
71
|
+
# - `CSV_IMPORT` - Imported from CSV
|
|
72
|
+
# - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect
|
|
73
|
+
#
|
|
74
|
+
# @see PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse#source
|
|
75
|
+
module Source
|
|
76
|
+
extend PreludeSDK::Internal::Type::Enum
|
|
77
|
+
|
|
78
|
+
MO_KEYWORD = :MO_KEYWORD
|
|
79
|
+
API = :API
|
|
80
|
+
CSV_IMPORT = :CSV_IMPORT
|
|
81
|
+
CARRIER_DISCONNECT = :CARRIER_DISCONNECT
|
|
82
|
+
|
|
83
|
+
# @!method self.values
|
|
84
|
+
# @return [Array<Symbol>]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# The subscription state:
|
|
88
|
+
#
|
|
89
|
+
# - `SUB` - Subscribed (user can receive marketing messages)
|
|
90
|
+
# - `UNSUB` - Unsubscribed (user has opted out)
|
|
91
|
+
#
|
|
92
|
+
# @see PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse#state
|
|
93
|
+
module State
|
|
94
|
+
extend PreludeSDK::Internal::Type::Enum
|
|
95
|
+
|
|
96
|
+
SUB = :SUB
|
|
97
|
+
UNSUB = :UNSUB
|
|
98
|
+
|
|
99
|
+
# @!method self.values
|
|
100
|
+
# @return [Array<Symbol>]
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PreludeSDK
|
|
4
|
+
module Models
|
|
5
|
+
# @see PreludeSDK::Resources::Notify#list_subscription_configs
|
|
6
|
+
class NotifyListSubscriptionConfigsParams < PreludeSDK::Internal::Type::BaseModel
|
|
7
|
+
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute cursor
|
|
11
|
+
# Pagination cursor from the previous response
|
|
12
|
+
#
|
|
13
|
+
# @return [String, nil]
|
|
14
|
+
optional :cursor, String
|
|
15
|
+
|
|
16
|
+
# @!attribute limit
|
|
17
|
+
# Maximum number of configurations to return per page
|
|
18
|
+
#
|
|
19
|
+
# @return [Integer, nil]
|
|
20
|
+
optional :limit, Integer
|
|
21
|
+
|
|
22
|
+
# @!method initialize(cursor: nil, limit: nil, request_options: {})
|
|
23
|
+
# @param cursor [String] Pagination cursor from the previous response
|
|
24
|
+
#
|
|
25
|
+
# @param limit [Integer] Maximum number of configurations to return per page
|
|
26
|
+
#
|
|
27
|
+
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|