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
@@ -0,0 +1,481 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # Parameters for creating a new campaign. Either provide full campaign details or
6
+ # import using a TCR ID.
7
+ module CampaignParams
8
+ extend SurgeAPI::Internal::Type::Union
9
+
10
+ Variants =
11
+ T.type_alias do
12
+ T.any(
13
+ SurgeAPI::CampaignParams::StandardCampaignParams,
14
+ SurgeAPI::CampaignParams::ExternalCampaignParams
15
+ )
16
+ end
17
+
18
+ class StandardCampaignParams < SurgeAPI::Internal::Type::BaseModel
19
+ OrHash =
20
+ T.type_alias do
21
+ T.any(
22
+ SurgeAPI::CampaignParams::StandardCampaignParams,
23
+ SurgeAPI::Internal::AnyHash
24
+ )
25
+ end
26
+
27
+ # A string explaining the method through which end users will opt in to receive
28
+ # messages from the brand. Typically this should include URLs for opt-in forms or
29
+ # screenshots that might be helpful in explaining the flow to someone unfamiliar
30
+ # with the organization's purpose.
31
+ sig { returns(String) }
32
+ attr_accessor :consent_flow
33
+
34
+ # An explanation of the organization's purpose and how it will be using text
35
+ # messaging to accomplish that purpose.
36
+ sig { returns(String) }
37
+ attr_accessor :description
38
+
39
+ # An array of 2-5 strings with examples of the messages that will be sent from
40
+ # this campaign. Typically the first sample should be a compliance message like
41
+ # `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
42
+ # These samples don't necessarily need to be the only templates that will be used
43
+ # for the campaign, but they should reflect the purpose of the messages that will
44
+ # be sent. Any variable content can be reflected by wrapping it in square brackets
45
+ # like `[customer name]`.
46
+ sig { returns(T::Array[String]) }
47
+ attr_accessor :message_samples
48
+
49
+ # The URL of the privacy policy for the brand in question. This may be a shared
50
+ # privacy policy if it's the policy that is displayed to end users when they opt
51
+ # in to messaging.
52
+ sig { returns(String) }
53
+ attr_accessor :privacy_policy_url
54
+
55
+ # A list containing 1-5 types of messages that will be sent with this campaign.
56
+ #
57
+ # The following use cases are typically available to all brands:
58
+ #
59
+ # - `account_notification` - For sending reminders, alerts, and general
60
+ # account-related notifications like booking confirmations or appointment
61
+ # reminders.
62
+ # - `customer_care` - For account support, troubleshooting, and general customer
63
+ # service communication.
64
+ # - `delivery_notification` - For notifying customers about the status of product
65
+ # or service deliveries.
66
+ # - `fraud_alert` - For warning customers about suspicious or potentially
67
+ # fraudulent activity.
68
+ # - `higher_education` - For messaging related to colleges, universities, and
69
+ # school districts outside of K–12.
70
+ # - `marketing` - For promotional or advertising messages intended to market
71
+ # products or services.
72
+ # - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
73
+ # - `public_service_announcement` - For raising awareness about social issues or
74
+ # important public information.
75
+ # - `security_alert` - For alerts related to potential security breaches or
76
+ # compromised systems requiring user action.
77
+ # - `two_factor_authentication` - For sending one-time passwords or verification
78
+ # codes for login or password reset.
79
+ #
80
+ # For access to special use cases not shown here, reach out to support@surge.app.
81
+ sig do
82
+ returns(
83
+ T::Array[
84
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::OrSymbol
85
+ ]
86
+ )
87
+ end
88
+ attr_accessor :use_cases
89
+
90
+ # This will be one of the following:
91
+ #
92
+ # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
93
+ # T-Mobile customers each day. In this case your platform will be charged for
94
+ # the setup fee for a low volume number upon receipt of the API request.
95
+ # - `high` - The campaign will be allowed to send up to 200k SMS segments to
96
+ # T-Mobile customers each day, depending on the trust score assigned by The
97
+ # Campaign Registry. Your platform will be charged for the setup fee for a high
98
+ # volume number upon receipt of the API request, and phone numbers will be
99
+ # charged as high volume numbers going forward.
100
+ sig do
101
+ returns(
102
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::OrSymbol
103
+ )
104
+ end
105
+ attr_accessor :volume
106
+
107
+ # A list of properties that this campaign should include. These properties can be
108
+ # any of the following values:
109
+ #
110
+ # - `links` - whether the campaign might send links in messages
111
+ # - `phone_numbers` - whether the campaign might send phone numbers in messages
112
+ # - `age_gated` - whether the campaign contains age gated content (controlled
113
+ # substances or adult content)
114
+ # - `direct_lending` - whether the campaign contains content related to direct
115
+ # lending or other loan arrangements
116
+ sig do
117
+ returns(
118
+ T.nilable(
119
+ T::Array[
120
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::OrSymbol
121
+ ]
122
+ )
123
+ )
124
+ end
125
+ attr_reader :includes
126
+
127
+ sig do
128
+ params(
129
+ includes:
130
+ T::Array[
131
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::OrSymbol
132
+ ]
133
+ ).void
134
+ end
135
+ attr_writer :includes
136
+
137
+ # A sample link that might be sent by this campaign. If links from other domains
138
+ # are sent through this campaign, they are much more likely to be filtered by the
139
+ # carriers. If link shortening is enabled for the account, the link shortener URL
140
+ # will be used instead of what is provided. Reach out to support if you would like
141
+ # to disable automatic link shortening.
142
+ sig { returns(T.nilable(String)) }
143
+ attr_reader :link_sample
144
+
145
+ sig { params(link_sample: String).void }
146
+ attr_writer :link_sample
147
+
148
+ # The URL of the terms and conditions presented to end users when they opt in to
149
+ # messaging. These terms and conditions may be shared among all of a platform's
150
+ # customers if they're the terms that are presented to end users when they opt in
151
+ # to messaging.
152
+ sig { returns(T.nilable(String)) }
153
+ attr_reader :terms_and_conditions_url
154
+
155
+ sig { params(terms_and_conditions_url: String).void }
156
+ attr_writer :terms_and_conditions_url
157
+
158
+ # Full campaign details for standard registration through Surge
159
+ sig do
160
+ params(
161
+ consent_flow: String,
162
+ description: String,
163
+ message_samples: T::Array[String],
164
+ privacy_policy_url: String,
165
+ use_cases:
166
+ T::Array[
167
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::OrSymbol
168
+ ],
169
+ volume:
170
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::OrSymbol,
171
+ includes:
172
+ T::Array[
173
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::OrSymbol
174
+ ],
175
+ link_sample: String,
176
+ terms_and_conditions_url: String
177
+ ).returns(T.attached_class)
178
+ end
179
+ def self.new(
180
+ # A string explaining the method through which end users will opt in to receive
181
+ # messages from the brand. Typically this should include URLs for opt-in forms or
182
+ # screenshots that might be helpful in explaining the flow to someone unfamiliar
183
+ # with the organization's purpose.
184
+ consent_flow:,
185
+ # An explanation of the organization's purpose and how it will be using text
186
+ # messaging to accomplish that purpose.
187
+ description:,
188
+ # An array of 2-5 strings with examples of the messages that will be sent from
189
+ # this campaign. Typically the first sample should be a compliance message like
190
+ # `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
191
+ # These samples don't necessarily need to be the only templates that will be used
192
+ # for the campaign, but they should reflect the purpose of the messages that will
193
+ # be sent. Any variable content can be reflected by wrapping it in square brackets
194
+ # like `[customer name]`.
195
+ message_samples:,
196
+ # The URL of the privacy policy for the brand in question. This may be a shared
197
+ # privacy policy if it's the policy that is displayed to end users when they opt
198
+ # in to messaging.
199
+ privacy_policy_url:,
200
+ # A list containing 1-5 types of messages that will be sent with this campaign.
201
+ #
202
+ # The following use cases are typically available to all brands:
203
+ #
204
+ # - `account_notification` - For sending reminders, alerts, and general
205
+ # account-related notifications like booking confirmations or appointment
206
+ # reminders.
207
+ # - `customer_care` - For account support, troubleshooting, and general customer
208
+ # service communication.
209
+ # - `delivery_notification` - For notifying customers about the status of product
210
+ # or service deliveries.
211
+ # - `fraud_alert` - For warning customers about suspicious or potentially
212
+ # fraudulent activity.
213
+ # - `higher_education` - For messaging related to colleges, universities, and
214
+ # school districts outside of K–12.
215
+ # - `marketing` - For promotional or advertising messages intended to market
216
+ # products or services.
217
+ # - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
218
+ # - `public_service_announcement` - For raising awareness about social issues or
219
+ # important public information.
220
+ # - `security_alert` - For alerts related to potential security breaches or
221
+ # compromised systems requiring user action.
222
+ # - `two_factor_authentication` - For sending one-time passwords or verification
223
+ # codes for login or password reset.
224
+ #
225
+ # For access to special use cases not shown here, reach out to support@surge.app.
226
+ use_cases:,
227
+ # This will be one of the following:
228
+ #
229
+ # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
230
+ # T-Mobile customers each day. In this case your platform will be charged for
231
+ # the setup fee for a low volume number upon receipt of the API request.
232
+ # - `high` - The campaign will be allowed to send up to 200k SMS segments to
233
+ # T-Mobile customers each day, depending on the trust score assigned by The
234
+ # Campaign Registry. Your platform will be charged for the setup fee for a high
235
+ # volume number upon receipt of the API request, and phone numbers will be
236
+ # charged as high volume numbers going forward.
237
+ volume:,
238
+ # A list of properties that this campaign should include. These properties can be
239
+ # any of the following values:
240
+ #
241
+ # - `links` - whether the campaign might send links in messages
242
+ # - `phone_numbers` - whether the campaign might send phone numbers in messages
243
+ # - `age_gated` - whether the campaign contains age gated content (controlled
244
+ # substances or adult content)
245
+ # - `direct_lending` - whether the campaign contains content related to direct
246
+ # lending or other loan arrangements
247
+ includes: nil,
248
+ # A sample link that might be sent by this campaign. If links from other domains
249
+ # are sent through this campaign, they are much more likely to be filtered by the
250
+ # carriers. If link shortening is enabled for the account, the link shortener URL
251
+ # will be used instead of what is provided. Reach out to support if you would like
252
+ # to disable automatic link shortening.
253
+ link_sample: nil,
254
+ # The URL of the terms and conditions presented to end users when they opt in to
255
+ # messaging. These terms and conditions may be shared among all of a platform's
256
+ # customers if they're the terms that are presented to end users when they opt in
257
+ # to messaging.
258
+ terms_and_conditions_url: nil
259
+ )
260
+ end
261
+
262
+ sig do
263
+ override.returns(
264
+ {
265
+ consent_flow: String,
266
+ description: String,
267
+ message_samples: T::Array[String],
268
+ privacy_policy_url: String,
269
+ use_cases:
270
+ T::Array[
271
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::OrSymbol
272
+ ],
273
+ volume:
274
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::OrSymbol,
275
+ includes:
276
+ T::Array[
277
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::OrSymbol
278
+ ],
279
+ link_sample: String,
280
+ terms_and_conditions_url: String
281
+ }
282
+ )
283
+ end
284
+ def to_hash
285
+ end
286
+
287
+ module UseCase
288
+ extend SurgeAPI::Internal::Type::Enum
289
+
290
+ TaggedSymbol =
291
+ T.type_alias do
292
+ T.all(
293
+ Symbol,
294
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase
295
+ )
296
+ end
297
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
298
+
299
+ ACCOUNT_NOTIFICATION =
300
+ T.let(
301
+ :account_notification,
302
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
303
+ )
304
+ CUSTOMER_CARE =
305
+ T.let(
306
+ :customer_care,
307
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
308
+ )
309
+ DELIVERY_NOTIFICATION =
310
+ T.let(
311
+ :delivery_notification,
312
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
313
+ )
314
+ FRAUD_ALERT =
315
+ T.let(
316
+ :fraud_alert,
317
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
318
+ )
319
+ HIGHER_EDUCATION =
320
+ T.let(
321
+ :higher_education,
322
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
323
+ )
324
+ MARKETING =
325
+ T.let(
326
+ :marketing,
327
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
328
+ )
329
+ POLLING_VOTING =
330
+ T.let(
331
+ :polling_voting,
332
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
333
+ )
334
+ PUBLIC_SERVICE_ANNOUNCEMENT =
335
+ T.let(
336
+ :public_service_announcement,
337
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
338
+ )
339
+ SECURITY_ALERT =
340
+ T.let(
341
+ :security_alert,
342
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
343
+ )
344
+ TWO_FACTOR_AUTHENTICATION =
345
+ T.let(
346
+ :two_factor_authentication,
347
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
348
+ )
349
+
350
+ sig do
351
+ override.returns(
352
+ T::Array[
353
+ SurgeAPI::CampaignParams::StandardCampaignParams::UseCase::TaggedSymbol
354
+ ]
355
+ )
356
+ end
357
+ def self.values
358
+ end
359
+ end
360
+
361
+ # This will be one of the following:
362
+ #
363
+ # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
364
+ # T-Mobile customers each day. In this case your platform will be charged for
365
+ # the setup fee for a low volume number upon receipt of the API request.
366
+ # - `high` - The campaign will be allowed to send up to 200k SMS segments to
367
+ # T-Mobile customers each day, depending on the trust score assigned by The
368
+ # Campaign Registry. Your platform will be charged for the setup fee for a high
369
+ # volume number upon receipt of the API request, and phone numbers will be
370
+ # charged as high volume numbers going forward.
371
+ module Volume
372
+ extend SurgeAPI::Internal::Type::Enum
373
+
374
+ TaggedSymbol =
375
+ T.type_alias do
376
+ T.all(
377
+ Symbol,
378
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume
379
+ )
380
+ end
381
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
382
+
383
+ HIGH =
384
+ T.let(
385
+ :high,
386
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::TaggedSymbol
387
+ )
388
+ LOW =
389
+ T.let(
390
+ :low,
391
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::TaggedSymbol
392
+ )
393
+
394
+ sig do
395
+ override.returns(
396
+ T::Array[
397
+ SurgeAPI::CampaignParams::StandardCampaignParams::Volume::TaggedSymbol
398
+ ]
399
+ )
400
+ end
401
+ def self.values
402
+ end
403
+ end
404
+
405
+ module Include
406
+ extend SurgeAPI::Internal::Type::Enum
407
+
408
+ TaggedSymbol =
409
+ T.type_alias do
410
+ T.all(
411
+ Symbol,
412
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include
413
+ )
414
+ end
415
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
416
+
417
+ LINKS =
418
+ T.let(
419
+ :links,
420
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::TaggedSymbol
421
+ )
422
+ PHONE_NUMBERS =
423
+ T.let(
424
+ :phone_numbers,
425
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::TaggedSymbol
426
+ )
427
+ AGE_GATED =
428
+ T.let(
429
+ :age_gated,
430
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::TaggedSymbol
431
+ )
432
+ DIRECT_LENDING =
433
+ T.let(
434
+ :direct_lending,
435
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::TaggedSymbol
436
+ )
437
+
438
+ sig do
439
+ override.returns(
440
+ T::Array[
441
+ SurgeAPI::CampaignParams::StandardCampaignParams::Include::TaggedSymbol
442
+ ]
443
+ )
444
+ end
445
+ def self.values
446
+ end
447
+ end
448
+ end
449
+
450
+ class ExternalCampaignParams < SurgeAPI::Internal::Type::BaseModel
451
+ OrHash =
452
+ T.type_alias do
453
+ T.any(
454
+ SurgeAPI::CampaignParams::ExternalCampaignParams,
455
+ SurgeAPI::Internal::AnyHash
456
+ )
457
+ end
458
+
459
+ # The Campaign Registry (TCR) ID for the externally registered campaign
460
+ sig { returns(String) }
461
+ attr_accessor :tcr_id
462
+
463
+ # Import an externally registered campaign from The Campaign Registry (TCR)
464
+ sig { params(tcr_id: String).returns(T.attached_class) }
465
+ def self.new(
466
+ # The Campaign Registry (TCR) ID for the externally registered campaign
467
+ tcr_id:
468
+ )
469
+ end
470
+
471
+ sig { override.returns({ tcr_id: String }) }
472
+ def to_hash
473
+ end
474
+ end
475
+
476
+ sig { override.returns(T::Array[SurgeAPI::CampaignParams::Variants]) }
477
+ def self.variants
478
+ end
479
+ end
480
+ end
481
+ end