surge_api 0.2.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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +12 -63
  4. data/lib/surge_api/internal/transport/pooled_net_requester.rb +30 -24
  5. data/lib/surge_api/internal/util.rb +5 -5
  6. data/lib/surge_api/models/account_create_params.rb +13 -6
  7. data/lib/surge_api/models/account_update_params.rb +13 -6
  8. data/lib/surge_api/models/campaign_create_params.rb +7 -183
  9. data/lib/surge_api/models/campaign_params.rb +228 -0
  10. data/lib/surge_api/models/message_create_params.rb +8 -134
  11. data/lib/surge_api/models/message_params.rb +216 -0
  12. data/lib/surge_api/models.rb +4 -0
  13. data/lib/surge_api/resources/campaigns.rb +7 -18
  14. data/lib/surge_api/resources/messages.rb +7 -12
  15. data/lib/surge_api/version.rb +1 -1
  16. data/lib/surge_api.rb +2 -0
  17. data/rbi/surge_api/models/account_create_params.rbi +19 -8
  18. data/rbi/surge_api/models/account_update_params.rbi +19 -8
  19. data/rbi/surge_api/models/campaign_create_params.rbi +20 -346
  20. data/rbi/surge_api/models/campaign_params.rbi +481 -0
  21. data/rbi/surge_api/models/message_create_params.rbi +24 -243
  22. data/rbi/surge_api/models/message_params.rbi +430 -0
  23. data/rbi/surge_api/models.rbi +4 -0
  24. data/rbi/surge_api/resources/campaigns.rbi +4 -89
  25. data/rbi/surge_api/resources/messages.rbi +5 -22
  26. data/sig/surge_api/models/campaign_create_params.rbs +7 -106
  27. data/sig/surge_api/models/campaign_params.rbs +141 -0
  28. data/sig/surge_api/models/message_create_params.rbs +7 -119
  29. data/sig/surge_api/models/message_params.rbs +189 -0
  30. data/sig/surge_api/models.rbs +4 -0
  31. data/sig/surge_api/resources/campaigns.rbs +1 -9
  32. data/sig/surge_api/resources/messages.rbs +1 -6
  33. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71252990f4c5eb46dec5222b3dd1307f1c347b59ef3a2c7a1aa6ac646555c920
4
- data.tar.gz: 671de5440b15ba3455652ffcf8b8f0752c6e4827750a99dcb288bfa26cf65acd
3
+ metadata.gz: cc8267ebb4682d2884a0ed0a4ff0c1ec89a6e76988ee96cbdd794bc9ee745ef2
4
+ data.tar.gz: fcefd6289c6dae43967d4eac94bbc87299ab03c52e335f611949a4d6169c7c79
5
5
  SHA512:
6
- metadata.gz: 4595e79a8c3fccbdf83430c0242b378b70acb7f52471a5177e9b78542889f310c62c8d5a6d41515a8cfd6ef72df9a298428274645b0b38f8f61eeb42ea0a3c57
7
- data.tar.gz: 538a4232414a89f66dd781f0bda3a4e8257cdf9a88d7a07d3efef95345a26a93f895d696b54a6ff3c987f29fac2d62abda9e9c44532786d2e145d8b24c3da6b7
6
+ metadata.gz: 22b712d8f2898bca0a102de847125c57cc1feb4771c23db55de558616b6dba9de87a1915e05e44c23ca619872f9a9d0f70df9c8f522e8f867048fd43a53cb660
7
+ data.tar.gz: '025923bb1e6f82ecbe04e30ee9f849369e8ddd76dd73f729dfe046220ffc044633cc7f1d15d286b6d37c2b5d6d641bae27e2cb558499e4c6271133997ba8444f'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
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
+
3
23
  ## 0.2.0 (2025-10-09)
4
24
 
5
25
  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.2.0"
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::CampaignCreateParams::Volume::HIGH)
201
+ puts(SurgeAPI::CampaignParams::Volume::HIGH)
253
202
 
254
- # Revealed type: `T.all(SurgeAPI::CampaignCreateParams::Volume, Symbol)`
255
- T.reveal_type(SurgeAPI::CampaignCreateParams::Volume::HIGH)
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::CampaignCreateParams::Volume::HIGH,
212
+ volume: SurgeAPI::CampaignParams::Volume::HIGH,
264
213
  # …
265
214
  )
266
215
 
@@ -128,40 +128,48 @@ 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
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
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
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
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
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
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise SurgeAPI::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module SurgeAPI
174
182
  body = SurgeAPI::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -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
- parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
350
- override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
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 << buf.replace(_1)
479
- buf.bytesize
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 the carriers have
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 the carriers have a
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 the carriers have
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 the carriers have
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 the carriers have a
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 the carriers have
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
  #
