surge_api 0.11.0 → 0.12.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +1 -1
  4. data/lib/surge_api/internal/util.rb +31 -0
  5. data/lib/surge_api/models/blast_create_params.rb +4 -4
  6. data/lib/surge_api/models/campaign.rb +0 -1
  7. data/lib/surge_api/models/phone_number.rb +9 -1
  8. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +96 -0
  9. data/lib/surge_api/models/unwrap_webhook_event.rb +3 -1
  10. data/lib/surge_api/models.rb +2 -0
  11. data/lib/surge_api/resources/accounts.rb +2 -1
  12. data/lib/surge_api/resources/blasts.rb +1 -1
  13. data/lib/surge_api/resources/campaigns.rb +2 -1
  14. data/lib/surge_api/resources/contacts.rb +2 -1
  15. data/lib/surge_api/resources/messages.rb +2 -1
  16. data/lib/surge_api/resources/phone_numbers.rb +2 -1
  17. data/lib/surge_api/resources/webhooks.rb +1 -1
  18. data/lib/surge_api/version.rb +1 -1
  19. data/lib/surge_api.rb +1 -0
  20. data/rbi/surge_api/internal/util.rbi +20 -0
  21. data/rbi/surge_api/models/blast_create_params.rbi +4 -4
  22. data/rbi/surge_api/models/campaign.rbi +0 -1
  23. data/rbi/surge_api/models/phone_number.rbi +8 -0
  24. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +181 -0
  25. data/rbi/surge_api/models/unwrap_webhook_event.rbi +1 -0
  26. data/rbi/surge_api/models.rbi +3 -0
  27. data/rbi/surge_api/resources/blasts.rbi +2 -2
  28. data/rbi/surge_api/resources/webhooks.rbi +1 -0
  29. data/sig/surge_api/internal/util.rbs +10 -0
  30. data/sig/surge_api/models/campaign.rbs +1 -8
  31. data/sig/surge_api/models/phone_number.rbs +10 -1
  32. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +79 -0
  33. data/sig/surge_api/models/unwrap_webhook_event.rbs +1 -0
  34. data/sig/surge_api/models.rbs +2 -0
  35. data/sig/surge_api/resources/webhooks.rbs +1 -0
  36. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21d19ad8088d287a26c0293ecbec97d29a879616d98b219dbcb8c672c699f58d
4
- data.tar.gz: eb81ac34997ec986242cdd64006a69d31f7bb76555a8a711644fcc06210c1293
3
+ metadata.gz: 8012d35d6b7aaae2d18541e688d7605e1ee985153b70ebec72790ddb0ba3b28b
4
+ data.tar.gz: 7051be5e16f4e06b7eafac3c3b8b7554fc06710c5b6a0104e8f4dabe6ba8f448
5
5
  SHA512:
