surge_api 0.14.0 → 0.16.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/lib/surge_api/client.rb +4 -0
  5. data/lib/surge_api/models/attachment_get_file_params.rb +14 -0
  6. data/lib/surge_api/models/attachment_get_file_response.rb +19 -0
  7. data/lib/surge_api/models/audience_create_params.rb +22 -0
  8. data/lib/surge_api/models/audience_create_response.rb +27 -0
  9. data/lib/surge_api/models/campaign_params.rb +12 -12
  10. data/lib/surge_api/models/campaign_update_params.rb +26 -0
  11. data/lib/surge_api/models/link_followed_webhook_event.rb +15 -5
  12. data/lib/surge_api/models/message.rb +9 -1
  13. data/lib/surge_api/models/phone_number.rb +9 -1
  14. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +9 -1
  15. data/lib/surge_api/models/phone_number_purchase_params.rb +10 -1
  16. data/lib/surge_api/models.rb +6 -0
  17. data/lib/surge_api/resources/attachments.rb +35 -0
  18. data/lib/surge_api/resources/audiences.rb +24 -0
  19. data/lib/surge_api/resources/campaigns.rb +35 -0
  20. data/lib/surge_api/resources/phone_numbers.rb +3 -1
  21. data/lib/surge_api/version.rb +1 -1
  22. data/lib/surge_api.rb +6 -0
  23. data/rbi/surge_api/client.rbi +3 -0
  24. data/rbi/surge_api/models/attachment_get_file_params.rbi +27 -0
  25. data/rbi/surge_api/models/attachment_get_file_response.rbi +34 -0
  26. data/rbi/surge_api/models/audience_create_params.rbi +40 -0
  27. data/rbi/surge_api/models/audience_create_response.rbi +37 -0
  28. data/rbi/surge_api/models/campaign_params.rbi +17 -20
  29. data/rbi/surge_api/models/campaign_update_params.rbi +60 -0
  30. data/rbi/surge_api/models/link_followed_webhook_event.rbi +26 -7
  31. data/rbi/surge_api/models/message.rbi +8 -0
  32. data/rbi/surge_api/models/phone_number.rbi +8 -0
  33. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +8 -0
  34. data/rbi/surge_api/models/phone_number_purchase_params.rbi +13 -0
  35. data/rbi/surge_api/models.rbi +6 -0
  36. data/rbi/surge_api/resources/attachments.rbi +27 -0
  37. data/rbi/surge_api/resources/audiences.rbi +17 -0
  38. data/rbi/surge_api/resources/campaigns.rbi +21 -0
  39. data/rbi/surge_api/resources/phone_numbers.rbi +4 -0
  40. data/sig/surge_api/client.rbs +2 -0
  41. data/sig/surge_api/models/attachment_get_file_params.rbs +15 -0
  42. data/sig/surge_api/models/attachment_get_file_response.rbs +13 -0
  43. data/sig/surge_api/models/audience_create_params.rbs +23 -0
  44. data/sig/surge_api/models/audience_create_response.rbs +15 -0
  45. data/sig/surge_api/models/campaign_params.rbs +8 -10
  46. data/sig/surge_api/models/campaign_update_params.rbs +28 -0
  47. data/sig/surge_api/models/link_followed_webhook_event.rbs +22 -4
  48. data/sig/surge_api/models/message.rbs +5 -0
  49. data/sig/surge_api/models/phone_number.rbs +5 -0
  50. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +5 -0
  51. data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
  52. data/sig/surge_api/models.rbs +6 -0
  53. data/sig/surge_api/resources/attachments.rbs +12 -0
  54. data/sig/surge_api/resources/audiences.rbs +6 -0
  55. data/sig/surge_api/resources/campaigns.rbs +6 -0
  56. data/sig/surge_api/resources/phone_numbers.rbs +1 -0
  57. metadata +20 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ab96cd22457002ccedc81712121dba63dbae5e4cf07727d9b993b92fd0969b0
