surge_api 0.1.0 → 0.2.1
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 +39 -0
- data/README.md +12 -63
- data/lib/surge_api/file_part.rb +10 -7
- data/lib/surge_api/internal/transport/pooled_net_requester.rb +34 -31
- data/lib/surge_api/internal/type/file_input.rb +7 -4
- data/lib/surge_api/internal/type/union.rb +1 -1
- 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/contact_opted_in_webhook_event.rb +54 -0
- data/lib/surge_api/models/contact_opted_out_webhook_event.rb +54 -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/unwrap_webhook_event.rb +5 -1
- data/lib/surge_api/models.rb +8 -0
- data/lib/surge_api/resources/campaigns.rb +7 -18
- data/lib/surge_api/resources/messages.rb +7 -12
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +4 -0
- data/rbi/surge_api/file_part.rbi +1 -1
- 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/contact_opted_in_webhook_event.rbi +95 -0
- data/rbi/surge_api/models/contact_opted_out_webhook_event.rbi +95 -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/unwrap_webhook_event.rbi +2 -0
- data/rbi/surge_api/models.rbi +8 -0
- data/rbi/surge_api/resources/campaigns.rbi +4 -89
- data/rbi/surge_api/resources/messages.rbi +5 -22
- data/rbi/surge_api/resources/webhooks.rbi +2 -0
- data/sig/surge_api/file_part.rbs +1 -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/contact_opted_in_webhook_event.rbs +45 -0
- data/sig/surge_api/models/contact_opted_out_webhook_event.rbs +45 -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/unwrap_webhook_event.rbs +2 -0
- data/sig/surge_api/models.rbs +8 -0
- data/sig/surge_api/resources/campaigns.rbs +1 -9
- data/sig/surge_api/resources/messages.rbs +1 -6
- data/sig/surge_api/resources/webhooks.rbs +2 -0
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc8267ebb4682d2884a0ed0a4ff0c1ec89a6e76988ee96cbdd794bc9ee745ef2
|
|
4
|
+
data.tar.gz: fcefd6289c6dae43967d4eac94bbc87299ab03c52e335f611949a4d6169c7c79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22b712d8f2898bca0a102de847125c57cc1feb4771c23db55de558616b6dba9de87a1915e05e44c23ca619872f9a9d0f70df9c8f522e8f867048fd43a53cb660
|
|
7
|
+
data.tar.gz: '025923bb1e6f82ecbe04e30ee9f849369e8ddd76dd73f729dfe046220ffc044633cc7f1d15d286b6d37c2b5d6d641bae27e2cb558499e4c6271133997ba8444f'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1 (2025-10-31)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.0...v0.2.1](https://github.com/surgeapi/ruby-sdk/compare/v0.2.0...v0.2.1)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** create externally registered campaigns ([c01b26e](https://github.com/surgeapi/ruby-sdk/commit/c01b26e3f26a8b827254d128a7c776d79850cbf5))
|
|
10
|
+
* handle thread interrupts in the core HTTP client ([4362499](https://github.com/surgeapi/ruby-sdk/commit/43624993a62c67679d1f5260653517aebd5d687e))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* absolutely qualified uris should always override the default ([58fa7be](https://github.com/surgeapi/ruby-sdk/commit/58fa7bea703edecd59fe69630191a9cb83ece9d0))
|
|
16
|
+
* should not reuse buffers for `IO.copy_stream` interop ([52ce0fd](https://github.com/surgeapi/ruby-sdk/commit/52ce0fd6a7039be032e2f884636215ac1fb88223))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Documentation
|
|
20
|
+
|
|
21
|
+
* **api:** add context around organization contacts ([88c764d](https://github.com/surgeapi/ruby-sdk/commit/88c764d18d70361d1a7f43e22a46d26082f24227))
|
|
22
|
+
|
|
23
|
+
## 0.2.0 (2025-10-09)
|
|
24
|
+
|
|
25
|
+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/surgeapi/ruby-sdk/compare/v0.1.0...v0.2.0)
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **api:** api update ([8a7eeeb](https://github.com/surgeapi/ruby-sdk/commit/8a7eeeb4c5248d0f0aa4da399c45d2763b98ba3b))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* always send `filename=...` for multipart requests where a file is expected ([28bdedf](https://github.com/surgeapi/ruby-sdk/commit/28bdedfba8e9bef43abf39e08169bc2bf2edb0e8))
|
|
35
|
+
* coroutine leaks from connection pool ([239043f](https://github.com/surgeapi/ruby-sdk/commit/239043f74e12856fb8e6b2a477ea9bf35945f2f2))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Chores
|
|
39
|
+
|
|
40
|
+
* ignore linter error for tests having large collections ([4d89802](https://github.com/surgeapi/ruby-sdk/commit/4d898024ffae04e4f24591b1c54a922e1b6c51f4))
|
|
41
|
+
|
|
3
42
|
## 0.1.0 (2025-09-26)
|
|
4
43
|
|
|
5
44
|
Full Changelog: [v0.0.1...v0.1.0](https://github.com/surgeapi/ruby-sdk/compare/v0.0.1...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 "surge_api", "~> 0.1
|
|
20
|
+
gem "surge_api", "~> 0.2.1"
|
|
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
|
|
data/lib/surge_api/file_part.rb
CHANGED
|
@@ -38,18 +38,21 @@ module SurgeAPI
|
|
|
38
38
|
def to_yaml(*a) = read.to_yaml(*a)
|
|
39
39
|
|
|
40
40
|
# @param content [Pathname, StringIO, IO, String]
|
|
41
|
-
# @param filename [String, nil]
|
|
41
|
+
# @param filename [Pathname, String, nil]
|
|
42
42
|
# @param content_type [String, nil]
|
|
43
43
|
def initialize(content, filename: nil, content_type: nil)
|
|
44
|
-
@
|
|
44
|
+
@content_type = content_type
|
|
45
45
|
@filename =
|
|
46
|
-
case content
|
|
47
|
-
in Pathname
|
|
48
|
-
|
|
46
|
+
case [filename, (@content = content)]
|
|
47
|
+
in [String | Pathname, _]
|
|
48
|
+
::File.basename(filename)
|
|
49
|
+
in [nil, Pathname]
|
|
50
|
+
content.basename.to_path
|
|
51
|
+
in [nil, IO]
|
|
52
|
+
content.to_path
|
|
49
53
|
else
|
|
50
|
-
filename
|
|
54
|
+
filename
|
|
51
55
|
end
|
|
52
|
-
@content_type = content_type
|
|
53
56
|
end
|
|
54
57
|
end
|
|
55
58
|
end
|
|
@@ -128,37 +128,47 @@ module SurgeAPI
|
|
|
128
128
|
url, deadline = request.fetch_values(:url, :deadline)
|
|
129
129
|
|
|
130
130
|
req = nil
|
|
131
|
-
eof = false
|
|
132
131
|
finished = false
|
|
133
|
-
closing = nil
|
|
134
132
|
|
|
135
133
|
# rubocop:disable Metrics/BlockLength
|
|
136
134
|
enum = Enumerator.new do |y|
|
|
137
|
-
|
|
138
|
-
next if finished
|
|
139
|
-
|
|
140
|
-
req, closing = self.class.build_request(request) do
|
|
141
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
|
145
|
-
unless conn.started?
|
|
146
|
-
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
|
|
147
|
-
conn.start
|
|
148
|
-
end
|
|
135
|
+
next if finished
|
|
149
136
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
with_pool(url, deadline: deadline) do |conn|
|
|
138
|
+
eof = false
|
|
139
|
+
closing = nil
|
|
140
|
+
::Thread.handle_interrupt(Object => :never) do
|
|
141
|
+
::Thread.handle_interrupt(Object => :immediate) do
|
|
142
|
+
req, closing = self.class.build_request(request) do
|
|
143
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
144
|
+
end
|
|
154
145
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
147
|
+
unless conn.started?
|
|
148
|
+
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
|
|
149
|
+
conn.start
|
|
150
|
+
end
|
|
158
151
|
|
|
159
152
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
153
|
+
conn.request(req) do |rsp|
|
|
154
|
+
y << [req, rsp]
|
|
155
|
+
break if finished
|
|
156
|
+
|
|
157
|
+
rsp.read_body do |bytes|
|
|
158
|
+
y << bytes.force_encoding(Encoding::BINARY)
|
|
159
|
+
break if finished
|
|
160
|
+
|
|
161
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
162
|
+
end
|
|
163
|
+
eof = true
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
ensure
|
|
167
|
+
begin
|
|
168
|
+
conn.finish if !eof && conn&.started?
|
|
169
|
+
ensure
|
|
170
|
+
closing&.call
|
|
160
171
|
end
|
|
161
|
-
eof = true
|
|
162
172
|
end
|
|
163
173
|
end
|
|
164
174
|
rescue Timeout::Error
|
|
@@ -168,17 +178,10 @@ module SurgeAPI
|
|
|
168
178
|
end
|
|
169
179
|
# rubocop:enable Metrics/BlockLength
|
|
170
180
|
|
|
171
|
-
|
|
181
|
+
_, response = enum.next
|
|
172
182
|
body = SurgeAPI::Internal::Util.fused_enum(enum, external: true) do
|
|
173
183
|
finished = true
|
|
174
|
-
|
|
175
|
-
enum.next
|
|
176
|
-
rescue StopIteration
|
|
177
|
-
nil
|
|
178
|
-
end
|
|
179
|
-
ensure
|
|
180
|
-
conn.finish if !eof && conn&.started?
|
|
181
|
-
closing&.call
|
|
184
|
+
loop { enum.next }
|
|
182
185
|
end
|
|
183
186
|
[Integer(response.code), response, body]
|
|
184
187
|
end
|
|
@@ -82,17 +82,20 @@ module SurgeAPI
|
|
|
82
82
|
#
|
|
83
83
|
# @return [Pathname, StringIO, IO, String, Object]
|
|
84
84
|
def dump(value, state:)
|
|
85
|
-
# rubocop:disable Lint/DuplicateBranch
|
|
86
85
|
case value
|
|
86
|
+
in StringIO | String
|
|
87
|
+
# https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
|
|
88
|
+
# while not required, a filename is recommended, and in practice many servers do expect this
|
|
89
|
+
SurgeAPI::FilePart.new(value, filename: "upload")
|
|
87
90
|
in IO
|
|
88
91
|
state[:can_retry] = false
|
|
92
|
+
value.to_path.nil? ? SurgeAPI::FilePart.new(value, filename: "upload") : value
|
|
89
93
|
in SurgeAPI::FilePart if value.content.is_a?(IO)
|
|
90
94
|
state[:can_retry] = false
|
|
95
|
+
value
|
|
91
96
|
else
|
|
97
|
+
value
|
|
92
98
|
end
|
|
93
|
-
# rubocop:enable Lint/DuplicateBranch
|
|
94
|
-
|
|
95
|
-
value
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
# @api private
|
|
@@ -12,7 +12,7 @@ module SurgeAPI
|
|
|
12
12
|
# puts(unwrap_webhook_event.account_id)
|
|
13
13
|
# when SurgeAPI::CampaignApprovedWebhookEvent
|
|
14
14
|
# puts(unwrap_webhook_event.data)
|
|
15
|
-
# when SurgeAPI::
|
|
15
|
+
# when SurgeAPI::ContactOptedInWebhookEvent
|
|
16
16
|
# puts(unwrap_webhook_event.timestamp)
|
|
17
17
|
# else
|
|
18
18
|
# puts(unwrap_webhook_event)
|
|
@@ -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
|
#
|