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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +81 -0
- data/README.md +1 -1
- data/lib/prelude_sdk/client.rb +22 -1
- data/lib/prelude_sdk/internal/transport/pooled_net_requester.rb +13 -11
- data/lib/prelude_sdk/internal/util.rb +61 -10
- data/lib/prelude_sdk/models/lookup_lookup_params.rb +9 -1
- data/lib/prelude_sdk/models/notify_get_subscription_config_params.rb +7 -1
- data/lib/prelude_sdk/models/notify_get_subscription_phone_number_params.rb +7 -1
- data/lib/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rb +8 -1
- data/lib/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rb +8 -1
- data/lib/prelude_sdk/models/notify_send_batch_params.rb +55 -1
- data/lib/prelude_sdk/models/notify_send_batch_response.rb +39 -1
- data/lib/prelude_sdk/models/notify_send_params.rb +92 -1
- data/lib/prelude_sdk/models/notify_send_response.rb +36 -1
- data/lib/prelude_sdk/models/transactional_send_params.rb +54 -1
- data/lib/prelude_sdk/models/verification_create_params.rb +35 -48
- data/lib/prelude_sdk/models/verification_create_response.rb +66 -1
- 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_events_params.rb +6 -2
- data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +7 -130
- data/lib/prelude_sdk/resources/lookup.rb +4 -1
- data/lib/prelude_sdk/resources/notify.rb +19 -7
- 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 +9 -2
- data/lib/prelude_sdk/version.rb +1 -1
- data/rbi/prelude_sdk/client.rbi +7 -0
- data/rbi/prelude_sdk/internal/util.rbi +29 -1
- data/rbi/prelude_sdk/models/lookup_lookup_params.rbi +8 -0
- data/rbi/prelude_sdk/models/notify_get_subscription_config_params.rbi +13 -5
- data/rbi/prelude_sdk/models/notify_get_subscription_phone_number_params.rbi +10 -2
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbi +6 -0
- data/rbi/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbi +6 -0
- data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +88 -0
- data/rbi/prelude_sdk/models/notify_send_batch_response.rbi +80 -0
- data/rbi/prelude_sdk/models/notify_send_params.rbi +145 -0
- data/rbi/prelude_sdk/models/notify_send_response.rbi +75 -0
- data/rbi/prelude_sdk/models/transactional_send_params.rbi +83 -0
- data/rbi/prelude_sdk/models/verification_create_params.rbi +53 -93
- data/rbi/prelude_sdk/models/verification_create_response.rbi +178 -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_events_params.rbi +4 -2
- data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +7 -245
- data/rbi/prelude_sdk/resources/lookup.rbi +2 -0
- data/rbi/prelude_sdk/resources/notify.rbi +36 -2
- data/rbi/prelude_sdk/resources/transactional.rbi +13 -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 +5 -2
- data/sig/prelude_sdk/internal/util.rbs +14 -0
- data/sig/prelude_sdk/models/lookup_lookup_params.rbs +8 -1
- data/sig/prelude_sdk/models/notify_get_subscription_config_params.rbs +11 -3
- data/sig/prelude_sdk/models/notify_get_subscription_phone_number_params.rbs +6 -1
- data/sig/prelude_sdk/models/notify_list_subscription_phone_number_events_params.rbs +10 -1
- data/sig/prelude_sdk/models/notify_list_subscription_phone_numbers_params.rbs +5 -0
- data/sig/prelude_sdk/models/notify_send_batch_params.rbs +25 -1
- data/sig/prelude_sdk/models/notify_send_batch_response.rbs +27 -0
- data/sig/prelude_sdk/models/notify_send_params.rbs +51 -1
- data/sig/prelude_sdk/models/notify_send_response.rbs +27 -0
- data/sig/prelude_sdk/models/transactional_send_params.rbs +23 -0
- data/sig/prelude_sdk/models/verification_create_params.rbs +2 -21
- data/sig/prelude_sdk/models/verification_create_response.rbs +40 -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/resources/notify.rbs +4 -0
- data/sig/prelude_sdk/resources/transactional.rbs +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c30d57028d9ebcfd36fa8b9eec44cb27060d610dea0ad043a84d5d3ba03e63dd
|
|
4
|
+
data.tar.gz: 3704104bbb4293a7bef28aaa073376d8bd873f0b90ae8102c5e73194cd0259eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56012d0287c7baa14666bc5a009ed125c3a40f442e2cdbf4a6c1e2fd65671212ec0cf947bffd9dfd90b5a64197d3525a1f79969f01d4f063e7f860f907b0b729
|
|
7
|
+
data.tar.gz: 497e10803825d58f550569fae77d4e02a20ff1a3a75480c31710513b41c58e19d8ce4d7979b497066f22385ca3c5cab537edd6a10d7b7d9e79ad619cf36d0a64
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 (2026-04-30)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.3.0...v0.4.0](https://github.com/prelude-so/ruby-sdk/compare/v0.3.0...v0.4.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([6ef917b](https://github.com/prelude-so/ruby-sdk/commit/6ef917bcd3a32e40139d32528e20ad17ea3b8278))
|
|
10
|
+
* **api:** api update ([f0ec5a8](https://github.com/prelude-so/ruby-sdk/commit/f0ec5a8d5121f7f8d541a3f9fbf5a2176380bdb2))
|
|
11
|
+
* **api:** api update ([3041c86](https://github.com/prelude-so/ruby-sdk/commit/3041c8644933cc9a849dc02bdf2717c4405bf812))
|
|
12
|
+
* **api:** api update ([3d94aa1](https://github.com/prelude-so/ruby-sdk/commit/3d94aa1539b0ee491fb1b852976aee745c72f08b))
|
|
13
|
+
* **api:** api update ([3f9e6ce](https://github.com/prelude-so/ruby-sdk/commit/3f9e6ce6f97d66c574611befa9c1620b93eeeb76))
|
|
14
|
+
* support setting headers via env ([755c4ac](https://github.com/prelude-so/ruby-sdk/commit/755c4acad1a339802b824f6f719a9084db6742fc))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* align path encoding with RFC 3986 section 3.3 ([20f9b5e](https://github.com/prelude-so/ruby-sdk/commit/20f9b5e3571676a09e4b2aa5a1f554257d67c07d))
|
|
20
|
+
* **internal:** correct multipart form field name encoding ([ba42aef](https://github.com/prelude-so/ruby-sdk/commit/ba42aeff39e77c2911fddb776676bf5ec3b6480d))
|
|
21
|
+
* multipart encoding for file arrays ([00c8720](https://github.com/prelude-so/ruby-sdk/commit/00c87208d38c26848af8a20f0f2ab916d908ca95))
|
|
22
|
+
* variable name typo ([2a83f6e](https://github.com/prelude-so/ruby-sdk/commit/2a83f6eff281991ab4736f6ce752cef42c7e4b60))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Chores
|
|
26
|
+
|
|
27
|
+
* **ci:** skip lint on metadata-only changes ([ecdcd0b](https://github.com/prelude-so/ruby-sdk/commit/ecdcd0b15967ac9ab50887e24c9884804a72c2c7))
|
|
28
|
+
* **ci:** support opting out of skipping builds on metadata-only commits ([86d205e](https://github.com/prelude-so/ruby-sdk/commit/86d205e651fbb5002655857a287ec09b0b2b4370))
|
|
29
|
+
* **internal:** more robust bootstrap script ([1163c75](https://github.com/prelude-so/ruby-sdk/commit/1163c758b68ed31eb3ae60117d8850ba3417c829))
|
|
30
|
+
* **tests:** bump steady to v0.19.6 ([9be6206](https://github.com/prelude-so/ruby-sdk/commit/9be6206e357ce0ab47da60230a356ed5d2e33bc3))
|
|
31
|
+
* **tests:** bump steady to v0.19.7 ([e96d496](https://github.com/prelude-so/ruby-sdk/commit/e96d496b589f7a404288d92b8519ae25fc1f4c96))
|
|
32
|
+
* **tests:** bump steady to v0.20.1 ([f9c136f](https://github.com/prelude-so/ruby-sdk/commit/f9c136fad7a342404cc80b6e5d10a0c5cce19d88))
|
|
33
|
+
* **tests:** bump steady to v0.20.2 ([cf8ca21](https://github.com/prelude-so/ruby-sdk/commit/cf8ca215bacfb6606bfe3ca08db55bacef5c3d18))
|
|
34
|
+
* **tests:** bump steady to v0.22.1 ([4223d7b](https://github.com/prelude-so/ruby-sdk/commit/4223d7b15d68b27d1029eb93e135a96e25244548))
|
|
35
|
+
|
|
36
|
+
## 0.3.0 (2026-03-23)
|
|
37
|
+
|
|
38
|
+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/prelude-so/ruby-sdk/compare/v0.2.0...v0.3.0)
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* **api:** api update ([24553b3](https://github.com/prelude-so/ruby-sdk/commit/24553b346bf3e424aa565b58dfc0a5ff339d0ffd))
|
|
43
|
+
* **api:** api update ([c8e488b](https://github.com/prelude-so/ruby-sdk/commit/c8e488bc5106f22fd3c3e1e996aa865bf51ff3a1))
|
|
44
|
+
* **api:** api update ([bc9d8d4](https://github.com/prelude-so/ruby-sdk/commit/bc9d8d41c941879192c531c1b5f07d619d4bfc7b))
|
|
45
|
+
* **api:** api update ([1e8ea21](https://github.com/prelude-so/ruby-sdk/commit/1e8ea213c96c039d76722d6bc522e84e0ff0278f))
|
|
46
|
+
* **api:** api update ([c339306](https://github.com/prelude-so/ruby-sdk/commit/c3393069dc67ed5ecaecb276b26c2308a00356d1))
|
|
47
|
+
* **api:** api update ([ec6ca20](https://github.com/prelude-so/ruby-sdk/commit/ec6ca2085c7628b495b9486bd46c27656432e9eb))
|
|
48
|
+
* **api:** api update ([64ca50e](https://github.com/prelude-so/ruby-sdk/commit/64ca50eae743d655d253c2ab6564eade851b60be))
|
|
49
|
+
* **api:** api update ([240811f](https://github.com/prelude-so/ruby-sdk/commit/240811ffbc8caabaad46ce164bdb9ac3c6cbf9b0))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* calling `break` out of streams should be instantaneous ([a880e79](https://github.com/prelude-so/ruby-sdk/commit/a880e79694d57969c34395666edbd365d5a65483))
|
|
55
|
+
* **client:** add types for path params, and update structure of unions nested in params ([dff25fc](https://github.com/prelude-so/ruby-sdk/commit/dff25fc4134005a9e8a7f84d8fc6fbd5f9ac8098))
|
|
56
|
+
* **client:** always add content-length to post body, even when empty ([73b8b98](https://github.com/prelude-so/ruby-sdk/commit/73b8b98d2f14602fb5b297a697d3894699659b84))
|
|
57
|
+
* **client:** loosen json header parsing ([144e10b](https://github.com/prelude-so/ruby-sdk/commit/144e10bb50679a7748df724edf574a86fc8fbc9e))
|
|
58
|
+
* **client:** serialize query parameters properly ([e59d46e](https://github.com/prelude-so/ruby-sdk/commit/e59d46eaa39b1033807c4c000cfb4220b1c8d0ff))
|
|
59
|
+
* issue where json.parse errors when receiving HTTP 204 with nobody ([5960180](https://github.com/prelude-so/ruby-sdk/commit/59601805484363ad564d640ae2dec6a2eff08f26))
|
|
60
|
+
* properly mock time in ruby ci tests ([19a7259](https://github.com/prelude-so/ruby-sdk/commit/19a7259d6c21e24e6773487981154c17215846f0))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Chores
|
|
64
|
+
|
|
65
|
+
* **ci:** add build step ([9517e54](https://github.com/prelude-so/ruby-sdk/commit/9517e54b4ad0cf6bfeefdb9c227217f5f732cf27))
|
|
66
|
+
* **ci:** skip uploading artifacts on stainless-internal branches ([b239f23](https://github.com/prelude-so/ruby-sdk/commit/b239f237e3b67cc6a01f992028fc5885336f6538))
|
|
67
|
+
* **docs:** add missing descriptions ([874587d](https://github.com/prelude-so/ruby-sdk/commit/874587d45083a9a5e0fc188b378a9b8d58dd39a5))
|
|
68
|
+
* **docs:** remove www prefix ([9c41466](https://github.com/prelude-so/ruby-sdk/commit/9c41466d86710318107d52692f8efb93515e9738))
|
|
69
|
+
* **internal:** codegen related update ([4721c32](https://github.com/prelude-so/ruby-sdk/commit/4721c32fbc82220da55e561f4ad10ac22223108b))
|
|
70
|
+
* **internal:** codegen related update ([d227583](https://github.com/prelude-so/ruby-sdk/commit/d227583e5a4a92a1cbc4bd75ed70b18df8a2f0ff))
|
|
71
|
+
* **internal:** tweak CI branches ([1a3bb89](https://github.com/prelude-so/ruby-sdk/commit/1a3bb8905066138aec8da0bba42d3f699da7144f))
|
|
72
|
+
* **internal:** update `actions/checkout` version ([dd49de2](https://github.com/prelude-so/ruby-sdk/commit/dd49de2c037b0f622d7cdead21ab464a1455363f))
|
|
73
|
+
* **internal:** update gitignore ([603a4c6](https://github.com/prelude-so/ruby-sdk/commit/603a4c69350448463dae3f8d99d6aa09d0c48b1b))
|
|
74
|
+
* **test:** do not count install time for mock server timeout ([77b5e70](https://github.com/prelude-so/ruby-sdk/commit/77b5e70ec2a773c70e55ca4cb3e527e8d2446459))
|
|
75
|
+
* **tests:** bump steady to v0.19.4 ([001f050](https://github.com/prelude-so/ruby-sdk/commit/001f050d338b3015dba4527bc278795fadb04ac2))
|
|
76
|
+
* **tests:** bump steady to v0.19.5 ([e824cb0](https://github.com/prelude-so/ruby-sdk/commit/e824cb0c8e2f3f601a4e07f7c36afeafcfff9b28))
|
|
77
|
+
* update mock server docs ([6fa353c](https://github.com/prelude-so/ruby-sdk/commit/6fa353cd9d0112786119b6a50d96fc48c77253c3))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Refactors
|
|
81
|
+
|
|
82
|
+
* **tests:** switch from prism to steady ([4f1499f](https://github.com/prelude-so/ruby-sdk/commit/4f1499f85472caac00731960ba4a9623131c57f6))
|
|
83
|
+
|
|
3
84
|
## 0.2.0 (2025-12-05)
|
|
4
85
|
|
|
5
86
|
Full Changelog: [v0.1.0...v0.2.0](https://github.com/prelude-so/ruby-sdk/compare/v0.1.0...v0.2.0)
|
data/README.md
CHANGED
data/lib/prelude_sdk/client.rb
CHANGED
|
@@ -19,21 +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.
|
|
25
28
|
# @return [PreludeSDK::Resources::Notify]
|
|
26
29
|
attr_reader :notify
|
|
27
30
|
|
|
31
|
+
# Send transactional messages (deprecated - use Notify API instead).
|
|
28
32
|
# @return [PreludeSDK::Resources::Transactional]
|
|
29
33
|
attr_reader :transactional
|
|
30
34
|
|
|
35
|
+
# Verify phone numbers.
|
|
31
36
|
# @return [PreludeSDK::Resources::Verification]
|
|
32
37
|
attr_reader :verification
|
|
33
38
|
|
|
39
|
+
# Verify phone numbers.
|
|
34
40
|
# @return [PreludeSDK::Resources::VerificationManagement]
|
|
35
41
|
attr_reader :verification_management
|
|
36
42
|
|
|
43
|
+
# Evaluate email addresses and phone numbers for trustworthiness.
|
|
37
44
|
# @return [PreludeSDK::Resources::Watch]
|
|
38
45
|
attr_reader :watch
|
|
39
46
|
|
|
@@ -74,6 +81,19 @@ module PreludeSDK
|
|
|
74
81
|
raise ArgumentError.new("api_token is required, and can be set via environ: \"API_TOKEN\"")
|
|
75
82
|
end
|
|
76
83
|
|
|
84
|
+
headers = {}
|
|
85
|
+
custom_headers_env = ENV["PRELUDE_CUSTOM_HEADERS"]
|
|
86
|
+
unless custom_headers_env.nil?
|
|
87
|
+
parsed = {}
|
|
88
|
+
custom_headers_env.split("\n").each do |line|
|
|
89
|
+
colon = line.index(":")
|
|
90
|
+
unless colon.nil?
|
|
91
|
+
parsed[line[0...colon].strip] = line[(colon + 1)..].strip
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
headers = parsed.merge(headers)
|
|
95
|
+
end
|
|
96
|
+
|
|
77
97
|
@api_token = api_token.to_s
|
|
78
98
|
|
|
79
99
|
super(
|
|
@@ -81,7 +101,8 @@ module PreludeSDK
|
|
|
81
101
|
timeout: timeout,
|
|
82
102
|
max_retries: max_retries,
|
|
83
103
|
initial_retry_delay: initial_retry_delay,
|
|
84
|
-
max_retry_delay: max_retry_delay
|
|
104
|
+
max_retry_delay: max_retry_delay,
|
|
105
|
+
headers: headers
|
|
85
106
|
)
|
|
86
107
|
|
|
87
108
|
@lookup = PreludeSDK::Resources::Lookup.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
|
|
@@ -157,7 +157,7 @@ module PreludeSDK
|
|
|
157
157
|
in Hash | nil => coerced
|
|
158
158
|
coerced
|
|
159
159
|
else
|
|
160
|
-
message = "Expected a #{Hash} or #{PreludeSDK::Internal::Type::BaseModel}, got #{
|
|
160
|
+
message = "Expected a #{Hash} or #{PreludeSDK::Internal::Type::BaseModel}, got #{input.inspect}"
|
|
161
161
|
raise ArgumentError.new(message)
|
|
162
162
|
end
|
|
163
163
|
end
|
|
@@ -237,6 +237,11 @@ module PreludeSDK
|
|
|
237
237
|
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
+
# @type [Regexp]
|
|
241
|
+
#
|
|
242
|
+
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
|
|
243
|
+
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
|
|
244
|
+
|
|
240
245
|
class << self
|
|
241
246
|
# @api private
|
|
242
247
|
#
|
|
@@ -247,6 +252,15 @@ module PreludeSDK
|
|
|
247
252
|
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
|
|
248
253
|
end
|
|
249
254
|
|
|
255
|
+
# @api private
|
|
256
|
+
#
|
|
257
|
+
# @param path [String, Integer]
|
|
258
|
+
#
|
|
259
|
+
# @return [String]
|
|
260
|
+
def encode_path(path)
|
|
261
|
+
path.to_s.gsub(PreludeSDK::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
|
|
262
|
+
end
|
|
263
|
+
|
|
250
264
|
# @api private
|
|
251
265
|
#
|
|
252
266
|
# @param path [String, Array<String>]
|
|
@@ -259,7 +273,7 @@ module PreludeSDK
|
|
|
259
273
|
in []
|
|
260
274
|
""
|
|
261
275
|
in [String => p, *interpolations]
|
|
262
|
-
encoded = interpolations.map {
|
|
276
|
+
encoded = interpolations.map { encode_path(_1) }
|
|
263
277
|
format(p, *encoded)
|
|
264
278
|
end
|
|
265
279
|
end
|
|
@@ -485,11 +499,42 @@ module PreludeSDK
|
|
|
485
499
|
end
|
|
486
500
|
|
|
487
501
|
# @type [Regexp]
|
|
488
|
-
JSON_CONTENT = %r{^application/(?:
|
|
502
|
+
JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
|
|
489
503
|
# @type [Regexp]
|
|
490
504
|
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
|
491
505
|
|
|
492
506
|
class << self
|
|
507
|
+
# @api private
|
|
508
|
+
#
|
|
509
|
+
# @param query [Hash{Symbol=>Object}]
|
|
510
|
+
#
|
|
511
|
+
# @return [Hash{Symbol=>Object}]
|
|
512
|
+
def encode_query_params(query)
|
|
513
|
+
out = {}
|
|
514
|
+
query.each { write_query_param_element!(out, _1, _2) }
|
|
515
|
+
out
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# @api private
|
|
519
|
+
#
|
|
520
|
+
# @param collection [Hash{Symbol=>Object}]
|
|
521
|
+
# @param key [String]
|
|
522
|
+
# @param element [Object]
|
|
523
|
+
#
|
|
524
|
+
# @return [nil]
|
|
525
|
+
private def write_query_param_element!(collection, key, element)
|
|
526
|
+
case element
|
|
527
|
+
in Hash
|
|
528
|
+
element.each do |name, value|
|
|
529
|
+
write_query_param_element!(collection, "#{key}[#{name}]", value)
|
|
530
|
+
end
|
|
531
|
+
in Array
|
|
532
|
+
collection[key] = element.map(&:to_s).join(",")
|
|
533
|
+
else
|
|
534
|
+
collection[key] = element.to_s
|
|
535
|
+
end
|
|
536
|
+
end
|
|
537
|
+
|
|
493
538
|
# @api private
|
|
494
539
|
#
|
|
495
540
|
# @param y [Enumerator::Yielder]
|
|
@@ -540,16 +585,15 @@ module PreludeSDK
|
|
|
540
585
|
y << "Content-Disposition: form-data"
|
|
541
586
|
|
|
542
587
|
unless key.nil?
|
|
543
|
-
|
|
544
|
-
y << "; name=\"#{name}\""
|
|
588
|
+
y << "; name=\"#{key}\""
|
|
545
589
|
end
|
|
546
590
|
|
|
547
591
|
case val
|
|
548
592
|
in PreludeSDK::FilePart unless val.filename.nil?
|
|
549
|
-
filename =
|
|
593
|
+
filename = encode_path(val.filename)
|
|
550
594
|
y << "; filename=\"#{filename}\""
|
|
551
595
|
in Pathname | IO
|
|
552
|
-
filename =
|
|
596
|
+
filename = encode_path(::File.basename(val.to_path))
|
|
553
597
|
y << "; filename=\"#{filename}\""
|
|
554
598
|
else
|
|
555
599
|
end
|
|
@@ -566,6 +610,7 @@ module PreludeSDK
|
|
|
566
610
|
#
|
|
567
611
|
# @return [Array(String, Enumerable<String>)]
|
|
568
612
|
private def encode_multipart_streaming(body)
|
|
613
|
+
# rubocop:disable Style/CaseEquality
|
|
569
614
|
# RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
|
|
570
615
|
boundary = SecureRandom.urlsafe_base64(46)
|
|
571
616
|
|
|
@@ -575,7 +620,7 @@ module PreludeSDK
|
|
|
575
620
|
in Hash
|
|
576
621
|
body.each do |key, val|
|
|
577
622
|
case val
|
|
578
|
-
in Array if val.all? { primitive?(_1) }
|
|
623
|
+
in Array if val.all? { primitive?(_1) || PreludeSDK::Internal::Type::FileInput === _1 }
|
|
579
624
|
val.each do |v|
|
|
580
625
|
write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
|
|
581
626
|
end
|
|
@@ -591,6 +636,7 @@ module PreludeSDK
|
|
|
591
636
|
|
|
592
637
|
fused_io = fused_enum(strio) { closing.each(&:call) }
|
|
593
638
|
[boundary, fused_io]
|
|
639
|
+
# rubocop:enable Style/CaseEquality
|
|
594
640
|
end
|
|
595
641
|
|
|
596
642
|
# @api private
|
|
@@ -657,7 +703,8 @@ module PreludeSDK
|
|
|
657
703
|
def decode_content(headers, stream:, suppress_error: false)
|
|
658
704
|
case (content_type = headers["content-type"])
|
|
659
705
|
in PreludeSDK::Internal::Util::JSON_CONTENT
|
|
660
|
-
json = stream.to_a.join
|
|
706
|
+
return nil if (json = stream.to_a.join).empty?
|
|
707
|
+
|
|
661
708
|
begin
|
|
662
709
|
JSON.parse(json, symbolize_names: true)
|
|
663
710
|
rescue JSON::ParserError => e
|
|
@@ -667,7 +714,11 @@ module PreludeSDK
|
|
|
667
714
|
in PreludeSDK::Internal::Util::JSONL_CONTENT
|
|
668
715
|
lines = decode_lines(stream)
|
|
669
716
|
chain_fused(lines) do |y|
|
|
670
|
-
lines.each
|
|
717
|
+
lines.each do
|
|
718
|
+
next if _1.empty?
|
|
719
|
+
|
|
720
|
+
y << JSON.parse(_1, symbolize_names: true)
|
|
721
|
+
end
|
|
671
722
|
end
|
|
672
723
|
in %r{^text/event-stream}
|
|
673
724
|
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}]
|
|
@@ -7,7 +7,13 @@ module PreludeSDK
|
|
|
7
7
|
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
-
# @!
|
|
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]
|
|
11
17
|
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
12
18
|
end
|
|
13
19
|
end
|
|
@@ -12,8 +12,14 @@ module PreludeSDK
|
|
|
12
12
|
# @return [String]
|
|
13
13
|
required :config_id, String
|
|
14
14
|
|
|
15
|
-
# @!
|
|
15
|
+
# @!attribute phone_number
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :phone_number, String
|
|
19
|
+
|
|
20
|
+
# @!method initialize(config_id:, phone_number:, request_options: {})
|
|
16
21
|
# @param config_id [String]
|
|
22
|
+
# @param phone_number [String]
|
|
17
23
|
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
18
24
|
end
|
|
19
25
|
end
|
|
@@ -12,6 +12,11 @@ module PreludeSDK
|
|
|
12
12
|
# @return [String]
|
|
13
13
|
required :config_id, String
|
|
14
14
|
|
|
15
|
+
# @!attribute phone_number
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :phone_number, String
|
|
19
|
+
|
|
15
20
|
# @!attribute cursor
|
|
16
21
|
# Pagination cursor from the previous response
|
|
17
22
|
#
|
|
@@ -24,9 +29,11 @@ module PreludeSDK
|
|
|
24
29
|
# @return [Integer, nil]
|
|
25
30
|
optional :limit, Integer
|
|
26
31
|
|
|
27
|
-
# @!method initialize(config_id:, cursor: nil, limit: nil, request_options: {})
|
|
32
|
+
# @!method initialize(config_id:, phone_number:, cursor: nil, limit: nil, request_options: {})
|
|
28
33
|
# @param config_id [String]
|
|
29
34
|
#
|
|
35
|
+
# @param phone_number [String]
|
|
36
|
+
#
|
|
30
37
|
# @param cursor [String] Pagination cursor from the previous response
|
|
31
38
|
#
|
|
32
39
|
# @param limit [Integer] Maximum number of events to return per page
|
|
@@ -7,6 +7,11 @@ module PreludeSDK
|
|
|
7
7
|
extend PreludeSDK::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include PreludeSDK::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute config_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :config_id, String
|
|
14
|
+
|
|
10
15
|
# @!attribute cursor
|
|
11
16
|
# Pagination cursor from the previous response
|
|
12
17
|
#
|
|
@@ -25,7 +30,9 @@ module PreludeSDK
|
|
|
25
30
|
# @return [Symbol, PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersParams::State, nil]
|
|
26
31
|
optional :state, enum: -> { PreludeSDK::NotifyListSubscriptionPhoneNumbersParams::State }
|
|
27
32
|
|
|
28
|
-
# @!method initialize(cursor: nil, limit: nil, state: nil, request_options: {})
|
|
33
|
+
# @!method initialize(config_id:, cursor: nil, limit: nil, state: nil, request_options: {})
|
|
34
|
+
# @param config_id [String]
|
|
35
|
+
#
|
|
29
36
|
# @param cursor [String] Pagination cursor from the previous response
|
|
30
37
|
#
|
|
31
38
|
# @param limit [Integer] Maximum number of phone numbers to return per page
|
|
@@ -31,6 +31,21 @@ module PreludeSDK
|
|
|
31
31
|
# @return [String, nil]
|
|
32
32
|
optional :correlation_id, String
|
|
33
33
|
|
|
34
|
+
# @!attribute document
|
|
35
|
+
# A media attachment to include in the message header. Supported on WhatsApp
|
|
36
|
+
# templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
|
|
37
|
+
# type is determined by the template's registered header format; send the matching
|
|
38
|
+
# file type for each.
|
|
39
|
+
#
|
|
40
|
+
# - `DOCUMENT` headers accept PDF and other document formats; `filename` is
|
|
41
|
+
# required and displayed to the recipient.
|
|
42
|
+
# - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
|
|
43
|
+
# is ignored.
|
|
44
|
+
# - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
|
|
45
|
+
#
|
|
46
|
+
# @return [PreludeSDK::Models::NotifySendBatchParams::Document, nil]
|
|
47
|
+
optional :document, -> { PreludeSDK::NotifySendBatchParams::Document }
|
|
48
|
+
|
|
34
49
|
# @!attribute expires_at
|
|
35
50
|
# The message expiration date in RFC3339 format. Messages will not be sent after
|
|
36
51
|
# this time.
|
|
@@ -69,7 +84,7 @@ module PreludeSDK
|
|
|
69
84
|
# @return [Hash{Symbol=>String}, nil]
|
|
70
85
|
optional :variables, PreludeSDK::Internal::Type::HashOf[String]
|
|
71
86
|
|
|
72
|
-
# @!method initialize(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: {})
|
|
87
|
+
# @!method initialize(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: {})
|
|
73
88
|
# Some parameter documentations has been truncated, see
|
|
74
89
|
# {PreludeSDK::Models::NotifySendBatchParams} for more details.
|
|
75
90
|
#
|
|
@@ -81,6 +96,8 @@ module PreludeSDK
|
|
|
81
96
|
#
|
|
82
97
|
# @param correlation_id [String] A user-defined identifier to correlate this request with your internal systems.
|
|
83
98
|
#
|
|
99
|
+
# @param document [PreludeSDK::Models::NotifySendBatchParams::Document] A media attachment to include in the message header. Supported on
|
|
100
|
+
#
|
|
84
101
|
# @param expires_at [Time] The message expiration date in RFC3339 format. Messages will not be sent after t
|
|
85
102
|
#
|
|
86
103
|
# @param from [String] The Sender ID. Must be approved for your account.
|
|
@@ -95,11 +112,48 @@ module PreludeSDK
|
|
|
95
112
|
#
|
|
96
113
|
# @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}]
|
|
97
114
|
|
|
115
|
+
class Document < PreludeSDK::Internal::Type::BaseModel
|
|
116
|
+
# @!attribute url
|
|
117
|
+
# HTTPS URL of the media file. The file extension must match the template's
|
|
118
|
+
# registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
|
|
119
|
+
# for VIDEO).
|
|
120
|
+
#
|
|
121
|
+
# @return [String]
|
|
122
|
+
required :url, String
|
|
123
|
+
|
|
124
|
+
# @!attribute filename
|
|
125
|
+
# Filename displayed to the recipient. Required for templates with a `DOCUMENT`
|
|
126
|
+
# header; ignored for `IMAGE` and `VIDEO` headers.
|
|
127
|
+
#
|
|
128
|
+
# @return [String, nil]
|
|
129
|
+
optional :filename, String
|
|
130
|
+
|
|
131
|
+
# @!method initialize(url:, filename: nil)
|
|
132
|
+
# Some parameter documentations has been truncated, see
|
|
133
|
+
# {PreludeSDK::Models::NotifySendBatchParams::Document} for more details.
|
|
134
|
+
#
|
|
135
|
+
# A media attachment to include in the message header. Supported on WhatsApp
|
|
136
|
+
# templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
|
|
137
|
+
# type is determined by the template's registered header format; send the matching
|
|
138
|
+
# file type for each.
|
|
139
|
+
#
|
|
140
|
+
# - `DOCUMENT` headers accept PDF and other document formats; `filename` is
|
|
141
|
+
# required and displayed to the recipient.
|
|
142
|
+
# - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
|
|
143
|
+
# is ignored.
|
|
144
|
+
# - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
|
|
145
|
+
#
|
|
146
|
+
# @param url [String] HTTPS URL of the media file. The file extension must match the template's regist
|
|
147
|
+
#
|
|
148
|
+
# @param filename [String] Filename displayed to the recipient. Required for templates with a `DOCUMENT` he
|
|
149
|
+
end
|
|
150
|
+
|
|
98
151
|
# Preferred channel for delivery. If unavailable, automatic fallback applies.
|
|
99
152
|
module PreferredChannel
|
|
100
153
|
extend PreludeSDK::Internal::Type::Enum
|
|
101
154
|
|
|
102
155
|
SMS = :sms
|
|
156
|
+
RCS = :rcs
|
|
103
157
|
WHATSAPP = :whatsapp
|
|
104
158
|
|
|
105
159
|
# @!method self.values
|
|
@@ -146,6 +146,22 @@ module PreludeSDK
|
|
|
146
146
|
# @return [Time, nil]
|
|
147
147
|
optional :created_at, Time
|
|
148
148
|
|
|
149
|
+
# @!attribute encoding
|
|
150
|
+
# The SMS encoding type based on message content. GSM-7 supports standard
|
|
151
|
+
# characters (up to 160 chars per segment), while UCS-2 supports Unicode including
|
|
152
|
+
# emoji (up to 70 chars per segment). Only present for SMS messages.
|
|
153
|
+
#
|
|
154
|
+
# @return [Symbol, PreludeSDK::Models::NotifySendBatchResponse::Result::Message::Encoding, nil]
|
|
155
|
+
optional :encoding, enum: -> { PreludeSDK::Models::NotifySendBatchResponse::Result::Message::Encoding }
|
|
156
|
+
|
|
157
|
+
# @!attribute estimated_segment_count
|
|
158
|
+
# The estimated number of SMS segments for this message. This value is not
|
|
159
|
+
# contractual; the actual segment count will be determined after the SMS is sent
|
|
160
|
+
# by the provider. Only present for SMS messages.
|
|
161
|
+
#
|
|
162
|
+
# @return [Integer, nil]
|
|
163
|
+
optional :estimated_segment_count, Integer
|
|
164
|
+
|
|
149
165
|
# @!attribute expires_at
|
|
150
166
|
# The message expiration date in RFC3339 format.
|
|
151
167
|
#
|
|
@@ -176,7 +192,10 @@ module PreludeSDK
|
|
|
176
192
|
# @return [String, nil]
|
|
177
193
|
optional :to, String
|
|
178
194
|
|
|
179
|
-
# @!method initialize(id: nil, correlation_id: nil, created_at: nil, expires_at: nil, from: nil, locale: nil, schedule_at: nil, to: nil)
|
|
195
|
+
# @!method initialize(id: nil, correlation_id: nil, created_at: nil, encoding: nil, estimated_segment_count: nil, expires_at: nil, from: nil, locale: nil, schedule_at: nil, to: nil)
|
|
196
|
+
# Some parameter documentations has been truncated, see
|
|
197
|
+
# {PreludeSDK::Models::NotifySendBatchResponse::Result::Message} for more details.
|
|
198
|
+
#
|
|
180
199
|
# Present only if success is true.
|
|
181
200
|
#
|
|
182
201
|
# @param id [String] The message identifier.
|
|
@@ -185,6 +204,10 @@ module PreludeSDK
|
|
|
185
204
|
#
|
|
186
205
|
# @param created_at [Time] The message creation date in RFC3339 format.
|
|
187
206
|
#
|
|
207
|
+
# @param encoding [Symbol, PreludeSDK::Models::NotifySendBatchResponse::Result::Message::Encoding] The SMS encoding type based on message content. GSM-7 supports standard characte
|
|
208
|
+
#
|
|
209
|
+
# @param estimated_segment_count [Integer] The estimated number of SMS segments for this message. This value is not contrac
|
|
210
|
+
#
|
|
188
211
|
# @param expires_at [Time] The message expiration date in RFC3339 format.
|
|
189
212
|
#
|
|
190
213
|
# @param from [String] The Sender ID used for this message.
|
|
@@ -194,6 +217,21 @@ module PreludeSDK
|
|
|
194
217
|
# @param schedule_at [Time] When the message will actually be sent in RFC3339 format with timezone offset.
|
|
195
218
|
#
|
|
196
219
|
# @param to [String] The recipient's phone number in E.164 format.
|
|
220
|
+
|
|
221
|
+
# The SMS encoding type based on message content. GSM-7 supports standard
|
|
222
|
+
# characters (up to 160 chars per segment), while UCS-2 supports Unicode including
|
|
223
|
+
# emoji (up to 70 chars per segment). Only present for SMS messages.
|
|
224
|
+
#
|
|
225
|
+
# @see PreludeSDK::Models::NotifySendBatchResponse::Result::Message#encoding
|
|
226
|
+
module Encoding
|
|
227
|
+
extend PreludeSDK::Internal::Type::Enum
|
|
228
|
+
|
|
229
|
+
GSM_7 = :"GSM-7"
|
|
230
|
+
UCS_2 = :"UCS-2"
|
|
231
|
+
|
|
232
|
+
# @!method self.values
|
|
233
|
+
# @return [Array<Symbol>]
|
|
234
|
+
end
|
|
197
235
|
end
|
|
198
236
|
end
|
|
199
237
|
end
|