@@ -7,196 +7,20 @@ module SurgeAPI
7
7
  extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
8
  include SurgeAPI::Internal::Type::RequestParameters
9
9
 
10
- # @!attribute consent_flow
11
- # A string explaining the method through which end users will opt in to receive
12
- # messages from the brand. Typically this should include URLs for opt-in forms or
13
- # screenshots that might be helpful in explaining the flow to someone unfamiliar
14
- # with the organization's purpose.
10
+ # @!attribute campaign_params
11
+ # Parameters for creating a new campaign. Either provide full campaign details or
12
+ # import using a TCR ID.
15
13
  #
16
- # @return [String]
17
- required :consent_flow, String
14
+ # @return [SurgeAPI::Models::CampaignParams::StandardCampaignParams, SurgeAPI::Models::CampaignParams::ExternalCampaignParams]
15
+ required :campaign_params, union: -> { SurgeAPI::CampaignParams }
18
16
 
19
- # @!attribute description
20
- # An explanation of the organization's purpose and how it will be using text
21
- # messaging to accomplish that purpose.
22
- #
23
- # @return [String]
24
- required :description, String
25
-
26
- # @!attribute message_samples
27
- # An array of 2-5 strings with examples of the messages that will be sent from
28
- # this campaign. Typically the first sample should be a compliance message like
29
- # `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
30
- # These samples don't necessarily need to be the only templates that will be used
31
- # for the campaign, but they should reflect the purpose of the messages that will
32
- # be sent. Any variable content can be reflected by wrapping it in square brackets
33
- # like `[customer name]`.
34
- #
35
- # @return [Array<String>]
36
- required :message_samples, SurgeAPI::Internal::Type::ArrayOf[String]
37
-
38
- # @!attribute privacy_policy_url
39
- # The URL of the privacy policy for the brand in question. This may be a shared
40
- # privacy policy if it's the policy that is displayed to end users when they opt
41
- # in to messaging.
42
- #
43
- # @return [String]
44
- required :privacy_policy_url, String
45
-
46
- # @!attribute use_cases
47
- # A list containing 1-5 types of messages that will be sent with this campaign.
48
- #
49
- # The following use cases are typically available to all brands:
50
- #
51
- # - `account_notification` - For sending reminders, alerts, and general
52
- # account-related notifications like booking confirmations or appointment
53
- # reminders.
54
- # - `customer_care` - For account support, troubleshooting, and general customer
55
- # service communication.
56
- # - `delivery_notification` - For notifying customers about the status of product
57
- # or service deliveries.
58
- # - `fraud_alert` - For warning customers about suspicious or potentially
59
- # fraudulent activity.
60
- # - `higher_education` - For messaging related to colleges, universities, and
61
- # school districts outside of K–12.
62
- # - `marketing` - For promotional or advertising messages intended to market
63
- # products or services.
64
- # - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
65
- # - `public_service_announcement` - For raising awareness about social issues or
66
- # important public information.
67
- # - `security_alert` - For alerts related to potential security breaches or
68
- # compromised systems requiring user action.
69
- # - `two_factor_authentication` - For sending one-time passwords or verification
70
- # codes for login or password reset.
71
- #
72
- # For access to special use cases not shown here, reach out to support@surge.app.
73
- #
74
- # @return [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::UseCase>]
75
- required :use_cases,
76
- -> { SurgeAPI::Internal::Type::ArrayOf[enum: SurgeAPI::CampaignCreateParams::UseCase] }
77
-
78
- # @!attribute volume
79
- # This will be one of the following:
80
- #
81
- # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
82
- # T-Mobile customers each day. In this case your platform will be charged for
83
- # the setup fee for a low volume number upon receipt of the API request.
84
- # - `high` - The campaign will be allowed to send up to 200k SMS segments to
85
- # T-Mobile customers each day, depending on the trust score assigned by The
86
- # Campaign Registry. Your platform will be charged for the setup fee for a high
87
- # volume number upon receipt of the API request, and phone numbers will be
88
- # charged as high volume numbers going forward.
89
- #
90
- # @return [Symbol, SurgeAPI::Models::CampaignCreateParams::Volume]
91
- required :volume, enum: -> { SurgeAPI::CampaignCreateParams::Volume }
92
-
93
- # @!attribute includes
94
- # A list of properties that this campaign should include. These properties can be
95
- # any of the following values:
96
- #
97
- # - `links` - whether the campaign might send links in messages
98
- # - `phone_numbers` - whether the campaign might send phone numbers in messages
99
- # - `age_gated` - whether the campaign contains age gated content (controlled
100
- # substances or adult content)
101
- # - `direct_lending` - whether the campaign contains content related to direct
102
- # lending or other loan arrangements
103
- #
104
- # @return [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::Include>, nil]
105
- optional :includes,
106
- -> { SurgeAPI::Internal::Type::ArrayOf[enum: SurgeAPI::CampaignCreateParams::Include] }
107
-
108
- # @!attribute link_sample
109
- # A sample link that might be sent by this campaign. If links from other domains
110
- # are sent through this campaign, they are much more likely to be filtered by the
111
- # carriers. If link shortening is enabled for the account, the link shortener URL
112
- # will be used instead of what is provided. Reach out to support if you would like
113
- # to disable automatic link shortening.
114
- #
115
- # @return [String, nil]
116
- optional :link_sample, String
117
-
118
- # @!attribute terms_and_conditions_url
119
- # The URL of the terms and conditions presented to end users when they opt in to
120
- # messaging. These terms and conditions may be shared among all of a platform's
121
- # customers if they're the terms that are presented to end users when they opt in
122
- # to messaging.
123
- #
124
- # @return [String, nil]
125
- optional :terms_and_conditions_url, String
126
-
127
- # @!method initialize(consent_flow:, description:, message_samples:, privacy_policy_url:, use_cases:, volume:, includes: nil, link_sample: nil, terms_and_conditions_url: nil, request_options: {})
17
+ # @!method initialize(campaign_params:, request_options: {})
128
18
  # Some parameter documentations has been truncated, see
