surge_api 0.23.0 → 0.24.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/surge_api/models/account_retrieve_status_params.rb +1 -0
  5. data/lib/surge_api/models/campaign.rb +6 -6
  6. data/lib/surge_api/models/campaign_params.rb +5 -6
  7. data/lib/surge_api/models/message.rb +25 -1
  8. data/lib/surge_api/models/message_delivered_webhook_event.rb +21 -1
  9. data/lib/surge_api/models/message_failed_webhook_event.rb +21 -1
  10. data/lib/surge_api/models/message_received_webhook_event.rb +21 -1
  11. data/lib/surge_api/models/message_sent_webhook_event.rb +21 -1
  12. data/lib/surge_api/models/phone_number_imported_webhook_event.rb +152 -0
  13. data/lib/surge_api/models/unwrap_webhook_event.rb +3 -1
  14. data/lib/surge_api/models.rb +2 -0
  15. data/lib/surge_api/resources/webhooks.rb +1 -1
  16. data/lib/surge_api/version.rb +1 -1
  17. data/lib/surge_api.rb +1 -0
  18. data/rbi/surge_api/models/account_retrieve_status_params.rbi +5 -0
  19. data/rbi/surge_api/models/campaign.rbi +9 -10
  20. data/rbi/surge_api/models/campaign_params.rbi +8 -10
  21. data/rbi/surge_api/models/message.rbi +34 -3
  22. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +44 -0
  23. data/rbi/surge_api/models/message_failed_webhook_event.rbi +40 -0
  24. data/rbi/surge_api/models/message_received_webhook_event.rbi +41 -0
  25. data/rbi/surge_api/models/message_sent_webhook_event.rbi +38 -0
  26. data/rbi/surge_api/models/phone_number_imported_webhook_event.rbi +310 -0
  27. data/rbi/surge_api/models/unwrap_webhook_event.rbi +1 -0
  28. data/rbi/surge_api/models.rbi +3 -0
  29. data/rbi/surge_api/resources/webhooks.rbi +1 -0
  30. data/sig/surge_api/models/account_retrieve_status_params.rbs +2 -1
  31. data/sig/surge_api/models/campaign.rbs +3 -1
  32. data/sig/surge_api/models/message.rbs +26 -3
  33. data/sig/surge_api/models/message_delivered_webhook_event.rbs +15 -0
  34. data/sig/surge_api/models/message_failed_webhook_event.rbs +15 -0
  35. data/sig/surge_api/models/message_received_webhook_event.rbs +15 -0
  36. data/sig/surge_api/models/message_sent_webhook_event.rbs +15 -0
  37. data/sig/surge_api/models/phone_number_imported_webhook_event.rbs +125 -0
  38. data/sig/surge_api/models/unwrap_webhook_event.rbs +1 -0
  39. data/sig/surge_api/models.rbs +2 -0
  40. data/sig/surge_api/resources/webhooks.rbs +1 -0
  41. metadata +5 -2
@@ -141,11 +141,10 @@ module SurgeAPI
141
141
  end
142
142
  attr_writer :includes
143
143
 
144
- # A sample link that might be sent by this campaign. If links from other domains
145
- # are sent through this campaign, they are much more likely to be filtered by the
146
- # carriers. If link shortening is enabled for the account, the link shortener URL
147
- # will be used instead of what is provided. Reach out to support if you would like
148
- # to disable automatic link shortening.
144
+ # A sample link that might be sent by this campaign. This is required when
145
+ # `includes` contains `links`. Provide the same URL or domain that the campaign
146
+ # will use in production. If links from other domains are sent through this
147
+ # campaign, they are much more likely to be filtered by the carriers.
149
148
  sig { returns(T.nilable(String)) }
150
149
  attr_reader :link_sample
151
150
 
@@ -247,11 +246,10 @@ module SurgeAPI
247
246
  # - `direct_lending` - whether the campaign contains content related to direct
248
247
  # lending or other loan arrangements
249
248
  includes: nil,
250
- # A sample link that might be sent by this campaign. If links from other domains
251
- # are sent through this campaign, they are much more likely to be filtered by the
252
- # carriers. If link shortening is enabled for the account, the link shortener URL
253
- # will be used instead of what is provided. Reach out to support if you would like
254
- # to disable automatic link shortening.
249
+ # A sample link that might be sent by this campaign. This is required when
250
+ # `includes` contains `links`. Provide the same URL or domain that the campaign
251
+ # will use in production. If links from other domains are sent through this
252
+ # campaign, they are much more likely to be filtered by the carriers.
255
253
  link_sample: nil