6
- metadata.gz: af5bc8ed33052eb78f9a1bcb9e165e594f2b684891c6a159315903847da918c38ce1a4b8cb60bdb10b5cc4d144eb1a7398f816c90606268189408f9da6de25d0
7
- data.tar.gz: 17951922f214b0a5d290fd520658d9964ae51972e5761199272d3193a91bfa3f2b52cc1fa749f4235174d42733472d732b2c20a4dd6767509b5b89b06e86d82b
6
+ metadata.gz: 50cb8dd9f5162634bb262e93eda01ed24d9af0d8c0c45171d4642969e7824292cea2465ef00d199a85e62e0ad7a38288ed082c44f7a529210c13802e0cfbcf77
7
+ data.tar.gz: 4b0d24f6c73cfb6b038ac5c9663cbf2c83917770eff0f3d0d36fe9006cfc2adf80892f9c65b693380f3f9e671362af3e2ef93a1cb5743dc3d39e935d57ed12ed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 (2026-03-11)
4
+
5
+ Full Changelog: [v0.11.0...v0.12.0](https://github.com/surgeapi/ruby-sdk/compare/v0.11.0...v0.12.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add campaign ID to phone numbers ([76e02a6](https://github.com/surgeapi/ruby-sdk/commit/76e02a67b248539548b0bc918178dcb9749ef2aa))
10
+ * **api:** add phoneNumberAttachedToCampaign webhook ([b145691](https://github.com/surgeapi/ruby-sdk/commit/b14569150ea04fd2d74f9f17ff0ab3bbf00d9c19))
11
+ * **api:** remove 'pending' campaign status ([067f38a](https://github.com/surgeapi/ruby-sdk/commit/067f38adf747327111ad032362f5e9faf31dddce))
12
+ * **api:** rename segments to audiences ([69c982c](https://github.com/surgeapi/ruby-sdk/commit/69c982c90af4999babdff64a46ffe5df1d54391a))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * properly mock time in ruby ci tests ([6c75ef3](https://github.com/surgeapi/ruby-sdk/commit/6c75ef31490dc13fb591146b2b27a8a3c8f3495c))
18
+
19
+
20
+ ### Chores
21
+
22
+ * **ci:** add build step ([4999f0c](https://github.com/surgeapi/ruby-sdk/commit/4999f0c610b73f42d468fc200aeafe002f4947b0))
23
+ * **internal:** codegen related update ([bd1d5f0](https://github.com/surgeapi/ruby-sdk/commit/bd1d5f019b6ec12acdca6e36af2c46065dab0e70))
24
+
3
25
  ## 0.11.0 (2026-02-22)
4
26
 
5
27
  Full Changelog: [v0.10.0...v0.11.0](https://github.com/surgeapi/ruby-sdk/compare/v0.10.0...v0.11.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.11.0"
20
+ gem "surge_api", "~> 0.12.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -490,6 +490,37 @@ module SurgeAPI
490
490
  JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
491
491
 
492
492
  class << self
493
+ # @api private
494
+ #
495
+ # @param query [Hash{Symbol=>Object}]
496
+ #
497
+ # @return [Hash{Symbol=>Object}]
498
+ def encode_query_params(query)
499
+ out = {}
500
+ query.each { write_query_param_element!(out, _1, _2) }
501
+ out
502
+ end
503
+
504
+ # @api private
505
+ #
506
+ # @param collection [Hash{Symbol=>Object}]
507
+ # @param key [String]
508
+ # @param element [Object]
509
+ #
510
+ # @return [nil]
511
+ private def write_query_param_element!(collection, key, element)
512
+ case element
513
+ in Hash
514
+ element.each do |name, value|
515
+ write_query_param_element!(collection, "#{key}[#{name}]", value)
516
+ end
517
+ in Array
518
+ collection[key] = element.map(&:to_s).join(",")
519
+ else
520
+ collection[key] = element.to_s
521
+ end
522
+ end
523
+
493
524
  # @api private
494
525
  #
495
526
  # @param y [Enumerator::Yielder]
@@ -41,9 +41,9 @@ module SurgeAPI
41
41
  optional :name, String
42
42
 
43
43
  # @!attribute segments
44
- # @deprecated Use `to` to specify recipients instead.
44
+ # @deprecated Use `to` with audience IDs (`aud_...`) to specify audience recipients instead.
45
45
  #
46
- # Deprecated. Use `to` instead.
46
+ # Deprecated. Use `to` with audience IDs instead.
47
47
  #
48
48
  # @return [Array<String>, nil]
49
49
  optional :segments, SurgeAPI::Internal::Type::ArrayOf[String]
@@ -56,7 +56,7 @@ module SurgeAPI
56
56
 
57
57
  # @!attribute to
58
58
  # List of recipients to whom the blast should be sent. This can be a combination
59
- # of contact IDs, segment IDs, and phone numbers.
59
+ # of contact IDs, audience IDs, and phone numbers.
60
60
  #
61
61
  # @return [Array<String>, nil]
62
62
  optional :to, SurgeAPI::Internal::Type::ArrayOf[String]
@@ -75,7 +75,7 @@ module SurgeAPI
75
75
  #
76
76
  # @param name [String] Optional name for the blast.
77
77
  #
78
- # @param segments [Array<String>] Deprecated. Use `to` instead.
78
+ # @param segments [Array<String>] Deprecated. Use `to` with audience IDs instead.
79
79
  #
80
80
  # @param send_at [Time] When to send the blast. If not provided, sends immediately.
81
81
  #
@@ -183,7 +183,6 @@ module SurgeAPI
183
183
  CREATED = :created
184
184
  DEACTIVATED = :deactivated
185
185
  IN_REVIEW = :in_review
186
- PENDING = :pending
187
186
  REJECTED = :rejected
188
187
 
189
188
  # @!method self.values
@@ -10,6 +10,12 @@ module SurgeAPI
10
10
  # @return [String]
11
11
  required :id, String
12
12
 
13
+ # @!attribute campaign_id
14
+ # The unique identifier of the campaign this phone number is attached to, if any
15
+ #
16
+ # @return [String, nil]
17
+ required :campaign_id, String, nil?: true
18
+
13
19
  # @!attribute number
14
20
  # The phone number in E.164 format
15
21
  #
@@ -22,11 +28,13 @@ module SurgeAPI
22
28
  # @return [Symbol, SurgeAPI::Models::PhoneNumber::Type]
23
29
  required :type, enum: -> { SurgeAPI::PhoneNumber::Type }
24
30
 
25
- # @!method initialize(id:, number:, type:)
31
+ # @!method initialize(id:, campaign_id:, number:, type:)
26
32
  # A phone number that can be used to send and receive messages and calls
27
33
  #
28
34
  # @param id [String] Unique identifier for the phone number
29
35
  #
36
+ # @param campaign_id [String, nil] The unique identifier of the campaign this phone number is attached to, if any
37
+ #
30
38
  # @param number [String] The phone number in E.164 format
31
39
  #
32
40
  # @param type [Symbol, SurgeAPI::Models::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class PhoneNumberAttachedToCampaignWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute account_id
7
+ # The ID of the account in which this event occurred
8
+ #
9
+ # @return [String]
10
+ required :account_id, String
11
+
12
+ # @!attribute data
13
+ # The data associated with the event
14
+ #
15
+ # @return [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data }
17
+
18
+ # @!attribute timestamp
19
+ # The timestamp when this event occurred, in ISO8601 format
20
+ #
21
+ # @return [Time]
22
+ required :timestamp, Time
23
+
24
+ # @!attribute type
25
+ # The type of the event. Always `phone_number.attached_to_campaign` for this
26
+ # event.
27
+ #
28
+ # @return [Symbol, :"phone_number.attached_to_campaign"]
29
+ required :type, const: :"phone_number.attached_to_campaign"
30
+
31
+ # @!method initialize(account_id:, data:, timestamp:, type: :"phone_number.attached_to_campaign")
32
+ # Some parameter documentations has been truncated, see
33
+ # {SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent} for more details.
34
+ #
35
+ # @param account_id [String] The ID of the account in which this event occurred
36
+ #
37
+ # @param data [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data] The data associated with the event
38
+ #
39
+ # @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
40
+ #
41
+ # @param type [Symbol, :"phone_number.attached_to_campaign"] The type of the event. Always `phone_number.attached_to_campaign` for this event
42
+
43
+ # @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent#data
44
+ class Data < SurgeAPI::Internal::Type::BaseModel
45
+ # @!attribute id
46
+ # The unique identifier for the phone number
47
+ #
48
+ # @return [String]
49
+ required :id, String
50
+
51
+ # @!attribute campaign_id
52
+ # The unique identifier of the campaign this phone number is attached to
53
+ #
54
+ # @return [String]
55
+ required :campaign_id, String
56
+
57
+ # @!attribute number
58
+ # The phone number in E.164 format
59
+ #
60
+ # @return [String]
61
+ required :number, String
62
+
63
+ # @!attribute type
64
+ # Whether the phone number is local, toll-free, or short code
65
+ #
66
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type]
67
+ required :type, enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type }
68
+
69
+ # @!method initialize(id:, campaign_id:, number:, type:)
70
+ # The data associated with the event
71
+ #
72
+ # @param id [String] The unique identifier for the phone number
73
+ #
74
+ # @param campaign_id [String] The unique identifier of the campaign this phone number is attached to
75
+ #
76
+ # @param number [String] The phone number in E.164 format
77
+ #
78
+ # @param type [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type] Whether the phone number is local, toll-free, or short code
79
+
80
+ # Whether the phone number is local, toll-free, or short code
81
+ #
82
+ # @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data#type
83
+ module Type
84
+ extend SurgeAPI::Internal::Type::Enum
85
+
86
+ LOCAL = :local
87
+ SHORT_CODE = :short_code
88
+ TOLL_FREE = :toll_free
89
+
90
+ # @!method self.values
91
+ # @return [Array<Symbol>]
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -27,12 +27,14 @@ module SurgeAPI
27
27
 
28
28
  variant :"message.sent", -> { SurgeAPI::MessageSentWebhookEvent }
29
29
 
30
+ variant :"phone_number.attached_to_campaign", -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent }
31
+
30
32
  variant :"recording.completed", -> { SurgeAPI::RecordingCompletedWebhookEvent }
31
33
 
32
34
  variant :"voicemail.received", -> { SurgeAPI::VoicemailReceivedWebhookEvent }
33
35
 
34
36
  # @!method self.variants
35
- # @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent)]
37
+ # @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent)]
36
38
  end
37
39
  end
38
40
  end
@@ -111,6 +111,8 @@ module SurgeAPI
111
111
 
112
112
  PhoneNumber = SurgeAPI::Models::PhoneNumber
113
113
 
114
+ PhoneNumberAttachedToCampaignWebhookEvent = SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
115
+
114
116
  PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
115
117
 
116
118
  PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
@@ -111,10 +111,11 @@ module SurgeAPI
111
111
  # @see SurgeAPI::Models::AccountRetrieveStatusParams
112
112
  def retrieve_status(account_id, params = {})
113
113
  parsed, options = SurgeAPI::AccountRetrieveStatusParams.dump_request(params)
114
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
114
115
  @client.request(
115
116
  method: :get,
116
117
  path: ["accounts/%1$s/status", account_id],
117
- query: parsed,
118
+ query: query,
118
119
  model: SurgeAPI::AccountStatus,
119
120
  options: options
120
121
  )
@@ -22,7 +22,7 @@ module SurgeAPI
22
22
  #
23
23
  # @param name [String] Optional name for the blast.
24
24
  #
25
- # @param segments [Array<String>] Deprecated. Use `to` instead.
25
+ # @param segments [Array<String>] Deprecated. Use `to` with audience IDs instead.
26
26
  #
27
27
  # @param send_at [Time] When to send the blast. If not provided, sends immediately.
28
28
  #
@@ -75,10 +75,11 @@ module SurgeAPI
75
75
  # @see SurgeAPI::Models::CampaignListParams
76
76
  def list(account_id, params = {})
77
77
  parsed, options = SurgeAPI::CampaignListParams.dump_request(params)
78
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
78
79
  @client.request(
79
80
  method: :get,
80
81
  path: ["accounts/%1$s/campaigns", account_id],
81
- query: parsed,
82
+ query: query,
82
83
  page: SurgeAPI::Internal::Cursor,
83
84
  model: SurgeAPI::Campaign,
84
85
  options: options
@@ -108,10 +108,11 @@ module SurgeAPI
108
108
  # @see SurgeAPI::Models::ContactListParams
109
109
  def list(account_id, params = {})
110
110
  parsed, options = SurgeAPI::ContactListParams.dump_request(params)
111
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
111
112
  @client.request(
112
113
  method: :get,
113
114
  path: ["accounts/%1$s/contacts", account_id],
114
- query: parsed,
115
+ query: query,
115
116
  page: SurgeAPI::Internal::Cursor,
116
117
  model: SurgeAPI::Contact,
117
118
  options: options
@@ -99,10 +99,11 @@ module SurgeAPI
99
99
  # @see SurgeAPI::Models::MessageListParams
100
100
  def list(account_id, params = {})
101
101
  parsed, options = SurgeAPI::MessageListParams.dump_request(params)
102
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
102
103
  @client.request(
103
104
  method: :get,
104
105
  path: ["accounts/%1$s/messages", account_id],
105
- query: parsed,
106
+ query: query,
106
107
  page: SurgeAPI::Internal::Cursor,
107
108
  model: SurgeAPI::Message,
108
109
  options: options
@@ -23,10 +23,11 @@ module SurgeAPI
23
23
  # @see SurgeAPI::Models::PhoneNumberListParams
24
24
  def list(account_id, params = {})
25
25
  parsed, options = SurgeAPI::PhoneNumberListParams.dump_request(params)
26
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
26
27
  @client.request(
27
28
  method: :get,
28
29
  path: ["accounts/%1$s/phone_numbers", account_id],
29
- query: parsed,
30
+ query: query,
30
31
  page: SurgeAPI::Internal::Cursor,
31
32
  model: SurgeAPI::PhoneNumber,
32
33
  options: options
@@ -5,7 +5,7 @@ module SurgeAPI
5
5
  class Webhooks
6
6
  # @param payload [String] The raw webhook payload as a string
7
7
  #
8
- # @return [SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent]
8
+ # @return [SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent]
9
9
  def unwrap(payload)
10
10
  parsed = JSON.parse(payload, symbolize_names: true)
11
11
  SurgeAPI::Internal::Type::Converter.coerce(SurgeAPI::Models::UnwrapWebhookEvent, parsed)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -89,6 +89,7 @@ require_relative "surge_api/models/message_retrieve_params"
89
89
  require_relative "surge_api/models/message_sent_webhook_event"
90
90
  require_relative "surge_api/models/organization"
91
91
  require_relative "surge_api/models/phone_number"
92
+ require_relative "surge_api/models/phone_number_attached_to_campaign_webhook_event"
92
93
  require_relative "surge_api/models/phone_number_list_params"
93
94
  require_relative "surge_api/models/phone_number_purchase_params"
94
95
  require_relative "surge_api/models/recording_completed_webhook_event"
@@ -301,6 +301,26 @@ module SurgeAPI
301
301
  T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
302
302
 
303
303
  class << self
304
+ # @api private
305
+ sig do
306
+ params(query: SurgeAPI::Internal::AnyHash).returns(
307
+ SurgeAPI::Internal::AnyHash
308
+ )
309
+ end
310
+ def encode_query_params(query)
311
+ end
312
+
313
+ # @api private
314
+ sig do
315
+ params(
316
+ collection: SurgeAPI::Internal::AnyHash,
317
+ key: String,
318
+ element: T.anything
319
+ ).void
320
+ end
321
+ private def write_query_param_element!(collection, key, element)
322
+ end
323
+
304
324
  # @api private
305
325
  sig do
306
326
  params(
@@ -50,7 +50,7 @@ module SurgeAPI
50
50
  sig { params(name: String).void }
51
51
  attr_writer :name
52
52
 
53
- # Deprecated. Use `to` instead.
53
+ # Deprecated. Use `to` with audience IDs instead.
54
54
  sig { returns(T.nilable(T::Array[String])) }
55
55
  attr_reader :segments
56
56
 
@@ -65,7 +65,7 @@ module SurgeAPI
65
65
  attr_writer :send_at
66
66
 
67
67
  # List of recipients to whom the blast should be sent. This can be a combination
68
- # of contact IDs, segment IDs, and phone numbers.
68
+ # of contact IDs, audience IDs, and phone numbers.
69
69
  sig { returns(T.nilable(T::Array[String])) }
70
70
  attr_reader :to
71
71
 
@@ -98,12 +98,12 @@ module SurgeAPI
98
98
  from: nil,
99
99
  # Optional name for the blast.
100
100
  name: nil,
101
- # Deprecated. Use `to` instead.
101
+ # Deprecated. Use `to` with audience IDs instead.
102
102
  segments: nil,
103
103
  # When to send the blast. If not provided, sends immediately.
104
104
  send_at: nil,
105
105
  # List of recipients to whom the blast should be sent. This can be a combination
106
- # of contact IDs, segment IDs, and phone numbers.
106
+ # of contact IDs, audience IDs, and phone numbers.
107
107
  to: nil,
108
108
  request_options: {}
109
109
  )
@@ -276,7 +276,6 @@ module SurgeAPI
276
276
  DEACTIVATED =
277
277
  T.let(:deactivated, SurgeAPI::Campaign::Status::TaggedSymbol)
278
278
  IN_REVIEW = T.let(:in_review, SurgeAPI::Campaign::Status::TaggedSymbol)
279
- PENDING = T.let(:pending, SurgeAPI::Campaign::Status::TaggedSymbol)
280
279
  REJECTED = T.let(:rejected, SurgeAPI::Campaign::Status::TaggedSymbol)
281
280
 
282
281
  sig do
@@ -12,6 +12,10 @@ module SurgeAPI
12
12
  sig { returns(String) }
13
13
  attr_accessor :id
14
14
 
15
+ # The unique identifier of the campaign this phone number is attached to, if any
16
+ sig { returns(T.nilable(String)) }
17
+ attr_accessor :campaign_id
18
+
15
19
  # The phone number in E.164 format
16
20
  sig { returns(String) }
17
21
  attr_accessor :number
@@ -24,6 +28,7 @@ module SurgeAPI
24
28
  sig do
25
29
  params(
26
30
  id: String,
31
+ campaign_id: T.nilable(String),
27
32
  number: String,
28
33
  type: SurgeAPI::PhoneNumber::Type::OrSymbol
29
34
  ).returns(T.attached_class)
@@ -31,6 +36,8 @@ module SurgeAPI
31
36
  def self.new(
32
37
  # Unique identifier for the phone number
33
38
  id:,
39
+ # The unique identifier of the campaign this phone number is attached to, if any
40
+ campaign_id:,
34
41
  # The phone number in E.164 format
35
42
  number:,
36
43
  # Whether the phone number is local, toll-free, or short code
@@ -42,6 +49,7 @@ module SurgeAPI
42
49
  override.returns(
43
50
  {
44
51
  id: String,
52
+ campaign_id: T.nilable(String),
45
53
  number: String,
46
54
  type: SurgeAPI::PhoneNumber::Type::TaggedSymbol
47
55
  }
@@ -0,0 +1,181 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class PhoneNumberAttachedToCampaignWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent,
10
+ SurgeAPI::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The ID of the account in which this event occurred
15
+ sig { returns(String) }
16
+ attr_accessor :account_id
17
+
18
+ # The data associated with the event
19
+ sig { returns(SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data) }
20
+ attr_reader :data
21
+
22
+ sig do
23
+ params(
24
+ data:
25
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::OrHash
26
+ ).void
27
+ end
28
+ attr_writer :data
29
+
30
+ # The timestamp when this event occurred, in ISO8601 format
31
+ sig { returns(Time) }
32
+ attr_accessor :timestamp
33
+
34
+ # The type of the event. Always `phone_number.attached_to_campaign` for this
35
+ # event.
36
+ sig { returns(Symbol) }
37
+ attr_accessor :type
38
+
39
+ sig do
40
+ params(
41
+ account_id: String,
42
+ data:
43
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::OrHash,
44
+ timestamp: Time,
45
+ type: Symbol
46
+ ).returns(T.attached_class)
47
+ end
48
+ def self.new(
49
+ # The ID of the account in which this event occurred
50
+ account_id:,
51
+ # The data associated with the event
52
+ data:,
53
+ # The timestamp when this event occurred, in ISO8601 format
54
+ timestamp:,
55
+ # The type of the event. Always `phone_number.attached_to_campaign` for this
56
+ # event.
57
+ type: :"phone_number.attached_to_campaign"
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ account_id: String,
65
+ data: SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data,
66
+ timestamp: Time,
67
+ type: Symbol
68
+ }
69
+ )
70
+ end
71
+ def to_hash
72
+ end
73
+
74
+ class Data < SurgeAPI::Internal::Type::BaseModel
75
+ OrHash =
76
+ T.type_alias do
77
+ T.any(
78
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data,
79
+ SurgeAPI::Internal::AnyHash
80
+ )
81
+ end
82
+
83
+ # The unique identifier for the phone number
84
+ sig { returns(String) }
85
+ attr_accessor :id
86
+
87
+ # The unique identifier of the campaign this phone number is attached to
88
+ sig { returns(String) }
89
+ attr_accessor :campaign_id
90
+
91
+ # The phone number in E.164 format
92
+ sig { returns(String) }
93
+ attr_accessor :number
94
+
95
+ # Whether the phone number is local, toll-free, or short code
96
+ sig do
97
+ returns(
98
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
99
+ )
100
+ end
101
+ attr_accessor :type
102
+
103
+ # The data associated with the event
104
+ sig do
105
+ params(
106
+ id: String,
107
+ campaign_id: String,
108
+ number: String,
109
+ type:
110
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::OrSymbol
111
+ ).returns(T.attached_class)
112
+ end
113
+ def self.new(
114
+ # The unique identifier for the phone number
115
+ id:,
116
+ # The unique identifier of the campaign this phone number is attached to
117
+ campaign_id:,
118
+ # The phone number in E.164 format
119
+ number:,
120
+ # Whether the phone number is local, toll-free, or short code
121
+ type:
122
+ )
123
+ end
124
+
125
+ sig do
126
+ override.returns(
127
+ {
128
+ id: String,
129
+ campaign_id: String,
130
+ number: String,
131
+ type:
132
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
133
+ }
134
+ )
135
+ end
136
+ def to_hash
137
+ end
138
+
139
+ # Whether the phone number is local, toll-free, or short code
140
+ module Type
141
+ extend SurgeAPI::Internal::Type::Enum
142
+
143
+ TaggedSymbol =
144
+ T.type_alias do
145
+ T.all(
146
+ Symbol,
147
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type
148
+ )
149
+ end
150
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
151
+
152
+ LOCAL =
153
+ T.let(
154
+ :local,
155
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
156
+ )
157
+ SHORT_CODE =
158
+ T.let(
159
+ :short_code,
160
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
161
+ )
162
+ TOLL_FREE =
163
+ T.let(
164
+ :toll_free,
165
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
166
+ )
167
+
168
+ sig do
169
+ override.returns(
170
+ T::Array[
171
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type::TaggedSymbol
172
+ ]
173
+ )
174
+ end
175
+ def self.values
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
@@ -18,6 +18,7 @@ module SurgeAPI
18
18
  SurgeAPI::MessageFailedWebhookEvent,
19
19
  SurgeAPI::MessageReceivedWebhookEvent,
20
20
  SurgeAPI::MessageSentWebhookEvent,
21
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent,
21
22
  SurgeAPI::RecordingCompletedWebhookEvent,
22
23
  SurgeAPI::VoicemailReceivedWebhookEvent
23
24
  )
@@ -74,6 +74,9 @@ module SurgeAPI
74
74
 
75
75
  PhoneNumber = SurgeAPI::Models::PhoneNumber
76
76
 
77
+ PhoneNumberAttachedToCampaignWebhookEvent =
78
+ SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
79
+
77
80
  PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
78
81
 
79
82
  PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
@@ -33,12 +33,12 @@ module SurgeAPI
33
33
  from: nil,
34
34
  # Optional name for the blast.
35
35
  name: nil,
36
- # Deprecated. Use `to` instead.
36
+ # Deprecated. Use `to` with audience IDs instead.
37
37
  segments: nil,
38
38
  # When to send the blast. If not provided, sends immediately.
39
39
  send_at: nil,
40
40
  # List of recipients to whom the blast should be sent. This can be a combination
41
- # of contact IDs, segment IDs, and phone numbers.
41
+ # of contact IDs, audience IDs, and phone numbers.
42
42
  to: nil,
43
43
  request_options: {}
44
44
  )
@@ -16,6 +16,7 @@ module SurgeAPI
16
16
  SurgeAPI::MessageFailedWebhookEvent,
17
17
  SurgeAPI::MessageReceivedWebhookEvent,
18
18
  SurgeAPI::MessageSentWebhookEvent,
19
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent,
19
20
  SurgeAPI::RecordingCompletedWebhookEvent,
20
21
  SurgeAPI::VoicemailReceivedWebhookEvent
21
22
  )
@@ -106,6 +106,16 @@ module SurgeAPI
106
106
  JSON_CONTENT: Regexp
107
107
  JSONL_CONTENT: Regexp
108
108
 
109
+ def encode_query_params: (
110
+ ::Hash[Symbol, top] query
111
+ ) -> ::Hash[Symbol, top]
112
+
113
+ private def write_query_param_element!: (
114
+ ::Hash[Symbol, top] collection,
115
+ String key,
116
+ top element
117
+ ) -> nil
118
+
109
119
  def self?.write_multipart_content: (
110
120
  Enumerator::Yielder y,
111
121
  val: top,
@@ -84,13 +84,7 @@ module SurgeAPI
84
84
  end
85
85
 
86
86
  type status =
87
- :active
88
- | :canceled
89
- | :created
90
- | :deactivated
91
- | :in_review
92
- | :pending
93
- | :rejected
87
+ :active | :canceled | :created | :deactivated | :in_review | :rejected
94
88
 
95
89
  module Status
96
90
  extend SurgeAPI::Internal::Type::Enum
@@ -100,7 +94,6 @@ module SurgeAPI
100
94
  CREATED: :created
101
95
  DEACTIVATED: :deactivated
102
96
  IN_REVIEW: :in_review
103
- PENDING: :pending
104
97
  REJECTED: :rejected
105
98
 
106
99
  def self?.values: -> ::Array[SurgeAPI::Models::Campaign::status]
@@ -1,23 +1,32 @@
1
1
  module SurgeAPI
2
2
  module Models
3
3
  type phone_number =
4
- { id: String, number: String, type: SurgeAPI::Models::PhoneNumber::type_ }
4
+ {
5
+ id: String,
6
+ campaign_id: String?,
7
+ number: String,
8
+ type: SurgeAPI::Models::PhoneNumber::type_
9
+ }
5
10
 
6
11
  class PhoneNumber < SurgeAPI::Internal::Type::BaseModel
7
12
  attr_accessor id: String
8
13
 
14
+ attr_accessor campaign_id: String?
15
+
9
16
  attr_accessor number: String
10
17
 
11
18
  attr_accessor type: SurgeAPI::Models::PhoneNumber::type_
12
19
 
13
20
  def initialize: (
14
21
  id: String,
22
+ campaign_id: String?,
15
23
  number: String,
16
24
  type: SurgeAPI::Models::PhoneNumber::type_
17
25
  ) -> void
18
26
 
19
27
  def to_hash: -> {
20
28
  id: String,
29
+ campaign_id: String?,
21
30
  number: String,
22
31
  type: SurgeAPI::Models::PhoneNumber::type_
23
32
  }
@@ -0,0 +1,79 @@
1
+ module SurgeAPI
2
+ module Models
3
+ type phone_number_attached_to_campaign_webhook_event =
4
+ {
5
+ account_id: String,
6
+ data: SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data,
7
+ timestamp: Time,
8
+ type: :"phone_number.attached_to_campaign"
9
+ }
10
+
11
+ class PhoneNumberAttachedToCampaignWebhookEvent < SurgeAPI::Internal::Type::BaseModel
12
+ attr_accessor account_id: String
13
+
14
+ attr_accessor data: SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data
15
+
16
+ attr_accessor timestamp: Time
17
+
18
+ attr_accessor type: :"phone_number.attached_to_campaign"
19
+
20
+ def initialize: (
21
+ account_id: String,
22
+ data: SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data,
23
+ timestamp: Time,
24
+ ?type: :"phone_number.attached_to_campaign"
25
+ ) -> void
26
+
27
+ def to_hash: -> {
28
+ account_id: String,
29
+ data: SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data,
30
+ timestamp: Time,
31
+ type: :"phone_number.attached_to_campaign"
32
+ }
33
+
34
+ type data =
35
+ {
36
+ id: String,
37
+ campaign_id: String,
38
+ number: String,
39
+ type: SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::type_
40
+ }
41
+
42
+ class Data < SurgeAPI::Internal::Type::BaseModel
43
+ attr_accessor id: String
44
+
45
+ attr_accessor campaign_id: String
46
+
47
+ attr_accessor number: String
48
+
49
+ attr_accessor type: SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::type_
50
+
51
+ def initialize: (
52
+ id: String,
53
+ campaign_id: String,
54
+ number: String,
55
+ type: SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::type_
56
+ ) -> void
57
+
58
+ def to_hash: -> {
59
+ id: String,
60
+ campaign_id: String,
61
+ number: String,
62
+ type: SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::type_
63
+ }
64
+
65
+ type type_ = :local | :short_code | :toll_free
66
+
67
+ module Type
68
+ extend SurgeAPI::Internal::Type::Enum
69
+
70
+ LOCAL: :local
71
+ SHORT_CODE: :short_code
72
+ TOLL_FREE: :toll_free
73
+
74
+ def self?.values: -> ::Array[SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::type_]
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -11,6 +11,7 @@ module SurgeAPI
11
11
  | SurgeAPI::MessageFailedWebhookEvent
12
12
  | SurgeAPI::MessageReceivedWebhookEvent
13
13
  | SurgeAPI::MessageSentWebhookEvent
14
+ | SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent
14
15
  | SurgeAPI::RecordingCompletedWebhookEvent
15
16
  | SurgeAPI::VoicemailReceivedWebhookEvent
16
17
 
@@ -71,6 +71,8 @@ module SurgeAPI
71
71
 
72
72
  class PhoneNumber = SurgeAPI::Models::PhoneNumber
73
73
 
74
+ class PhoneNumberAttachedToCampaignWebhookEvent = SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
75
+
74
76
  class PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
75
77
 
76
78
  class PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
@@ -13,6 +13,7 @@ module SurgeAPI
13
13
  | SurgeAPI::MessageFailedWebhookEvent
14
14
  | SurgeAPI::MessageReceivedWebhookEvent
15
15
  | SurgeAPI::MessageSentWebhookEvent
16
+ | SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent
16
17
  | SurgeAPI::RecordingCompletedWebhookEvent
17
18
  | SurgeAPI::VoicemailReceivedWebhookEvent)
18
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-22 00:00:00.000000000 Z
11
+ date: 2026-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -106,6 +106,7 @@ files:
106
106
  - lib/surge_api/models/message_sent_webhook_event.rb
107
107
  - lib/surge_api/models/organization.rb
108
108
  - lib/surge_api/models/phone_number.rb
109
+ - lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb
109
110
  - lib/surge_api/models/phone_number_list_params.rb
110
111
  - lib/surge_api/models/phone_number_purchase_params.rb
111
112
  - lib/surge_api/models/recording_completed_webhook_event.rb
@@ -196,6 +197,7 @@ files:
196
197
  - rbi/surge_api/models/message_sent_webhook_event.rbi
197
198
  - rbi/surge_api/models/organization.rbi
198
199
  - rbi/surge_api/models/phone_number.rbi
200
+ - rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi
199
201
  - rbi/surge_api/models/phone_number_list_params.rbi
200
202
  - rbi/surge_api/models/phone_number_purchase_params.rbi
201
203
  - rbi/surge_api/models/recording_completed_webhook_event.rbi
@@ -285,6 +287,7 @@ files:
285
287
  - sig/surge_api/models/message_sent_webhook_event.rbs
286
288
  - sig/surge_api/models/organization.rbs
287
289
  - sig/surge_api/models/phone_number.rbs
290
+ - sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs
288
291
  - sig/surge_api/models/phone_number_list_params.rbs
289
292
  - sig/surge_api/models/phone_number_purchase_params.rbs
290
293
  - sig/surge_api/models/recording_completed_webhook_event.rbs