4
- data.tar.gz: 1eb78284fdc3b52214c58857cd45cc36133b344e95a10066dbd4b2b89636354d
3
+ metadata.gz: 46beb8f51bbd1bbf30a337fd8f1bebec392a3e283b06663859e8c6fbc4418806
4
+ data.tar.gz: dd34d84097ceff18e2b17111d1513fa701d20079d4d90329f816eb3e89d14938
5
5
  SHA512:
6
- metadata.gz: 66e8cbb2c329875bd0eada2097083f37de865d9909c421cd8a40b05b003f6c79f2ed4bb0137ac2f77d8159077499f12371c0a59dd4a47316fc02fb4d3eb37f4d
7
- data.tar.gz: 51690c17e967f65a50ecde699f3ebd40b88dbc67bf53add883b147698c4fcb8e2477a12f346d4beb93d7d9ceda221b57c3e9a9604a0e3903eea2c954bc5b2fd1
6
+ metadata.gz: 6cf4a3222dd600709a14d8e718bb8bf04a9fd15650575914c136d11cb073e0d78724859e182b450ba7550fa46dfa8a2b3345e5e1175365477f9df729b992e385
7
+ data.tar.gz: ccb9085d52e5c8930568f9a511d6f6fe41e6f12f0aafacf515f201dde5c51d5ad04cb0d8341f4b7074eb7089e4c97dd69d35868ee9349c891abd5b588b522471
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.0 (2026-04-22)
4
+
5
+ Full Changelog: [v0.15.0...v0.16.0](https://github.com/surgeapi/ruby-sdk/compare/v0.15.0...v0.16.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add endpoint to get attachment file ([5475d91](https://github.com/surgeapi/ruby-sdk/commit/5475d91e283e6afb974243f11a259e9990471f88))
10
+ * **api:** add message to link.followed events ([1c36d5c](https://github.com/surgeapi/ruby-sdk/commit/1c36d5c6c21eb866aa5489ce0b70b01bfd01a9e4))
11
+ * **api:** add name to phone numbers ([ee71d0d](https://github.com/surgeapi/ruby-sdk/commit/ee71d0dcec71388ed0af4132759072cca94e11f0))
12
+
13
+ ## 0.15.0 (2026-04-06)
14
+
15
+ Full Changelog: [v0.14.0...v0.15.0](https://github.com/surgeapi/ruby-sdk/compare/v0.14.0...v0.15.0)
16
+
17
+ ### Features
18
+
19
+ * **api:** create an audience ([817fd30](https://github.com/surgeapi/ruby-sdk/commit/817fd3063e6346d452062fb720b42495f030d1e9))
20
+ * **api:** require terms_and_conditions_url for campaigns ([859ee36](https://github.com/surgeapi/ruby-sdk/commit/859ee3658653d0c0dfee2b7d6118e4adf7cb9c46))
21
+ * **api:** update a campaign ([b22a5e4](https://github.com/surgeapi/ruby-sdk/commit/b22a5e438e80654d4ea05572d4e54c32594eba22))
22
+
3
23
  ## 0.14.0 (2026-04-01)
4
24
 
5
25
  Full Changelog: [v0.13.0...v0.14.0](https://github.com/surgeapi/ruby-sdk/compare/v0.13.0...v0.14.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.14.0"
20
+ gem "surge_api", "~> 0.16.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -21,6 +21,9 @@ module SurgeAPI
21
21
  # @return [SurgeAPI::Resources::Accounts]
22
22
  attr_reader :accounts
23
23
 
24
+ # @return [SurgeAPI::Resources::Attachments]
25
+ attr_reader :attachments
26
+
24
27
  # @return [SurgeAPI::Resources::Audiences]
25
28
  attr_reader :audiences
26
29
 
@@ -99,6 +102,7 @@ module SurgeAPI
99
102
  )
100
103
 
101
104
  @accounts = SurgeAPI::Resources::Accounts.new(client: self)
105
+ @attachments = SurgeAPI::Resources::Attachments.new(client: self)
102
106
  @audiences = SurgeAPI::Resources::Audiences.new(client: self)
103
107
  @blasts = SurgeAPI::Resources::Blasts.new(client: self)
104
108
  @campaigns = SurgeAPI::Resources::Campaigns.new(client: self)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Attachments#get_file
6
+ class AttachmentGetFileParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Attachments#get_file
6
+ class AttachmentGetFileResponse < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute error
8
+ # An error response
9
+ #
10
+ # @return [SurgeAPI::Models::Error]
11
+ required :error, -> { SurgeAPI::Error }
12
+
13
+ # @!method initialize(error:)
14
+ # An error response
15
+ #
16
+ # @param error [SurgeAPI::Models::Error] An error response
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Audiences#create
6
+ class AudienceCreateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute name
11
+ # The audience name.
12
+ #
13
+ # @return [String]
14
+ required :name, String
15
+
16
+ # @!method initialize(name:, request_options: {})
17
+ # @param name [String] The audience name.
18
+ #
19
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Audiences#create
6
+ class AudienceCreateResponse < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Unique identifier for the object.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute name
14
+ # A name to identify this Audience. This name will only be visible within Surge.
15
+ #
16
+ # @return [String]
17
+ required :name, String
18
+
19
+ # @!method initialize(id:, name:)
20
+ # A group of contacts used for targeting messages.
21
+ #
22
+ # @param id [String] Unique identifier for the object.
23
+ #
24
+ # @param name [String] A name to identify this Audience. This name will only be visible within Surge.
25
+ end
26
+ end
27
+ end
@@ -50,6 +50,15 @@ module SurgeAPI
50
50
  # @return [String]
51
51
  required :privacy_policy_url, String
52
52
 
53
+ # @!attribute terms_and_conditions_url
54
+ # The URL of the terms and conditions presented to end users when they opt in to
55
+ # messaging. These terms and conditions may be shared among all of a platform's
56
+ # customers if they're the terms that are presented to end users when they opt in
57
+ # to messaging.
58
+ #
59
+ # @return [String]
60
+ required :terms_and_conditions_url, String
61
+
53
62
  # @!attribute use_cases
54
63
  # A list containing 1-5 types of messages that will be sent with this campaign.
55
64
  #
@@ -122,16 +131,7 @@ module SurgeAPI
122
131
  # @return [String, nil]
123
132
  optional :link_sample, String
124
133
 
125
- # @!attribute terms_and_conditions_url
126
- # The URL of the terms and conditions presented to end users when they opt in to
127
- # messaging. These terms and conditions may be shared among all of a platform's
128
- # customers if they're the terms that are presented to end users when they opt in
129
- # to messaging.
130
- #
131
- # @return [String, nil]
132
- optional :terms_and_conditions_url, String
133
-
134
- # @!method initialize(consent_flow:, description:, message_samples:, privacy_policy_url:, use_cases:, volume:, includes: nil, link_sample: nil, terms_and_conditions_url: nil)
134
+ # @!method initialize(consent_flow:, description:, message_samples:, privacy_policy_url:, terms_and_conditions_url:, use_cases:, volume:, includes: nil, link_sample: nil)
135
135
  # Some parameter documentations has been truncated, see
136
136
  # {SurgeAPI::Models::CampaignParams::StandardCampaignParams} for more details.
137
137
  #
@@ -145,6 +145,8 @@ module SurgeAPI
145
145
  #
146
146
  # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
147
147
  #
148
+ # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
149
+ #
148
150
  # @param use_cases [Array<Symbol, SurgeAPI::Models::CampaignParams::StandardCampaignParams::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
149
151
  #
150
152
  # @param volume [Symbol, SurgeAPI::Models::CampaignParams::StandardCampaignParams::Volume] This will be one of the following:
@@ -152,8 +154,6 @@ module SurgeAPI
152
154
  # @param includes [Array<Symbol, SurgeAPI::Models::CampaignParams::StandardCampaignParams::Include>] A list of properties that this campaign should include. These properties can be
153
155
  #
154
156
  # @param link_sample [String] A sample link that might be sent by this campaign. If links from other domains a
155
- #
156
- # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
157
157
 
158
158
  module UseCase
159
159
  extend SurgeAPI::Internal::Type::Enum
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Campaigns#update
6
+ class CampaignUpdateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute campaign_params
11
+ # Parameters for creating a new campaign. Either provide full campaign details or
12
+ # import using a TCR ID.
13
+ #
14
+ # @return [SurgeAPI::Models::CampaignParams::StandardCampaignParams, SurgeAPI::Models::CampaignParams::ExternalCampaignParams]
15
+ required :campaign_params, union: -> { SurgeAPI::CampaignParams }
16
+
17
+ # @!method initialize(campaign_params:, request_options: {})
18
+ # Some parameter documentations has been truncated, see
19
+ # {SurgeAPI::Models::CampaignUpdateParams} for more details.
20
+ #
21
+ # @param campaign_params [SurgeAPI::Models::CampaignParams::StandardCampaignParams, SurgeAPI::Models::CampaignParams::ExternalCampaignParams] Parameters for creating a new campaign. Either provide full campaign details or
22
+ #
23
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
24
+ end
25
+ end
26
+ end
@@ -44,11 +44,19 @@ module SurgeAPI
44
44
  # @return [String]
45
45
  required :id, String
46
46
 
47
+ # @!attribute message
48
+ # A Message is a communication sent to a Contact.
49
+ #
50
+ # @return [SurgeAPI::Models::Message, nil]
51
+ required :message, -> { SurgeAPI::Message }, nil?: true
52
+
47
53
  # @!attribute message_id
48
- # The unique identifier for the message that contained the link
54
+ # @deprecated Use `message.id` instead.
49
55
  #
50
- # @return [String]
51
- required :message_id, String
56
+ # Deprecated. The unique identifier for the message that contained the link.
57
+ #
58
+ # @return [String, nil]
59
+ required :message_id, String, nil?: true
52
60
 
53
61
  # @!attribute url
54
62
  # The original URL that was shortened
@@ -56,12 +64,14 @@ module SurgeAPI
56
64
  # @return [String]
57
65
  required :url, String
58
66
 
59
- # @!method initialize(id:, message_id:, url:)
67
+ # @!method initialize(id:, message:, message_id:, url:)
60
68
  # The data associated with the event
61
69
  #
62
70
  # @param id [String] The unique identifier for the link
63
71
  #
64
- # @param message_id [String] The unique identifier for the message that contained the link
72
+ # @param message [SurgeAPI::Models::Message, nil] A Message is a communication sent to a Contact.
73
+ #
74
+ # @param message_id [String, nil] Deprecated. The unique identifier for the message that contained the link.
65
75
  #
66
76
  # @param url [String] The original URL that was shortened
67
77
  end
@@ -139,6 +139,12 @@ module SurgeAPI
139
139
  # @return [String]
140
140
  required :id, String
141
141
 
142
+ # @!attribute name
143
+ # A human-readable name for the phone number
144
+ #
145
+ # @return [String, nil]
146
+ required :name, String, nil?: true
147
+
142
148
  # @!attribute number
143
149
  # The canonical format of the phone number.
144
150
  #
@@ -151,11 +157,13 @@ module SurgeAPI
151
157
  # @return [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type]
152
158
  required :type, enum: -> { SurgeAPI::Message::Conversation::PhoneNumber::Type }
153
159
 
154
- # @!method initialize(id:, number:, type:)
160
+ # @!method initialize(id:, name:, number:, type:)
155
161
  # This is the phone number tied to the Surge account.
156
162
  #
157
163
  # @param id [String] Unique identifier for the phone number
158
164
  #
165
+ # @param name [String, nil] A human-readable name for the phone number
166
+ #
159
167
  # @param number [String] The canonical format of the phone number.
160
168
  #
161
169
  # @param type [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
@@ -16,6 +16,12 @@ module SurgeAPI
16
16
  # @return [String, nil]
17
17
  required :campaign_id, String, nil?: true
18
18
 
19
+ # @!attribute name
20
+ # A human-readable name for the phone number
21
+ #
22
+ # @return [String, nil]
23
+ required :name, String, nil?: true
24
+
19
25
  # @!attribute number
20
26
  # The phone number in E.164 format
21
27
  #
@@ -28,13 +34,15 @@ module SurgeAPI
28
34
  # @return [Symbol, SurgeAPI::Models::PhoneNumber::Type]
29
35
  required :type, enum: -> { SurgeAPI::PhoneNumber::Type }
30
36
 
31
- # @!method initialize(id:, campaign_id:, number:, type:)
37
+ # @!method initialize(id:, campaign_id:, name:, number:, type:)
32
38
  # A phone number that can be used to send and receive messages and calls
33
39
  #
34
40
  # @param id [String] Unique identifier for the phone number
35
41
  #
36
42
  # @param campaign_id [String, nil] The unique identifier of the campaign this phone number is attached to, if any
37
43
  #
44
+ # @param name [String, nil] A human-readable name for the phone number
45
+ #
38
46
  # @param number [String] The phone number in E.164 format
39
47
  #
40
48
  # @param type [Symbol, SurgeAPI::Models::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
@@ -54,6 +54,12 @@ module SurgeAPI
54
54
  # @return [String]
55
55
  required :campaign_id, String
56
56
 
57
+ # @!attribute name
58
+ # A human-readable name for the phone number
59
+ #
60
+ # @return [String, nil]
61
+ required :name, String, nil?: true
62
+
57
63
  # @!attribute number
58
64
  # The phone number in E.164 format
59
65
  #
@@ -66,13 +72,15 @@ module SurgeAPI
66
72
  # @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type]
67
73
  required :type, enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type }
68
74
 
69
- # @!method initialize(id:, campaign_id:, number:, type:)
75
+ # @!method initialize(id:, campaign_id:, name:, number:, type:)
70
76
  # The data associated with the event
71
77
  #
72
78
  # @param id [String] The unique identifier for the phone number
73
79
  #
74
80
  # @param campaign_id [String] The unique identifier of the campaign this phone number is attached to
75
81
  #
82
+ # @param name [String, nil] A human-readable name for the phone number
83
+ #
76
84
  # @param number [String] The phone number in E.164 format
77
85
  #
78
86
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type] Whether the phone number is local, toll-free, or short code
@@ -28,6 +28,13 @@ module SurgeAPI
28
28
  # @return [Float, nil]
29
29
  optional :longitude, Float
30
30
 
31
+ # @!attribute name
32
+ # A human-readable name for the phone number. If not provided, defaults to the
33
+ # formatted phone number.
34
+ #
35
+ # @return [String, nil]
36
+ optional :name, String
37
+
31
38
  # @!attribute type
32
39
  # Whether the phone number is local or toll-free. Can be omitted if area_code or
33
40
  # latitude/longitude are provided.
@@ -35,7 +42,7 @@ module SurgeAPI
35
42
  # @return [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type, nil]
36
43
  optional :type, enum: -> { SurgeAPI::PhoneNumberPurchaseParams::Type }
37
44
 
38
- # @!method initialize(area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {})
45
+ # @!method initialize(area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
39
46
  # Some parameter documentations has been truncated, see
40
47
  # {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
41
48
  #
@@ -45,6 +52,8 @@ module SurgeAPI
45
52
  #
46
53
  # @param longitude [Float] Longitude to search for nearby phone numbers. Must be used with latitude. If pro
47
54
  #
55
+ # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
56
+ #
48
57
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
49
58
  #
50
59
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
@@ -51,8 +51,12 @@ module SurgeAPI
51
51
 
52
52
  AccountUpdateParams = SurgeAPI::Models::AccountUpdateParams
53
53
 
54
+ AttachmentGetFileParams = SurgeAPI::Models::AttachmentGetFileParams
55
+
54
56
  AudienceAddContactParams = SurgeAPI::Models::AudienceAddContactParams
55
57
 
58
+ AudienceCreateParams = SurgeAPI::Models::AudienceCreateParams
59
+
56
60
  AudienceListContactsParams = SurgeAPI::Models::AudienceListContactsParams
57
61
 
58
62
  Blast = SurgeAPI::Models::Blast
@@ -73,6 +77,8 @@ module SurgeAPI
73
77
 
74
78
  CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
75
79
 
80
+ CampaignUpdateParams = SurgeAPI::Models::CampaignUpdateParams
81
+
76
82
  Contact = SurgeAPI::Models::Contact
77
83
 
78
84
  ContactCreateParams = SurgeAPI::Models::ContactCreateParams
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class Attachments
6
+ # Redirects to a signed URL where the attachment file can be downloaded. URL is
7
+ # short-lived, so redirect should be followed immediately.
8
+ #
9
+ # @overload get_file(attachment_id, request_options: {})
10
+ #
11
+ # @param attachment_id [String] The ID of the attachment.
12
+ #
13
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
14
+ #
15
+ # @return [SurgeAPI::Models::AttachmentGetFileResponse]
16
+ #
17
+ # @see SurgeAPI::Models::AttachmentGetFileParams
18
+ def get_file(attachment_id, params = {})
19
+ @client.request(
20
+ method: :get,
21
+ path: ["attachments/%1$s/file", attachment_id],
22
+ model: SurgeAPI::Models::AttachmentGetFileResponse,
23
+ options: params[:request_options]
24
+ )
25
+ end
26
+
27
+ # @api private
28
+ #
29
+ # @param client [SurgeAPI::Client]
30
+ def initialize(client:)
31
+ @client = client
32
+ end
33
+ end
34
+ end
35
+ end
@@ -3,6 +3,30 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class Audiences
6
+ # Creates a new audience.
7
+ #
8
+ # @overload create(account_id, name:, request_options: {})
9
+ #
10
+ # @param account_id [String] The account for which the audience should be created.
11
+ #
12
+ # @param name [String] The audience name.
13
+ #
14
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
15
+ #
16
+ # @return [SurgeAPI::Models::AudienceCreateResponse]
17
+ #
18
+ # @see SurgeAPI::Models::AudienceCreateParams
19
+ def create(account_id, params)
20
+ parsed, options = SurgeAPI::AudienceCreateParams.dump_request(params)
21
+ @client.request(
22
+ method: :post,
23
+ path: ["accounts/%1$s/audiences", account_id],
24
+ body: parsed,
25
+ model: SurgeAPI::Models::AudienceCreateResponse,
26
+ options: options
27
+ )
28
+ end
29
+
6
30
  # Some parameter documentations has been truncated, see
7
31
  # {SurgeAPI::Models::AudienceAddContactParams} for more details.
8
32
  #
@@ -55,6 +55,41 @@ module SurgeAPI
55
55
  )
56
56
  end
57
57
 
58
+ # Some parameter documentations has been truncated, see
59
+ # {SurgeAPI::Models::CampaignUpdateParams} for more details.
60
+ #
61
+ # Updates a campaign that has not yet been approved. This can be used to fix
62
+ # issues flagged during review and resubmit the campaign. Returns an error if the
63
+ # campaign is currently in review, has already been approved, or has been
64
+ # deactivated.
65
+ #
66
+ # @overload update(id, campaign_params:, request_options: {})
67
+ #
68
+ # @param id [String] The ID of the campaign to update.
69
+ #
70
+ # @param campaign_params [SurgeAPI::CampaignParams] Parameters for creating a new campaign. Either provide full campaign details or
71
+ #
72
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
73
+ #
74
+ # @return [SurgeAPI::Models::Campaign]
75
+ #
76
+ # @see SurgeAPI::Models::CampaignUpdateParams
77
+ def update(id, params)
78
+ parsed, options = SurgeAPI::CampaignUpdateParams.dump_request(params)
79
+ case parsed
80
+ in {campaign_params: Hash => union, **rest}
81
+ parsed = {**rest, **union}
82
+ else
83
+ end
84
+ @client.request(
85
+ method: :patch,
86
+ path: ["campaigns/%1$s", id],
87
+ body: parsed,
88
+ model: SurgeAPI::Campaign,
89
+ options: options
90
+ )
91
+ end
92
+
58
93
  # Some parameter documentations has been truncated, see
59
94
  # {SurgeAPI::Models::CampaignListParams} for more details.
60
95
  #
@@ -40,7 +40,7 @@ module SurgeAPI
40
40
  # Purchase a new phone number for the account. You can specify search criteria or
41
41
  # let the system select a random number.
42
42
  #
43
- # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {})
43
+ # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
44
44
  #
45
45
  # @param account_id [String] The account for which the phone number should be created.
46
46
  #
@@ -50,6 +50,8 @@ module SurgeAPI
50
50
  #
51
51
  # @param longitude [Float] Longitude to search for nearby phone numbers. Must be used with latitude. If pro
52
52
  #
53
+ # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
54
+ #
53
55
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
54
56
  #
55
57
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.14.0"
4
+ VERSION = "0.16.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -61,7 +61,11 @@ require_relative "surge_api/models/account_create_params"
61
61
  require_relative "surge_api/models/account_retrieve_status_params"
62
62
  require_relative "surge_api/models/account_status"
63
63
  require_relative "surge_api/models/account_update_params"
64
+ require_relative "surge_api/models/attachment_get_file_params"
65
+ require_relative "surge_api/models/attachment_get_file_response"
64
66
  require_relative "surge_api/models/audience_add_contact_params"
67
+ require_relative "surge_api/models/audience_create_params"
68
+ require_relative "surge_api/models/audience_create_response"
65
69
  require_relative "surge_api/models/audience_list_contacts_params"
66
70
  require_relative "surge_api/models/blast"
67
71
  require_relative "surge_api/models/blast_create_params"
@@ -71,6 +75,7 @@ require_relative "surge_api/models/campaign_approved_webhook_event"
71
75
  require_relative "surge_api/models/campaign_create_params"
72
76
  require_relative "surge_api/models/campaign_list_params"
73
77
  require_relative "surge_api/models/campaign_retrieve_params"
78
+ require_relative "surge_api/models/campaign_update_params"
74
79
  require_relative "surge_api/models/contact"
75
80
  require_relative "surge_api/models/contact_create_params"
76
81
  require_relative "surge_api/models/contact_list_params"
@@ -120,6 +125,7 @@ require_relative "surge_api/models/voicemail_received_webhook_event"
120
125
  require_relative "surge_api/models/webhook_unwrap_params"
121
126
  require_relative "surge_api/models"
122
127
  require_relative "surge_api/resources/accounts"
128
+ require_relative "surge_api/resources/attachments"
123
129
  require_relative "surge_api/resources/audiences"
124
130
  require_relative "surge_api/resources/blasts"
125
131
  require_relative "surge_api/resources/campaigns"
@@ -16,6 +16,9 @@ module SurgeAPI
16
16
  sig { returns(SurgeAPI::Resources::Accounts) }
17
17
  attr_reader :accounts
18
18
 
19
+ sig { returns(SurgeAPI::Resources::Attachments) }
20
+ attr_reader :attachments
21
+
19
22
  sig { returns(SurgeAPI::Resources::Audiences) }
20
23
  attr_reader :audiences
21
24
 
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class AttachmentGetFileParams < SurgeAPI::Internal::Type::BaseModel
6
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
7
+ include SurgeAPI::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(SurgeAPI::AttachmentGetFileParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class AttachmentGetFileResponse < SurgeAPI::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SurgeAPI::Models::AttachmentGetFileResponse,
10
+ SurgeAPI::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # An error response
15
+ sig { returns(SurgeAPI::Error) }
16
+ attr_reader :error
17
+
18
+ sig { params(error: SurgeAPI::Error::OrHash).void }
19
+ attr_writer :error
20
+
21
+ # An error response
22
+ sig { params(error: SurgeAPI::Error::OrHash).returns(T.attached_class) }
23
+ def self.new(
24
+ # An error response
25
+ error:
26
+ )
27
+ end
28
+
29
+ sig { override.returns({ error: SurgeAPI::Error }) }
30
+ def to_hash
31
+ end
32
+ end
33
+ end
34
+ end