256
254
  )
257
255
  end
@@ -46,6 +46,13 @@ module SurgeAPI
46
46
  sig { params(metadata: T::Hash[Symbol, String]).void }
47
47
  attr_writer :metadata
48
48
 
49
+ # The current status of the message.
50
+ sig { returns(T.nilable(SurgeAPI::Message::Status::TaggedSymbol)) }
51
+ attr_reader :status
52
+
53
+ sig { params(status: SurgeAPI::Message::Status::OrSymbol).void }
54
+ attr_writer :status
55
+
49
56
  # A Message is a communication sent to a Contact.
50
57
  sig do
51
58
  params(
@@ -54,7 +61,8 @@ module SurgeAPI
54
61
  blast_id: T.nilable(String),
55
62
  body: T.nilable(String),
56
63
  conversation: SurgeAPI::Message::Conversation::OrHash,
57
- metadata: T::Hash[Symbol, String]
64
+ metadata: T::Hash[Symbol, String],
65
+ status: SurgeAPI::Message::Status::OrSymbol
58
66
  ).returns(T.attached_class)
59
67
  end
60
68
  def self.new(
@@ -69,7 +77,9 @@ module SurgeAPI
69
77
  # A conversation with a Contact
70
78
  conversation: nil,
71
79
  # Set of key-value pairs that will be stored with the object.
72
- metadata: nil
80
+ metadata: nil,
81
+ # The current status of the message.
82
+ status: nil
73
83
  )
74
84
  end
75
85
 
@@ -81,7 +91,8 @@ module SurgeAPI
81
91
  blast_id: T.nilable(String),
82
92
  body: T.nilable(String),
83
93
  conversation: SurgeAPI::Message::Conversation,
84
- metadata: T::Hash[Symbol, String]
94
+ metadata: T::Hash[Symbol, String],
95
+ status: SurgeAPI::Message::Status::TaggedSymbol
85
96
  }
86
97
  )
87
98
  end
@@ -342,6 +353,26 @@ module SurgeAPI
342
353
  end
343
354
  end
344
355
  end
356
+
357
+ # The current status of the message.
358
+ module Status
359
+ extend SurgeAPI::Internal::Type::Enum
360
+
361
+ TaggedSymbol = T.type_alias { T.all(Symbol, SurgeAPI::Message::Status) }
362
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
363
+
364
+ PENDING = T.let(:pending, SurgeAPI::Message::Status::TaggedSymbol)
365
+ RECEIVED = T.let(:received, SurgeAPI::Message::Status::TaggedSymbol)
366
+ SENT = T.let(:sent, SurgeAPI::Message::Status::TaggedSymbol)
367
+ DELIVERED = T.let(:delivered, SurgeAPI::Message::Status::TaggedSymbol)
368
+ FAILED = T.let(:failed, SurgeAPI::Message::Status::TaggedSymbol)
369
+
370
+ sig do
371
+ override.returns(T::Array[SurgeAPI::Message::Status::TaggedSymbol])
372
+ end
373
+ def self.values
374
+ end
375
+ end
345
376
  end
346
377
  end
347
378
  end
@@ -104,6 +104,14 @@ module SurgeAPI
104
104
  sig { returns(T::Hash[Symbol, String]) }
105
105
  attr_accessor :metadata
106
106
 
107
+ # The message status represented by this event
108
+ sig do
109
+ returns(
110
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status::TaggedSymbol
111
+ )
112
+ end
113
+ attr_accessor :status
114
+
107
115
  # Attachments included with the message
108
116
  sig do
