surge_api 0.2.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 +41 -0
- data/README.md +12 -63
- data/lib/surge_api/internal/transport/base_client.rb +7 -1
- data/lib/surge_api/internal/transport/pooled_net_requester.rb +38 -26
- data/lib/surge_api/internal/type/union.rb +12 -0
- data/lib/surge_api/internal/util.rb +5 -5
- data/lib/surge_api/models/account_create_params.rb +13 -6
- data/lib/surge_api/models/account_update_params.rb +13 -6
- data/lib/surge_api/models/campaign_create_params.rb +7 -183
- data/lib/surge_api/models/campaign_params.rb +228 -0
- data/lib/surge_api/models/message_create_params.rb +8 -134
- data/lib/surge_api/models/message_params.rb +216 -0
- data/lib/surge_api/models/message_retrieve_params.rb +14 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +11 -9
- data/lib/surge_api/models.rb +6 -0
- data/lib/surge_api/resources/campaigns.rb +7 -18
- data/lib/surge_api/resources/messages.rb +27 -12
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +5 -0
- data/manifest.yaml +2 -0
- data/rbi/surge_api/internal/transport/base_client.rbi +5 -0
- data/rbi/surge_api/internal/transport/pooled_net_requester.rbi +6 -2
- data/rbi/surge_api/internal/type/base_model.rbi +8 -4
- data/rbi/surge_api/models/account_create_params.rbi +19 -8
- data/rbi/surge_api/models/account_update_params.rbi +19 -8
- data/rbi/surge_api/models/campaign_create_params.rbi +20 -346
- data/rbi/surge_api/models/campaign_params.rbi +481 -0
- data/rbi/surge_api/models/message_create_params.rbi +24 -243
- data/rbi/surge_api/models/message_params.rbi +430 -0
- data/rbi/surge_api/models/message_retrieve_params.rbi +27 -0
- data/rbi/surge_api/models.rbi +6 -0
- data/rbi/surge_api/resources/campaigns.rbi +4 -89
- data/rbi/surge_api/resources/messages.rbi +19 -22
- data/sig/surge_api/internal/transport/base_client.rbs +2 -0
- data/sig/surge_api/internal/transport/pooled_net_requester.rbs +4 -1
- data/sig/surge_api/models/campaign_create_params.rbs +7 -106
- data/sig/surge_api/models/campaign_params.rbs +141 -0
- data/sig/surge_api/models/message_create_params.rbs +7 -119
- data/sig/surge_api/models/message_params.rbs +189 -0
- data/sig/surge_api/models/message_retrieve_params.rbs +15 -0
- data/sig/surge_api/models.rbs +6 -0
- data/sig/surge_api/resources/campaigns.rbs +1 -9
- data/sig/surge_api/resources/messages.rbs +6 -6
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cdf5f24e69c710419d1609ebc934daaafd1be183603d3f364e6a3d4085fa9b9
|
|
4
|
+
data.tar.gz: 65ecd730b0df9e65ab06bd73a272bbff75e7f3b17c5136173ca26d48e92364bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40416443213907937c15359db9fd573680ec1c0d6038a727304b632125d1331e765d980e4617afe0d80b98db12a1d7405bb3cd84d9b9be2a416ccda6ec9f7857
|
|
7
|
+
data.tar.gz: 20d73f3c32f237a86513ed84416b0ac144ff35f7ccd722bf57e79aa3a4fe44ee2525f91d523f67cd8b1b4819dfe3c3a9fe4b0f2c17cc56b280e2fe9f681d5386
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2025-12-17)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.1...v0.3.0](https://github.com/surgeapi/ruby-sdk/compare/v0.2.1...v0.3.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add retrieve message endpoint ([55df346](https://github.com/surgeapi/ruby-sdk/commit/55df346f91c99fece77d130057afc55b021666c7))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* better thread safety via early initializing SSL store during HTTP client creation ([0d14e5e](https://github.com/surgeapi/ruby-sdk/commit/0d14e5e73496e95743359c4c8dbab6da1c384a6e))
|
|
15
|
+
* calling `break` out of streams should be instantaneous ([b43c7e5](https://github.com/surgeapi/ruby-sdk/commit/b43c7e54e9dfaaf31ffa0fe498c53fcc51bbb81c))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Chores
|
|
19
|
+
|
|
20
|
+
* bump dependency version and update sorbet types ([e00a588](https://github.com/surgeapi/ruby-sdk/commit/e00a5886df58170099838c7a2b1ba25fe36588d6))
|
|
21
|
+
* explicitly require "base64" gem ([a25ee53](https://github.com/surgeapi/ruby-sdk/commit/a25ee53f821df6c2d177b0e41c864e15e4b8bae9))
|
|
22
|
+
* **internal:** codegen related update ([744a068](https://github.com/surgeapi/ruby-sdk/commit/744a0682fa04890d445106232878d0d5be7d7273))
|
|
23
|
+
|
|
24
|
+
## 0.2.1 (2025-10-31)
|
|
25
|
+
|
|
26
|
+
Full Changelog: [v0.2.0...v0.2.1](https://github.com/surgeapi/ruby-sdk/compare/v0.2.0...v0.2.1)
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **api:** create externally registered campaigns ([c01b26e](https://github.com/surgeapi/ruby-sdk/commit/c01b26e3f26a8b827254d128a7c776d79850cbf5))
|
|
31
|
+
* handle thread interrupts in the core HTTP client ([4362499](https://github.com/surgeapi/ruby-sdk/commit/43624993a62c67679d1f5260653517aebd5d687e))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* absolutely qualified uris should always override the default ([58fa7be](https://github.com/surgeapi/ruby-sdk/commit/58fa7bea703edecd59fe69630191a9cb83ece9d0))
|
|
37
|
+
* should not reuse buffers for `IO.copy_stream` interop ([52ce0fd](https://github.com/surgeapi/ruby-sdk/commit/52ce0fd6a7039be032e2f884636215ac1fb88223))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Documentation
|
|
41
|
+
|
|
42
|
+
* **api:** add context around organization contacts ([88c764d](https://github.com/surgeapi/ruby-sdk/commit/88c764d18d70361d1a7f43e22a46d26082f24227))
|
|
43
|
+
|
|
3
44
|
## 0.2.0 (2025-10-09)
|
|
4
45
|
|
|
5
46
|
Full Changelog: [v0.1.0...v0.2.0](https://github.com/surgeapi/ruby-sdk/compare/v0.1.0...v0.2.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 "surge_api", "~> 0.
|
|
20
|
+
gem "surge_api", "~> 0.3.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
|
@@ -32,12 +32,7 @@ surge = SurgeAPI::Client.new(
|
|
|
32
32
|
api_key: ENV["SURGE_API_KEY"] # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
message = surge.messages.create(
|
|
36
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
37
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
38
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
39
|
-
body: "Thought you could leave without saying goodbye?"
|
|
40
|
-
)
|
|
35
|
+
message = surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td")
|
|
41
36
|
|
|
42
37
|
puts(message.id)
|
|
43
38
|
```
|
|
@@ -48,12 +43,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
|
48
43
|
|
|
49
44
|
```ruby
|
|
50
45
|
begin
|
|
51
|
-
message = surge.messages.create(
|
|
52
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
53
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
54
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
55
|
-
body: "Thought you could leave without saying goodbye?"
|
|
56
|
-
)
|
|
46
|
+
message = surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td")
|
|
57
47
|
rescue SurgeAPI::Errors::APIConnectionError => e
|
|
58
48
|
puts("The server could not be reached")
|
|
59
49
|
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
|
@@ -96,13 +86,7 @@ surge = SurgeAPI::Client.new(
|
|
|
96
86
|
)
|
|
97
87
|
|
|
98
88
|
# Or, configure per-request:
|
|
99
|
-
surge.messages.create(
|
|
100
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
101
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
102
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
103
|
-
body: "Thought you could leave without saying goodbye?",
|
|
104
|
-
request_options: {max_retries: 5}
|
|
105
|
-
)
|
|
89
|
+
surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td", request_options: {max_retries: 5})
|
|
106
90
|
```
|
|
107
91
|
|
|
108
92
|
### Timeouts
|
|
@@ -116,13 +100,7 @@ surge = SurgeAPI::Client.new(
|
|
|
116
100
|
)
|
|
117
101
|
|
|
118
102
|
# Or, configure per-request:
|
|
119
|
-
surge.messages.create(
|
|
120
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
121
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
122
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
123
|
-
body: "Thought you could leave without saying goodbye?",
|
|
124
|
-
request_options: {timeout: 5}
|
|
125
|
-
)
|
|
103
|
+
surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td", request_options: {timeout: 5})
|
|
126
104
|
```
|
|
127
105
|
|
|
128
106
|
On timeout, `SurgeAPI::Errors::APITimeoutError` is raised.
|
|
@@ -155,9 +133,6 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
|
155
133
|
message =
|
|
156
134
|
surge.messages.create(
|
|
157
135
|
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
158
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
159
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
160
|
-
body: "Thought you could leave without saying goodbye?",
|
|
161
136
|
request_options: {
|
|
162
137
|
extra_query: {my_query_parameter: value},
|
|
163
138
|
extra_body: {my_body_parameter: value},
|
|
@@ -203,43 +178,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
|
|
|
203
178
|
You can provide typesafe request parameters like so:
|
|
204
179
|
|
|
205
180
|
```ruby
|
|
206
|
-
surge.messages.create(
|
|
207
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
208
|
-
conversation: SurgeAPI::MessageCreateParams::Conversation.new(
|
|
209
|
-
contact: SurgeAPI::MessageCreateParams::Conversation::Contact.new(
|
|
210
|
-
first_name: "Dom",
|
|
211
|
-
last_name: "Toretto",
|
|
212
|
-
phone_number: "+13235556439"
|
|
213
|
-
)
|
|
214
|
-
),
|
|
215
|
-
attachments: [SurgeAPI::MessageCreateParams::Attachment.new(url: "https://toretto.family/coronas.gif")],
|
|
216
|
-
body: "Thought you could leave without saying goodbye?"
|
|
217
|
-
)
|
|
181
|
+
surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td")
|
|
218
182
|
```
|
|
219
183
|
|
|
220
184
|
Or, equivalently:
|
|
221
185
|
|
|
222
186
|
```ruby
|
|
223
187
|
# Hashes work, but are not typesafe:
|
|
224
|
-
surge.messages.create(
|
|
225
|
-
"acct_01j9a43avnfqzbjfch6pygv1td",
|
|
226
|
-
conversation: {contact: {first_name: "Dom", last_name: "Toretto", phone_number: "+13235556439"}},
|
|
227
|
-
attachments: [{url: "https://toretto.family/coronas.gif"}],
|
|
228
|
-
body: "Thought you could leave without saying goodbye?"
|
|
229
|
-
)
|
|
188
|
+
surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td")
|
|
230
189
|
|
|
231
190
|
# You can also splat a full Params class:
|
|
232
|
-
params = SurgeAPI::MessageCreateParams.new
|
|
233
|
-
conversation: SurgeAPI::MessageCreateParams::Conversation.new(
|
|
234
|
-
contact: SurgeAPI::MessageCreateParams::Conversation::Contact.new(
|
|
235
|
-
first_name: "Dom",
|
|
236
|
-
last_name: "Toretto",
|
|
237
|
-
phone_number: "+13235556439"
|
|
238
|
-
)
|
|
239
|
-
),
|
|
240
|
-
attachments: [SurgeAPI::MessageCreateParams::Attachment.new(url: "https://toretto.family/coronas.gif")],
|
|
241
|
-
body: "Thought you could leave without saying goodbye?"
|
|
242
|
-
)
|
|
191
|
+
params = SurgeAPI::MessageCreateParams.new
|
|
243
192
|
surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td", **params)
|
|
244
193
|
```
|
|
245
194
|
|
|
@@ -249,10 +198,10 @@ Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::E
|
|
|
249
198
|
|
|
250
199
|
```ruby
|
|
251
200
|
# :high
|
|
252
|
-
puts(SurgeAPI::
|
|
201
|
+
puts(SurgeAPI::CampaignParams::Volume::HIGH)
|
|
253
202
|
|
|
254
|
-
# Revealed type: `T.all(SurgeAPI::
|
|
255
|
-
T.reveal_type(SurgeAPI::
|
|
203
|
+
# Revealed type: `T.all(SurgeAPI::CampaignParams::Volume, Symbol)`
|
|
204
|
+
T.reveal_type(SurgeAPI::CampaignParams::Volume::HIGH)
|
|
256
205
|
```
|
|
257
206
|
|
|
258
207
|
Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
|
|
@@ -260,7 +209,7 @@ Enum parameters have a "relaxed" type, so you can either pass in enum constants
|
|
|
260
209
|
```ruby
|
|
261
210
|
# Using the enum constants preserves the tagged type information:
|
|
262
211
|
surge.campaigns.create(
|
|
263
|
-
volume: SurgeAPI::
|
|
212
|
+
volume: SurgeAPI::CampaignParams::Volume::HIGH,
|
|
264
213
|
# …
|
|
265
214
|
)
|
|
266
215
|
|
|
@@ -201,7 +201,8 @@ module SurgeAPI
|
|
|
201
201
|
self.class::PLATFORM_HEADERS,
|
|
202
202
|
{
|
|
203
203
|
"accept" => "application/json",
|
|
204
|
-
"content-type" => "application/json"
|
|
204
|
+
"content-type" => "application/json",
|
|
205
|
+
"user-agent" => user_agent
|
|
205
206
|
},
|
|
206
207
|
headers
|
|
207
208
|
)
|
|
@@ -219,6 +220,11 @@ module SurgeAPI
|
|
|
219
220
|
# @return [Hash{String=>String}]
|
|
220
221
|
private def auth_headers = {}
|
|
221
222
|
|
|
223
|
+
# @api private
|
|
224
|
+
#
|
|
225
|
+
# @return [String]
|
|
226
|
+
private def user_agent = "#{self.class.name}/Ruby #{SurgeAPI::VERSION}"
|
|
227
|
+
|
|
222
228
|
# @api private
|
|
223
229
|
#
|
|
224
230
|
# @return [String]
|
|
@@ -16,10 +16,11 @@ module SurgeAPI
|
|
|
16
16
|
class << self
|
|
17
17
|
# @api private
|
|
18
18
|
#
|
|
19
|
+
# @param cert_store [OpenSSL::X509::Store]
|
|
19
20
|
# @param url [URI::Generic]
|
|
20
21
|
#
|
|
21
22
|
# @return [Net::HTTP]
|
|
22
|
-
def connect(url)
|
|
23
|
+
def connect(cert_store:, url:)
|
|
23
24
|
port =
|
|
24
25
|
case [url.port, url.scheme]
|
|
25
26
|
in [Integer, _]
|
|
@@ -33,6 +34,8 @@ module SurgeAPI
|
|
|
33
34
|
Net::HTTP.new(url.host, port).tap do
|
|
34
35
|
_1.use_ssl = %w[https wss].include?(url.scheme)
|
|
35
36
|
_1.max_retries = 0
|
|
37
|
+
|
|
38
|
+
(_1.cert_store = cert_store) if _1.use_ssl?
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
41
|
|
|
@@ -102,7 +105,7 @@ module SurgeAPI
|
|
|
102
105
|
pool =
|
|
103
106
|
@mutex.synchronize do
|
|
104
107
|
@pools[origin] ||= ConnectionPool.new(size: @size) do
|
|
105
|
-
self.class.connect(url)
|
|
108
|
+
self.class.connect(cert_store: @cert_store, url: url)
|
|
106
109
|
end
|
|
107
110
|
end
|
|
108
111
|
|
|
@@ -128,40 +131,50 @@ module SurgeAPI
|
|
|
128
131
|
url, deadline = request.fetch_values(:url, :deadline)
|
|
129
132
|
|
|
130
133
|
req = nil
|
|
131
|
-
eof = false
|
|
132
134
|
finished = false
|
|
133
|
-
closing = nil
|
|
134
135
|
|
|
135
136
|
# rubocop:disable Metrics/BlockLength
|
|
136
137
|
enum = Enumerator.new do |y|
|
|
137
138
|
next if finished
|
|
138
139
|
|
|
139
140
|
with_pool(url, deadline: deadline) do |conn|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
conn.start
|
|
148
|
-
end
|
|
141
|
+
eof = false
|
|
142
|
+
closing = nil
|
|
143
|
+
::Thread.handle_interrupt(Object => :never) do
|
|
144
|
+
::Thread.handle_interrupt(Object => :immediate) do
|
|
145
|
+
req, closing = self.class.build_request(request) do
|
|
146
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
147
|
+
end
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
rsp.read_body do |bytes|
|
|
156
|
-
y << bytes.force_encoding(Encoding::BINARY)
|
|
157
|
-
break if finished
|
|
149
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
150
|
+
unless conn.started?
|
|
151
|
+
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
|
|
152
|
+
conn.start
|
|
153
|
+
end
|
|
158
154
|
|
|
159
155
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
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
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
ensure
|
|
172
|
+
begin
|
|
173
|
+
conn.finish if !eof && conn&.started?
|
|
174
|
+
ensure
|
|
175
|
+
closing&.call
|
|
160
176
|
end
|
|
161
|
-
eof = true
|
|
162
177
|
end
|
|
163
|
-
ensure
|
|
164
|
-
conn.finish if !eof && conn&.started?
|
|
165
178
|
end
|
|
166
179
|
rescue Timeout::Error
|
|
167
180
|
raise SurgeAPI::Errors::APITimeoutError.new(url: url, request: req)
|
|
@@ -174,8 +187,6 @@ module SurgeAPI
|
|
|
174
187
|
body = SurgeAPI::Internal::Util.fused_enum(enum, external: true) do
|
|
175
188
|
finished = true
|
|
176
189
|
loop { enum.next }
|
|
177
|
-
ensure
|
|
178
|
-
closing&.call
|
|
179
190
|
end
|
|
180
191
|
[Integer(response.code), response, body]
|
|
181
192
|
end
|
|
@@ -186,6 +197,7 @@ module SurgeAPI
|
|
|
186
197
|
def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
|
|
187
198
|
@mutex = Mutex.new
|
|
188
199
|
@size = size
|
|
200
|
+
@cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
|
189
201
|
@pools = {}
|
|
190
202
|
end
|
|
191
203
|
|
|
@@ -17,6 +17,18 @@ module SurgeAPI
|
|
|
17
17
|
# else
|
|
18
18
|
# puts(unwrap_webhook_event)
|
|
19
19
|
# end
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# case unwrap_webhook_event
|
|
23
|
+
# in {type: :"call.ended", account_id: account_id, data: data, timestamp: timestamp}
|
|
24
|
+
# puts(account_id)
|
|
25
|
+
# in {type: :"campaign.approved", account_id: account_id, data: data, timestamp: timestamp}
|
|
26
|
+
# puts(data)
|
|
27
|
+
# in {type: :"contact.opted_in", account_id: account_id, data: data, timestamp: timestamp}
|
|
28
|
+
# puts(timestamp)
|
|
29
|
+
# else
|
|
30
|
+
# puts(unwrap_webhook_event)
|
|
31
|
+
# end
|
|
20
32
|
module Union
|
|
21
33
|
include SurgeAPI::Internal::Type::Converter
|
|
22
34
|
include SurgeAPI::Internal::Util::SorbetRuntimeSupport
|
|
@@ -346,8 +346,9 @@ module SurgeAPI
|
|
|
346
346
|
base_path, base_query = lhs.fetch_values(:path, :query)
|
|
347
347
|
slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
|
|
350
|
+
parsed_path, parsed_query = merged.fetch_values(:path, :query)
|
|
351
|
+
override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)
|
|
351
352
|
|
|
352
353
|
joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
|
|
353
354
|
query = deep_merge(
|
|
@@ -473,10 +474,9 @@ module SurgeAPI
|
|
|
473
474
|
# @return [Enumerable<String>]
|
|
474
475
|
def writable_enum(&blk)
|
|
475
476
|
Enumerator.new do |y|
|
|
476
|
-
buf = String.new
|
|
477
477
|
y.define_singleton_method(:write) do
|
|
478
|
-
self <<
|
|
479
|
-
|
|
478
|
+
self << _1.dup
|
|
479
|
+
_1.bytesize
|
|
480
480
|
end
|
|
481
481
|
|
|
482
482
|
blk.call(y)
|
|
@@ -60,8 +60,11 @@ module SurgeAPI
|
|
|
60
60
|
optional :address, -> { SurgeAPI::AccountCreateParams::Organization::Address }
|
|
61
61
|
|
|
62
62
|
# @!attribute contact
|
|
63
|
-
# An object representing an individual who can be contacted if
|
|
64
|
-
# any questions about the business.
|
|
63
|
+
# An object representing an individual who can be contacted if Surge or our
|
|
64
|
+
# carrier partners have any questions about the business. If you are registering
|
|
65
|
+
# on behalf of your customer, this must be a contact from your customer's company
|
|
66
|
+
# rather than your own. The individual will likely never be contacted unless there
|
|
67
|
+
# are issues with spam.
|
|
65
68
|
#
|
|
66
69
|
# @return [SurgeAPI::Models::AccountCreateParams::Organization::Contact, nil]
|
|
67
70
|
optional :contact, -> { SurgeAPI::AccountCreateParams::Organization::Contact }, nil?: true
|
|
@@ -169,7 +172,7 @@ module SurgeAPI
|
|
|
169
172
|
#
|
|
170
173
|
# @param address [SurgeAPI::Models::AccountCreateParams::Organization::Address] The address of the organization's headquarters.
|
|
171
174
|
#
|
|
172
|
-
# @param contact [SurgeAPI::Models::AccountCreateParams::Organization::Contact, nil] An object representing an individual who can be contacted if
|
|
175
|
+
# @param contact [SurgeAPI::Models::AccountCreateParams::Organization::Contact, nil] An object representing an individual who can be contacted if Surge or our carrie
|
|
173
176
|
#
|
|
174
177
|
# @param country [String, nil] The two character ISO 3166 country code for the country in which the organizatio
|
|
175
178
|
#
|
|
@@ -269,7 +272,8 @@ module SurgeAPI
|
|
|
269
272
|
# using the same domain name as the website URL will be preferred (e.g. with a
|
|
270
273
|
# website domain of `https://dtprecisionauto.com`, an email like
|
|
271
274
|
# `dom@dtprecisionauto.com` will be preferred over one like
|
|
272
|
-
# `dom@anothergarage.com` or `dom.toretto@gmail.com`
|
|
275
|
+
# `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
|
|
276
|
+
# would also be acceptable, but not preferred)
|
|
273
277
|
#
|
|
274
278
|
# @return [String, nil]
|
|
275
279
|
optional :email, String, nil?: true
|
|
@@ -313,8 +317,11 @@ module SurgeAPI
|
|
|
313
317
|
# Some parameter documentations has been truncated, see
|
|
314
318
|
# {SurgeAPI::Models::AccountCreateParams::Organization::Contact} for more details.
|
|
315
319
|
#
|
|
316
|
-
# An object representing an individual who can be contacted if
|
|
317
|
-
# any questions about the business.
|
|
320
|
+
# An object representing an individual who can be contacted if Surge or our
|
|
321
|
+
# carrier partners have any questions about the business. If you are registering
|
|
322
|
+
# on behalf of your customer, this must be a contact from your customer's company
|
|
323
|
+
# rather than your own. The individual will likely never be contacted unless there
|
|
324
|
+
# are issues with spam.
|
|
318
325
|
#
|
|
319
326
|
# @param email [String, nil] An email address at which the individual can be reached. Typically an email usin
|
|
320
327
|
#
|
|
@@ -59,8 +59,11 @@ module SurgeAPI
|
|
|
59
59
|
optional :address, -> { SurgeAPI::AccountUpdateParams::Organization::Address }
|
|
60
60
|
|
|
61
61
|
# @!attribute contact
|
|
62
|
-
# An object representing an individual who can be contacted if
|
|
63
|
-
# any questions about the business.
|
|
62
|
+
# An object representing an individual who can be contacted if Surge or our
|
|
63
|
+
# carrier partners have any questions about the business. If you are registering
|
|
64
|
+
# on behalf of your customer, this must be a contact from your customer's company
|
|
65
|
+
# rather than your own. The individual will likely never be contacted unless there
|
|
66
|
+
# are issues with spam.
|
|
64
67
|
#
|
|
65
68
|
# @return [SurgeAPI::Models::AccountUpdateParams::Organization::Contact, nil]
|
|
66
69
|
optional :contact, -> { SurgeAPI::AccountUpdateParams::Organization::Contact }, nil?: true
|
|
@@ -168,7 +171,7 @@ module SurgeAPI
|
|
|
168
171
|
#
|
|
169
172
|
# @param address [SurgeAPI::Models::AccountUpdateParams::Organization::Address] The address of the organization's headquarters.
|
|
170
173
|
#
|
|
171
|
-
# @param contact [SurgeAPI::Models::AccountUpdateParams::Organization::Contact, nil] An object representing an individual who can be contacted if
|
|
174
|
+
# @param contact [SurgeAPI::Models::AccountUpdateParams::Organization::Contact, nil] An object representing an individual who can be contacted if Surge or our carrie
|
|
172
175
|
#
|
|
173
176
|
# @param country [String, nil] The two character ISO 3166 country code for the country in which the organizatio
|
|
174
177
|
#
|
|
@@ -268,7 +271,8 @@ module SurgeAPI
|
|
|
268
271
|
# using the same domain name as the website URL will be preferred (e.g. with a
|
|
269
272
|
# website domain of `https://dtprecisionauto.com`, an email like
|
|
270
273
|
# `dom@dtprecisionauto.com` will be preferred over one like
|
|
271
|
-
# `dom@anothergarage.com` or `dom.toretto@gmail.com`
|
|
274
|
+
# `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
|
|
275
|
+
# would also be acceptable, but not preferred)
|
|
272
276
|
#
|
|
273
277
|
# @return [String, nil]
|
|
274
278
|
optional :email, String, nil?: true
|
|
@@ -312,8 +316,11 @@ module SurgeAPI
|
|
|
312
316
|
# Some parameter documentations has been truncated, see
|
|
313
317
|
# {SurgeAPI::Models::AccountUpdateParams::Organization::Contact} for more details.
|
|
314
318
|
#
|
|
315
|
-
# An object representing an individual who can be contacted if
|
|
316
|
-
# any questions about the business.
|
|
319
|
+
# An object representing an individual who can be contacted if Surge or our
|
|
320
|
+
# carrier partners have any questions about the business. If you are registering
|
|
321
|
+
# on behalf of your customer, this must be a contact from your customer's company
|
|
322
|
+
# rather than your own. The individual will likely never be contacted unless there
|
|
323
|
+
# are issues with spam.
|
|
317
324
|
#
|
|
318
325
|
# @param email [String, nil] An email address at which the individual can be reached. Typically an email usin
|
|
319
326
|
#
|