129
19
  # {SurgeAPI::Models::CampaignCreateParams} for more details.
130
20
  #
131
- # @param consent_flow [String] A string explaining the method through which end users will opt in to receive me
132
- #
133
- # @param description [String] An explanation of the organization's purpose and how it will be using text messa
134
- #
135
- # @param message_samples [Array<String>] An array of 2-5 strings with examples of the messages that will be sent from thi
136
- #
137
- # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
138
- #
139
- # @param use_cases [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
140
- #
141
- # @param volume [Symbol, SurgeAPI::Models::CampaignCreateParams::Volume] This will be one of the following:
142
- #
143
- # @param includes [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::Include>] A list of properties that this campaign should include. These properties can be
144
- #
145
- # @param link_sample [String] A sample link that might be sent by this campaign. If links from other domains a
146
- #
147
- # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
21
+ # @param campaign_params [SurgeAPI::Models::CampaignParams::StandardCampaignParams, SurgeAPI::Models::CampaignParams::ExternalCampaignParams] Parameters for creating a new campaign. Either provide full campaign details or
148
22
  #
149
23
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
150
-
151
- module UseCase
152
- extend SurgeAPI::Internal::Type::Enum
153
-
154
- ACCOUNT_NOTIFICATION = :account_notification
155
- CUSTOMER_CARE = :customer_care
156
- DELIVERY_NOTIFICATION = :delivery_notification
157
- FRAUD_ALERT = :fraud_alert
158
- HIGHER_EDUCATION = :higher_education
159
- MARKETING = :marketing
160
- POLLING_VOTING = :polling_voting
161
- PUBLIC_SERVICE_ANNOUNCEMENT = :public_service_announcement
162
- SECURITY_ALERT = :security_alert
163
- TWO_FACTOR_AUTHENTICATION = :two_factor_authentication
164
-
165
- # @!method self.values
166
- # @return [Array<Symbol>]
167
- end
168
-
169
- # This will be one of the following:
170
- #
171
- # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
172
- # T-Mobile customers each day. In this case your platform will be charged for
173
- # the setup fee for a low volume number upon receipt of the API request.
174
- # - `high` - The campaign will be allowed to send up to 200k SMS segments to
175
- # T-Mobile customers each day, depending on the trust score assigned by The
176
- # Campaign Registry. Your platform will be charged for the setup fee for a high
177
- # volume number upon receipt of the API request, and phone numbers will be
178
- # charged as high volume numbers going forward.
179
- module Volume
180
- extend SurgeAPI::Internal::Type::Enum
181
-
182
- HIGH = :high
183
- LOW = :low
184
-
185
- # @!method self.values
186
- # @return [Array<Symbol>]
187
- end
188
-
189
- module Include
190
- extend SurgeAPI::Internal::Type::Enum
191
-
192
- LINKS = :links
193
- PHONE_NUMBERS = :phone_numbers
194
- AGE_GATED = :age_gated
195
- DIRECT_LENDING = :direct_lending
196
-
197
- # @!method self.values
198
- # @return [Array<Symbol>]
199
- end
200
24
  end
201
25
  end
202
26
  end