109
117
  returns(
@@ -141,6 +149,8 @@ module SurgeAPI
141
149
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation::OrHash,
142
150
  delivered_at: Time,
143
151
  metadata: T::Hash[Symbol, String],
152
+ status:
153
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status::OrSymbol,
144
154
  attachments:
145
155
  T::Array[
146
156
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment::OrHash
@@ -159,6 +169,8 @@ module SurgeAPI
159
169
  delivered_at:,
160
170
  # Set of key-value pairs that will be stored with the object.
161
171
  metadata:,
172
+ # The message status represented by this event
173
+ status:,
162
174
  # Attachments included with the message
163
175
  attachments: nil,
164
176
  # The ID of the blast this message belongs to, if any. This can be used to
@@ -176,6 +188,8 @@ module SurgeAPI
176
188
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation,
177
189
  delivered_at: Time,
178
190
  metadata: T::Hash[Symbol, String],
191
+ status:
192
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status::TaggedSymbol,
179
193
  attachments:
180
194
  T::Array[
181
195
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment
@@ -245,6 +259,36 @@ module SurgeAPI
245
259
  end
246
260
  end
247
261
 
262
+ # The message status represented by this event
263
+ module Status
264
+ extend SurgeAPI::Internal::Type::Enum
265
+
266
+ TaggedSymbol =
267
+ T.type_alias do
268
+ T.all(
269
+ Symbol,
270
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status
271
+ )
272
+ end
273
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
274
+
275
+ DELIVERED =
276
+ T.let(
277
+ :delivered,
278
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status::TaggedSymbol
279
+ )
280
+
281
+ sig do
282
+ override.returns(
283
+ T::Array[
284
+ SurgeAPI::MessageDeliveredWebhookEvent::Data::Status::TaggedSymbol
285
+ ]
286
+ )
287
+ end
288
+ def self.values
289
+ end
290
+ end
291
+
248
292
  class Attachment < SurgeAPI::Internal::Type::BaseModel
249
293
  OrHash =
250
294
  T.type_alias do
@@ -106,6 +106,14 @@ module SurgeAPI
106
106
  sig { returns(T::Hash[Symbol, String]) }
107
107
  attr_accessor :metadata
108
108
 
109
+ # The message status represented by this event
110
+ sig do
111
+ returns(
112
+ SurgeAPI::MessageFailedWebhookEvent::Data::Status::TaggedSymbol
113
+ )
114
+ end
115
+ attr_accessor :status
116
+
109
117
  # Attachments included with the message
110
118
  sig do
111
119
  returns(
@@ -144,6 +152,7 @@ module SurgeAPI
144
152
  failed_at: Time,
145
153
  failure_reason: String,
146
154
  metadata: T::Hash[Symbol, String],
155
+ status: SurgeAPI::MessageFailedWebhookEvent::Data::Status::OrSymbol,
147
156
  attachments:
148
157
  T::Array[
149
158
  SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::OrHash
@@ -164,6 +173,8 @@ module SurgeAPI
164
173
  failure_reason:,
165
174
  # Set of key-value pairs that will be stored with the object.
166
175
  metadata:,
176
+ # The message status represented by this event
177
+ status:,
167
178
  # Attachments included with the message
168
179
  attachments: nil,
169
180
  # The ID of the blast this message belongs to, if any. This can be used to
@@ -182,6 +193,8 @@ module SurgeAPI
182
193
  failed_at: Time,
183
194
  failure_reason: String,
184
195
  metadata: T::Hash[Symbol, String],
196
+ status:
197
+ SurgeAPI::MessageFailedWebhookEvent::Data::Status::TaggedSymbol,
185
198
  attachments:
186
199
  T::Array[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment],
187
200
  blast_id: String
@@ -249,6 +262,33 @@ module SurgeAPI
249
262
  end
250
263
  end
251
264
 
265
+ # The message status represented by this event
266
+ module Status
267
+ extend SurgeAPI::Internal::Type::Enum
268
+
269
+ TaggedSymbol =
270
+ T.type_alias do
271
+ T.all(Symbol, SurgeAPI::MessageFailedWebhookEvent::Data::Status)
272
+ end
273
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
274
+
275
+ FAILED =
276
+ T.let(
277
+ :failed,
278
+ SurgeAPI::MessageFailedWebhookEvent::Data::Status::TaggedSymbol
279
+ )
280
+
281
+ sig do
282
+ override.returns(
283
+ T::Array[
284
+ SurgeAPI::MessageFailedWebhookEvent::Data::Status::TaggedSymbol
285
+ ]
286
+ )
287
+ end
288
+ def self.values
289
+ end
290
+ end
291
+
252
292
  class Attachment < SurgeAPI::Internal::Type::BaseModel
253
293
  OrHash =
254
294
  T.type_alias do
@@ -104,6 +104,14 @@ module SurgeAPI
104
104
  sig { returns(Time) }
105
105
  attr_accessor :received_at
106
106
 
107
+ # The message status represented by this event
108
+ sig do
109
+ returns(
110
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Status::TaggedSymbol
111
+ )
112
+ end
113
+ attr_accessor :status
114
+
107
115
  # Attachments included with the message
108
116
  sig do
109
117
  returns(
@@ -141,6 +149,8 @@ module SurgeAPI
141
149
  SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation::OrHash,
142
150
  metadata: T::Hash[Symbol, String],
143
151
  received_at: Time,
152
+ status:
153
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Status::OrSymbol,
144
154
  attachments:
145
155
  T::Array[
146
156
  SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::OrHash
@@ -159,6 +169,8 @@ module SurgeAPI
159
169
  metadata:,
160
170
  # When the message was received
161
171
  received_at:,
172
+ # The message status represented by this event
173
+ status:,
162
174
  # Attachments included with the message
163
175
  attachments: nil,
164
176
  # The ID of the blast this message belongs to, if any. This can be used to
@@ -176,6 +188,8 @@ module SurgeAPI
176
188
  SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation,
177
189
  metadata: T::Hash[Symbol, String],
178
190
  received_at: Time,
191
+ status:
192
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Status::TaggedSymbol,
179
193
  attachments:
180
194
  T::Array[
181
195
  SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment
@@ -245,6 +259,33 @@ module SurgeAPI
245
259
  end
246
260
  end
247
261
 
262
+ # The message status represented by this event
263
+ module Status
264
+ extend SurgeAPI::Internal::Type::Enum
265
+
266
+ TaggedSymbol =
267
+ T.type_alias do
268
+ T.all(Symbol, SurgeAPI::MessageReceivedWebhookEvent::Data::Status)
269
+ end
270
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
271
+
272
+ RECEIVED =
273
+ T.let(
274
+ :received,
275
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Status::TaggedSymbol
276
+ )
277
+
278
+ sig do
279
+ override.returns(
280
+ T::Array[
281
+ SurgeAPI::MessageReceivedWebhookEvent::Data::Status::TaggedSymbol
282
+ ]
283
+ )
284
+ end
285
+ def self.values
286
+ end
287
+ end
288
+
248
289
  class Attachment < SurgeAPI::Internal::Type::BaseModel
249
290
  OrHash =
250
291
  T.type_alias do
@@ -97,6 +97,12 @@ module SurgeAPI
97
97
  sig { returns(Time) }
98
98
  attr_accessor :sent_at
99
99
 
100
+ # The message status represented by this event
101
+ sig do
102
+ returns(SurgeAPI::MessageSentWebhookEvent::Data::Status::TaggedSymbol)
103
+ end
104
+ attr_accessor :status
105
+
100
106
  # Attachments included with the message
101
107
  sig do
102
108
  returns(
@@ -134,6 +140,7 @@ module SurgeAPI
134
140
  SurgeAPI::MessageSentWebhookEvent::Data::Conversation::OrHash,
135
141
  metadata: T::Hash[Symbol, String],
136
142
  sent_at: Time,
143
+ status: SurgeAPI::MessageSentWebhookEvent::Data::Status::OrSymbol,
137
144
  attachments:
138
145
  T::Array[
139
146
  SurgeAPI::MessageSentWebhookEvent::Data::Attachment::OrHash
@@ -152,6 +159,8 @@ module SurgeAPI
152
159
  metadata:,
153
160
  # When the message was sent
154
161
  sent_at:,
162
+ # The message status represented by this event
163
+ status:,
155
164
  # Attachments included with the message
156
165
  attachments: nil,
157
166
  # The ID of the blast this message belongs to, if any. This can be used to
@@ -169,6 +178,8 @@ module SurgeAPI
169
178
  SurgeAPI::MessageSentWebhookEvent::Data::Conversation,
170
179
  metadata: T::Hash[Symbol, String],
171
180
  sent_at: Time,
181
+ status:
182
+ SurgeAPI::MessageSentWebhookEvent::Data::Status::TaggedSymbol,
172
183
  attachments:
173
184
  T::Array[SurgeAPI::MessageSentWebhookEvent::Data::Attachment],
174
185
  blast_id: String
@@ -236,6 +247,33 @@ module SurgeAPI
236
247
  end
237
248
  end
238
249
 
250
+ # The message status represented by this event
251
+ module Status
252
+ extend SurgeAPI::Internal::Type::Enum
253
+
254
+ TaggedSymbol =
255
+ T.type_alias do
256
+ T.all(Symbol, SurgeAPI::MessageSentWebhookEvent::Data::Status)
257
+ end
258
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
259
+
260
+ SENT =
261
+ T.let(
262
+ :sent,
263
+ SurgeAPI::MessageSentWebhookEvent::Data::Status::TaggedSymbol
264
+ )
265
+
266
+ sig do
267
+ override.returns(
268
+ T::Array[
269
+ SurgeAPI::MessageSentWebhookEvent::Data::Status::TaggedSymbol
270
+ ]
271
+ )
272
+ end
273
+ def self.values
274
+ end
275
+ end
276
+
239
277
  class Attachment < SurgeAPI::Internal::Type::BaseModel
240
278
  OrHash =
241
279
  T.type_alias do