surge_api 0.23.0 → 0.25.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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +9 -9
  4. data/lib/surge_api/client.rb +4 -0
  5. data/lib/surge_api/internal/type/union.rb +2 -2
  6. data/lib/surge_api/models/account_retrieve_status_params.rb +1 -0
  7. data/lib/surge_api/models/call_ended_webhook_event.rb +8 -3
  8. data/lib/surge_api/models/campaign.rb +21 -13
  9. data/lib/surge_api/models/campaign_approved_webhook_event.rb +9 -1
  10. data/lib/surge_api/models/campaign_params.rb +11 -12
  11. data/lib/surge_api/models/campaign_rejected_webhook_event.rb +135 -0
  12. data/lib/surge_api/models/campaign_submitted_webhook_event.rb +74 -0
  13. data/lib/surge_api/models/campaign_update_params.rb +188 -1
  14. data/lib/surge_api/models/campaign_warning_webhook_event.rb +134 -0
  15. data/lib/surge_api/models/message.rb +42 -2
  16. data/lib/surge_api/models/message_delivered_webhook_event.rb +29 -1
  17. data/lib/surge_api/models/message_failed_webhook_event.rb +26 -5
  18. data/lib/surge_api/models/message_received_webhook_event.rb +29 -1
  19. data/lib/surge_api/models/message_sent_webhook_event.rb +29 -1
  20. data/lib/surge_api/models/phone_number.rb +9 -1
  21. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +9 -1
  22. data/lib/surge_api/models/phone_number_imported_webhook_event.rb +160 -0
  23. data/lib/surge_api/models/phone_number_purchase_params.rb +9 -1
  24. data/lib/surge_api/models/phone_number_update_params.rb +9 -1
  25. data/lib/surge_api/models/toll_free_campaign.rb +132 -0
  26. data/lib/surge_api/models/toll_free_campaign_consent_flow.rb +176 -0
  27. data/lib/surge_api/models/toll_free_campaign_create_params.rb +22 -0
  28. data/lib/surge_api/models/toll_free_campaign_list_params.rb +42 -0
  29. data/lib/surge_api/models/toll_free_campaign_params.rb +286 -0
  30. data/lib/surge_api/models/toll_free_campaign_retrieve_params.rb +22 -0
  31. data/lib/surge_api/models/toll_free_campaign_update_params.rb +278 -0
  32. data/lib/surge_api/models/unwrap_webhook_event.rb +9 -1
  33. data/lib/surge_api/models/user_create_token_params.rb +15 -1
  34. data/lib/surge_api/models.rb +22 -0
  35. data/lib/surge_api/resources/accounts.rb +2 -2
  36. data/lib/surge_api/resources/campaigns.rb +26 -8
  37. data/lib/surge_api/resources/phone_numbers.rb +6 -2
  38. data/lib/surge_api/resources/toll_free_campaigns.rb +140 -0
  39. data/lib/surge_api/resources/users.rb +6 -1
  40. data/lib/surge_api/resources/webhooks.rb +1 -1
  41. data/lib/surge_api/version.rb +1 -1
  42. data/lib/surge_api.rb +12 -0
  43. data/rbi/surge_api/client.rbi +3 -0
  44. data/rbi/surge_api/models/account_retrieve_status_params.rbi +5 -0
  45. data/rbi/surge_api/models/call_ended_webhook_event.rbi +6 -3
  46. data/rbi/surge_api/models/campaign.rbi +26 -19
  47. data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +8 -0
  48. data/rbi/surge_api/models/campaign_params.rbi +17 -19
  49. data/rbi/surge_api/models/campaign_rejected_webhook_event.rbi +269 -0
  50. data/rbi/surge_api/models/campaign_submitted_webhook_event.rbi +149 -0
  51. data/rbi/surge_api/models/campaign_update_params.rbi +378 -1
  52. data/rbi/surge_api/models/campaign_warning_webhook_event.rbi +259 -0
  53. data/rbi/surge_api/models/message.rbi +50 -3
  54. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +52 -0
  55. data/rbi/surge_api/models/message_failed_webhook_event.rbi +47 -5
  56. data/rbi/surge_api/models/message_received_webhook_event.rbi +49 -0
  57. data/rbi/surge_api/models/message_sent_webhook_event.rbi +46 -0
  58. data/rbi/surge_api/models/phone_number.rbi +8 -0
  59. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +8 -0
  60. data/rbi/surge_api/models/phone_number_imported_webhook_event.rbi +318 -0
  61. data/rbi/surge_api/models/phone_number_purchase_params.rbi +11 -0
  62. data/rbi/surge_api/models/phone_number_update_params.rbi +11 -0
  63. data/rbi/surge_api/models/toll_free_campaign.rbi +230 -0
  64. data/rbi/surge_api/models/toll_free_campaign_consent_flow.rbi +476 -0
  65. data/rbi/surge_api/models/toll_free_campaign_create_params.rbi +43 -0
  66. data/rbi/surge_api/models/toll_free_campaign_list_params.rbi +70 -0
  67. data/rbi/surge_api/models/toll_free_campaign_params.rbi +711 -0
  68. data/rbi/surge_api/models/toll_free_campaign_retrieve_params.rbi +43 -0
  69. data/rbi/surge_api/models/toll_free_campaign_update_params.rbi +760 -0
  70. data/rbi/surge_api/models/unwrap_webhook_event.rbi +4 -0
  71. data/rbi/surge_api/models/user_create_token_params.rbi +17 -0
  72. data/rbi/surge_api/models.rbi +25 -0
  73. data/rbi/surge_api/resources/accounts.rbi +2 -2
  74. data/rbi/surge_api/resources/campaigns.rbi +94 -12
  75. data/rbi/surge_api/resources/phone_numbers.rbi +6 -0
  76. data/rbi/surge_api/resources/toll_free_campaigns.rbi +129 -0
  77. data/rbi/surge_api/resources/users.rbi +6 -0
  78. data/rbi/surge_api/resources/webhooks.rbi +4 -0
  79. data/sig/surge_api/client.rbs +2 -0
  80. data/sig/surge_api/models/account_retrieve_status_params.rbs +2 -1
  81. data/sig/surge_api/models/campaign.rbs +8 -1
  82. data/sig/surge_api/models/campaign_approved_webhook_event.rbs +5 -0
  83. data/sig/surge_api/models/campaign_rejected_webhook_event.rbs +115 -0
  84. data/sig/surge_api/models/campaign_submitted_webhook_event.rbs +67 -0
  85. data/sig/surge_api/models/campaign_update_params.rbs +128 -2
  86. data/sig/surge_api/models/campaign_warning_webhook_event.rbs +114 -0
  87. data/sig/surge_api/models/message.rbs +36 -3
  88. data/sig/surge_api/models/message_delivered_webhook_event.rbs +20 -0
  89. data/sig/surge_api/models/message_failed_webhook_event.rbs +19 -4
  90. data/sig/surge_api/models/message_received_webhook_event.rbs +20 -0
  91. data/sig/surge_api/models/message_sent_webhook_event.rbs +20 -0
  92. data/sig/surge_api/models/phone_number.rbs +5 -0
  93. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +5 -0
  94. data/sig/surge_api/models/phone_number_imported_webhook_event.rbs +130 -0
  95. data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
  96. data/sig/surge_api/models/phone_number_update_params.rbs +12 -1
  97. data/sig/surge_api/models/toll_free_campaign.rbs +126 -0
  98. data/sig/surge_api/models/toll_free_campaign_consent_flow.rbs +207 -0
  99. data/sig/surge_api/models/toll_free_campaign_create_params.rbs +25 -0
  100. data/sig/surge_api/models/toll_free_campaign_list_params.rbs +36 -0
  101. data/sig/surge_api/models/toll_free_campaign_params.rbs +321 -0
  102. data/sig/surge_api/models/toll_free_campaign_retrieve_params.rbs +23 -0
  103. data/sig/surge_api/models/toll_free_campaign_update_params.rbs +332 -0
  104. data/sig/surge_api/models/unwrap_webhook_event.rbs +4 -0
  105. data/sig/surge_api/models/user_create_token_params.rbs +7 -1
  106. data/sig/surge_api/models.rbs +22 -0
  107. data/sig/surge_api/resources/campaigns.rbs +9 -1
  108. data/sig/surge_api/resources/phone_numbers.rbs +2 -0
  109. data/sig/surge_api/resources/toll_free_campaigns.rbs +44 -0
  110. data/sig/surge_api/resources/users.rbs +1 -0
  111. data/sig/surge_api/resources/webhooks.rbs +4 -0
  112. metadata +53 -7
@@ -79,13 +79,19 @@ module SurgeAPI
79
79
 
80
80
  CampaignParams = SurgeAPI::Models::CampaignParams
81
81
 
82
+ CampaignRejectedWebhookEvent = SurgeAPI::Models::CampaignRejectedWebhookEvent
83
+
82
84
  CampaignResendBrandVerificationMessageParams =
83
85
  SurgeAPI::Models::CampaignResendBrandVerificationMessageParams
84
86
 
85
87
  CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
86
88
 
89
+ CampaignSubmittedWebhookEvent = SurgeAPI::Models::CampaignSubmittedWebhookEvent
90
+
87
91
  CampaignUpdateParams = SurgeAPI::Models::CampaignUpdateParams
88
92
 
93
+ CampaignWarningWebhookEvent = SurgeAPI::Models::CampaignWarningWebhookEvent
94
+
89
95
  Contact = SurgeAPI::Models::Contact
90
96
 
91
97
  ContactCreateParams = SurgeAPI::Models::ContactCreateParams
@@ -130,6 +136,8 @@ module SurgeAPI
130
136
 
131
137
  PhoneNumberAttachedToCampaignWebhookEvent = SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
132
138
 
139
+ PhoneNumberImportedWebhookEvent = SurgeAPI::Models::PhoneNumberImportedWebhookEvent
140
+
133
141
  PhoneNumberListAvailableNumbersParams = SurgeAPI::Models::PhoneNumberListAvailableNumbersParams
134
142
 
135
143
  PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
@@ -152,6 +160,20 @@ module SurgeAPI
152
160
 
153
161
  RecordingRetrieveParams = SurgeAPI::Models::RecordingRetrieveParams
154
162
 
163
+ TollFreeCampaign = SurgeAPI::Models::TollFreeCampaign
164
+
165
+ TollFreeCampaignConsentFlow = SurgeAPI::Models::TollFreeCampaignConsentFlow
166
+
167
+ TollFreeCampaignCreateParams = SurgeAPI::Models::TollFreeCampaignCreateParams
168
+
169
+ TollFreeCampaignListParams = SurgeAPI::Models::TollFreeCampaignListParams
170
+
171
+ TollFreeCampaignParams = SurgeAPI::Models::TollFreeCampaignParams
172
+
173
+ TollFreeCampaignRetrieveParams = SurgeAPI::Models::TollFreeCampaignRetrieveParams
174
+
175
+ TollFreeCampaignUpdateParams = SurgeAPI::Models::TollFreeCampaignUpdateParams
176
+
155
177
  UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
156
178
 
157
179
  User = SurgeAPI::Models::User
@@ -6,7 +6,7 @@ module SurgeAPI
6
6
  # Some parameter documentations has been truncated, see
7
7
  # {SurgeAPI::Models::AccountCreateParams} for more details.
8
8
  #
9
- # Creates a new Account within the calling Platform.
9
+ # Creates a new Account.
10
10
  #
11
11
  # @overload create(name:, brand_name: nil, organization: nil, time_zone: nil, request_options: {})
12
12
  #
@@ -90,7 +90,7 @@ module SurgeAPI
90
90
  # Some parameter documentations has been truncated, see
91
91
  # {SurgeAPI::Models::AccountListParams} for more details.
92
92
  #
93
- # List all accounts for the calling platform with cursor-based pagination.
93
+ # List all accounts with cursor-based pagination.
94
94
  #
95
95
  # @overload list(after: nil, before: nil, request_options: {})
96
96
  #
@@ -53,28 +53,46 @@ module SurgeAPI
53
53
  # Some parameter documentations has been truncated, see
54
54
  # {SurgeAPI::Models::CampaignUpdateParams} for more details.
55
55
  #
56
- # Updates a campaign that has not yet been approved. This can be used to fix
57
- # issues flagged during review and resubmit the campaign. Returns an error if the
58
- # campaign is currently in review, has already been approved, or has been
59
- # deactivated.
56
+ # Updates supplied fields on a campaign and submits it for review. Omitted fields
57
+ # retain their stored values. An empty object or empty request body resubmits the
58
+ # existing campaign without changing its registration details. Supplied arrays
59
+ # replace their stored values; an empty includes array clears all inclusion flags.
60
+ # Returns an error if the resulting campaign is incomplete or invalid, or the
61
+ # campaign is not editable.
60
62
  #
61
- # @overload update(id, campaign_params:, request_options: {})
63
+ # @overload update(id, consent_flow: nil, description: nil, includes: nil, link_sample: nil, message_samples: nil, privacy_policy_url: nil, terms_and_conditions_url: nil, use_cases: nil, volume: nil, request_options: {})
62
64
  #
63
65
  # @param id [String] The ID of the campaign to update.
64
66
  #
65
- # @param campaign_params [SurgeAPI::Models::CampaignParams::StandardCampaignParams, SurgeAPI::Models::CampaignParams::ExternalCampaignParams] Parameters for creating a new campaign. Either provide full campaign details or
67
+ # @param consent_flow [String] A string explaining the method through which end users will opt in to receive me
68
+ #
69
+ # @param description [String] An explanation of the organization's purpose and how it will be using text messa
70
+ #
71
+ # @param includes [Array<Symbol, SurgeAPI::Models::CampaignUpdateParams::Include>] A list of properties that this campaign should include. These properties can be
72
+ #
73
+ # @param link_sample [String, nil] A sample link that might be sent by this campaign. This is required when `includ
74
+ #
75
+ # @param message_samples [Array<String>] An array of 2-5 strings with examples of the messages that will be sent from thi
76
+ #
77
+ # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
78
+ #
79
+ # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
80
+ #
81
+ # @param use_cases [Array<Symbol, SurgeAPI::Models::CampaignUpdateParams::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
82
+ #
83
+ # @param volume [Symbol, SurgeAPI::Models::CampaignUpdateParams::Volume] This will be one of the following:
66
84
  #
67
85
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
68
86
  #
69
87
  # @return [SurgeAPI::Models::Campaign]
70
88
  #
71
89
  # @see SurgeAPI::Models::CampaignUpdateParams
72
- def update(id, params)
90
+ def update(id, params = {})
73
91
  parsed, options = SurgeAPI::CampaignUpdateParams.dump_request(params)
74
92
  @client.request(
75
93
  method: :patch,
76
94
  path: ["campaigns/%1$s", id],
77
- body: parsed[:campaign_params],
95
+ body: parsed,
78
96
  model: SurgeAPI::Campaign,
79
97
  options: options
80
98
  )
@@ -25,12 +25,14 @@ module SurgeAPI
25
25
 
26
26
  # Updates a phone number's details.
27
27
  #
28
- # @overload update(id, campaign_id: nil, name: nil, request_options: {})
28
+ # @overload update(id, campaign_id: nil, metadata: nil, name: nil, request_options: {})
29
29
  #
30
30
  # @param id [String] The ID of the phone number to update.
31
31
  #
32
32
  # @param campaign_id [String] Campaign ID to attach this number to (`cpn_...`).
33
33
  #
34
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
35
+ #
34
36
  # @param name [String] A human-readable name for the phone number.
35
37
  #
36
38
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -127,7 +129,7 @@ module SurgeAPI
127
129
  #
128
130
  # When `phone_number` is provided, all other search parameters are ignored.
129
131
  #
130
- # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, phone_number: nil, type: nil, request_options: {})
132
+ # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, metadata: nil, name: nil, phone_number: nil, type: nil, request_options: {})
131
133
  #
132
134
  # @param account_id [String] The account for which the phone number should be created.
133
135
  #
@@ -137,6 +139,8 @@ module SurgeAPI
137
139
  #
138
140
  # @param longitude [Float] Longitude to search for nearby phone numbers. Must be used with latitude. If pro
139
141
  #
142
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
143
+ #
140
144
  # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
141
145
  #
142
146
  # @param phone_number [String] The exact phone number to purchase in E.164 format. When provided, all other sea
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class TollFreeCampaigns
6
+ # Creates a toll-free campaign and submits it for Surge review.
7
+ #
8
+ # @overload create(account_id, consent_flows:, description:, message_samples:, phone_number_id:, privacy_policy_url:, terms_and_conditions_url:, use_cases:, includes: nil, request_options: {})
9
+ #
10
+ # @param account_id [String] The account for which the toll-free campaign should be created.
11
+ #
12
+ # @param consent_flows [Array<SurgeAPI::Models::TollFreeCampaignParams::ConsentFlow::UnionMember0, SurgeAPI::Models::TollFreeCampaignParams::ConsentFlow::UnionMember1, SurgeAPI::Models::TollFreeCampaignParams::ConsentFlow::UnionMember2, SurgeAPI::Models::TollFreeCampaignParams::ConsentFlow::UnionMember3>]
13
+ #
14
+ # @param description [String] An explanation of how the toll-free number will be used.
15
+ #
16
+ # @param message_samples [Array<String>]
17
+ #
18
+ # @param phone_number_id [String] The toll-free phone number to register.
19
+ #
20
+ # @param privacy_policy_url [String]
21
+ #
22
+ # @param terms_and_conditions_url [String]
23
+ #
24
+ # @param use_cases [Array<Symbol, SurgeAPI::Models::TollFreeCampaignParams::UseCase>]
25
+ #
26
+ # @param includes [Array<Symbol, SurgeAPI::Models::TollFreeCampaignParams::Include>]
27
+ #
28
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
29
+ #
30
+ # @return [SurgeAPI::Models::TollFreeCampaign]
31
+ #
32
+ # @see SurgeAPI::Models::TollFreeCampaignCreateParams
33
+ def create(account_id, params)
34
+ parsed, options = SurgeAPI::TollFreeCampaignCreateParams.dump_request(params)
35
+ @client.request(
36
+ method: :post,
37
+ path: ["accounts/%1$s/toll_free_campaigns", account_id],
38
+ body: parsed,
39
+ model: SurgeAPI::TollFreeCampaign,
40
+ options: options
41
+ )
42
+ end
43
+
44
+ # Retrieves a toll-free campaign object.
45
+ #
46
+ # @overload retrieve(campaign_id, request_options: {})
47
+ #
48
+ # @param campaign_id [String] The ID of the toll-free campaign to retrieve.
49
+ #
50
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
51
+ #
52
+ # @return [SurgeAPI::Models::TollFreeCampaign]
53
+ #
54
+ # @see SurgeAPI::Models::TollFreeCampaignRetrieveParams
55
+ def retrieve(campaign_id, params = {})
56
+ @client.request(
57
+ method: :get,
58
+ path: ["toll_free_campaigns/%1$s", campaign_id],
59
+ model: SurgeAPI::TollFreeCampaign,
60
+ options: params[:request_options]
61
+ )
62
+ end
63
+
64
+ # Updates a toll-free campaign awaiting customer fixes and re-submits it for Surge
65
+ # review. Returns 409 if the campaign is not in an updatable status.
66
+ #
67
+ # @overload update(campaign_id, consent_flows: nil, description: nil, includes: nil, message_samples: nil, privacy_policy_url: nil, terms_and_conditions_url: nil, use_cases: nil, request_options: {})
68
+ #
69
+ # @param campaign_id [String] The toll-free campaign ID to update.
70
+ #
71
+ # @param consent_flows [Array<SurgeAPI::Models::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember0, SurgeAPI::Models::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember1, SurgeAPI::Models::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember2, SurgeAPI::Models::TollFreeCampaignUpdateParams::ConsentFlow::UnionMember3>]
72
+ #
73
+ # @param description [String] An explanation of how the toll-free number will be used.
74
+ #
75
+ # @param includes [Array<Symbol, SurgeAPI::Models::TollFreeCampaignUpdateParams::Include>]
76
+ #
77
+ # @param message_samples [Array<String>]
78
+ #
79
+ # @param privacy_policy_url [String]
80
+ #
81
+ # @param terms_and_conditions_url [String]
82
+ #
83
+ # @param use_cases [Array<Symbol, SurgeAPI::Models::TollFreeCampaignUpdateParams::UseCase>]
84
+ #
85
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
86
+ #
87
+ # @return [SurgeAPI::Models::TollFreeCampaign]
88
+ #
89
+ # @see SurgeAPI::Models::TollFreeCampaignUpdateParams
90
+ def update(campaign_id, params = {})
91
+ parsed, options = SurgeAPI::TollFreeCampaignUpdateParams.dump_request(params)
92
+ @client.request(
93
+ method: :patch,
94
+ path: ["toll_free_campaigns/%1$s", campaign_id],
95
+ body: parsed,
96
+ model: SurgeAPI::TollFreeCampaign,
97
+ options: options
98
+ )
99
+ end
100
+
101
+ # Some parameter documentations has been truncated, see
102
+ # {SurgeAPI::Models::TollFreeCampaignListParams} for more details.
103
+ #
104
+ # List all toll-free campaigns for an account with cursor-based pagination.
105
+ #
106
+ # @overload list(account_id, after: nil, before: nil, request_options: {})
107
+ #
108
+ # @param account_id [String] The account ID to list toll-free campaigns for.
109
+ #
110
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
111
+ #
112
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
113
+ #
114
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
115
+ #
116
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::TollFreeCampaign>]
117
+ #
118
+ # @see SurgeAPI::Models::TollFreeCampaignListParams
119
+ def list(account_id, params = {})
120
+ parsed, options = SurgeAPI::TollFreeCampaignListParams.dump_request(params)
121
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
122
+ @client.request(
123
+ method: :get,
124
+ path: ["accounts/%1$s/toll_free_campaigns", account_id],
125
+ query: query,
126
+ page: SurgeAPI::Internal::Cursor,
127
+ model: SurgeAPI::TollFreeCampaign,
128
+ options: options
129
+ )
130
+ end
131
+
132
+ # @api private
133
+ #
134
+ # @param client [SurgeAPI::Client]
135
+ def initialize(client:)
136
+ @client = client
137
+ end
138
+ end
139
+ end
140
+ end
@@ -138,15 +138,20 @@ module SurgeAPI
138
138
  )
139
139
  end
140
140
 
141
+ # Some parameter documentations has been truncated, see
142
+ # {SurgeAPI::Models::UserCreateTokenParams} for more details.
143
+ #
141
144
  # Provides a mechanism for having Surge create a signed token for embeds instead
142
145
  # of signing with your own signing key.
143
146
  #
144
- # @overload create_token(user_id, duration_seconds: nil, request_options: {})
147
+ # @overload create_token(user_id, duration_seconds: nil, read_only: nil, request_options: {})
145
148
  #
146
149
  # @param user_id [String] The user for which the token represents authentication.
147
150
  #
148
151
  # @param duration_seconds [Integer] For how many seconds the token should be accepted. Defaults to 15 minutes.
149
152
  #
153
+ # @param read_only [Boolean] Restrict the token to viewing embedded conversations and unread counts. Sending
154
+ #
150
155
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
151
156
  #
152
157
  # @return [SurgeAPI::Models::UserTokenResponse]
@@ -9,7 +9,7 @@ module SurgeAPI
9
9
  #
10
10
  # @param key [String, nil] The webhook signing key
11
11
  #
12
- # @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]
12
+ # @return [SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::CampaignRejectedWebhookEvent, SurgeAPI::Models::CampaignSubmittedWebhookEvent, SurgeAPI::Models::CampaignWarningWebhookEvent, 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::PhoneNumberImportedWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent]
13
13
  def unwrap(payload, headers:, key: @client.webhook_signing_secret)
14
14
  if key.nil?
15
15
  raise ArgumentError.new("Cannot verify a webhook without a key on either the client's webhook_signing_secret or passed in as an argument")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.23.0"
4
+ VERSION = "0.25.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -56,6 +56,7 @@ require_relative "surge_api/client"
56
56
  require_relative "surge_api/internal/cursor"
57
57
  require_relative "surge_api/models/campaign_params"
58
58
  require_relative "surge_api/models/message_params"
59
+ require_relative "surge_api/models/toll_free_campaign_params"
59
60
  require_relative "surge_api/models/account"
60
61
  require_relative "surge_api/models/account_archive_params"
61
62
  require_relative "surge_api/models/account_create_params"
@@ -77,10 +78,13 @@ require_relative "surge_api/models/campaign"
77
78
  require_relative "surge_api/models/campaign_approved_webhook_event"
78
79
  require_relative "surge_api/models/campaign_create_params"
79
80
  require_relative "surge_api/models/campaign_list_params"
81
+ require_relative "surge_api/models/campaign_rejected_webhook_event"
80
82
  require_relative "surge_api/models/campaign_resend_brand_verification_message_params"
81
83
  require_relative "surge_api/models/campaign_resend_brand_verification_message_response"
82
84
  require_relative "surge_api/models/campaign_retrieve_params"
85
+ require_relative "surge_api/models/campaign_submitted_webhook_event"
83
86
  require_relative "surge_api/models/campaign_update_params"
87
+ require_relative "surge_api/models/campaign_warning_webhook_event"
84
88
  require_relative "surge_api/models/contact"
85
89
  require_relative "surge_api/models/contact_create_params"
86
90
  require_relative "surge_api/models/contact_list_params"
@@ -102,6 +106,7 @@ require_relative "surge_api/models/message_sent_webhook_event"
102
106
  require_relative "surge_api/models/organization"
103
107
  require_relative "surge_api/models/phone_number"
104
108
  require_relative "surge_api/models/phone_number_attached_to_campaign_webhook_event"
109
+ require_relative "surge_api/models/phone_number_imported_webhook_event"
105
110
  require_relative "surge_api/models/phone_number_list_available_numbers_params"
106
111
  require_relative "surge_api/models/phone_number_list_available_numbers_response"
107
112
  require_relative "surge_api/models/phone_number_list_params"
@@ -118,6 +123,12 @@ require_relative "surge_api/models/recording_list_params"
118
123
  require_relative "surge_api/models/recording_list_response"
119
124
  require_relative "surge_api/models/recording_retrieve_params"
120
125
  require_relative "surge_api/models/recording_retrieve_response"
126
+ require_relative "surge_api/models/toll_free_campaign"
127
+ require_relative "surge_api/models/toll_free_campaign_consent_flow"
128
+ require_relative "surge_api/models/toll_free_campaign_create_params"
129
+ require_relative "surge_api/models/toll_free_campaign_list_params"
130
+ require_relative "surge_api/models/toll_free_campaign_retrieve_params"
131
+ require_relative "surge_api/models/toll_free_campaign_update_params"
121
132
  require_relative "surge_api/models/unwrap_webhook_event"
122
133
  require_relative "surge_api/models/user"
123
134
  require_relative "surge_api/models/user_create_params"
@@ -143,6 +154,7 @@ require_relative "surge_api/resources/contacts"
143
154
  require_relative "surge_api/resources/messages"
144
155
  require_relative "surge_api/resources/phone_numbers"
145
156
  require_relative "surge_api/resources/recordings"
157
+ require_relative "surge_api/resources/toll_free_campaigns"
146
158
  require_relative "surge_api/resources/users"
147
159
  require_relative "surge_api/resources/verifications"
148
160
  require_relative "surge_api/resources/webhooks"
@@ -43,6 +43,9 @@ module SurgeAPI
43
43
  sig { returns(SurgeAPI::Resources::Recordings) }
44
44
  attr_reader :recordings
45
45
 
46
+ sig { returns(SurgeAPI::Resources::TollFreeCampaigns) }
47
+ attr_reader :toll_free_campaigns
48
+
46
49
  sig { returns(SurgeAPI::Resources::Users) }
47
50
  attr_reader :users
48
51
 
@@ -88,6 +88,11 @@ module SurgeAPI
88
88
  :local_messaging,
89
89
  SurgeAPI::AccountRetrieveStatusParams::Capability::TaggedSymbol
90
90
  )
91
+ TOLL_FREE_MESSAGING =
92
+ T.let(
93
+ :toll_free_messaging,
94
+ SurgeAPI::AccountRetrieveStatusParams::Capability::TaggedSymbol
95
+ )
91
96
 
92
97
  sig do
93
98
  override.returns(
@@ -88,7 +88,8 @@ module SurgeAPI
88
88
  sig { returns(Time) }
89
89
  attr_accessor :initiated_at
90
90
 
91
- # The status of the call
91
+ # The status of the call. For inbound embedded-phone calls, `no_answer` means no
92
+ # embedded user answered, even if the caller reached voicemail.
92
93
  sig do
93
94
  returns(SurgeAPI::CallEndedWebhookEvent::Data::Status::TaggedSymbol)
94
95
  end
@@ -128,7 +129,8 @@ module SurgeAPI
128
129
  duration:,
129
130
  # When the call was initiated
130
131
  initiated_at:,
131
- # The status of the call
132
+ # The status of the call. For inbound embedded-phone calls, `no_answer` means no
133
+ # embedded user answered, even if the caller reached voicemail.
132
134
  status:,
133
135
  # The E.164 phone number of the caller
134
136
  from: nil,
@@ -157,7 +159,8 @@ module SurgeAPI
157
159
  def to_hash
158
160
  end
159
161
 
160
- # The status of the call
162
+ # The status of the call. For inbound embedded-phone calls, `no_answer` means no
163
+ # embedded user answered, even if the caller reached voicemail.
161
164
  module Status
162
165
  extend SurgeAPI::Internal::Type::Enum
163
166
 
@@ -10,6 +10,10 @@ module SurgeAPI
10
10
  sig { returns(String) }
11
11
  attr_accessor :id
12
12
 
13
+ # The ID of the account that owns this campaign
14
+ sig { returns(String) }
15
+ attr_accessor :account_id
16
+
13
17
  # A string explaining the method through which end users will opt in to receive
14
18
  # messages from the brand. Typically this should include URLs for opt-in forms or
15
19
  # screenshots that might be helpful in explaining the flow to someone unfamiliar
@@ -86,21 +90,20 @@ module SurgeAPI
86
90
  # This will be one of the following:
87
91
  #
88
92
  # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
89
- # T-Mobile customers each day. In this case your platform will be charged for
90
- # the setup fee for a low volume number upon receipt of the API request.
93
+ # T-Mobile customers each day. In this case your project will be charged for the
94
+ # setup fee for a low volume number upon receipt of the API request.
91
95
  # - `high` - The campaign will be allowed to send up to 200k SMS segments to
92
96
  # T-Mobile customers each day, depending on the trust score assigned by The
93
- # Campaign Registry. Your platform will be charged for the setup fee for a high
97
+ # Campaign Registry. Your project will be charged for the setup fee for a high
94
98
  # volume number upon receipt of the API request, and phone numbers will be
95
99
  # charged as high volume numbers going forward.
96
100
  sig { returns(SurgeAPI::Campaign::Volume::TaggedSymbol) }
97
101
  attr_accessor :volume
98
102
 
99
- # A sample link that might be sent by this campaign. If links from other domains
100
- # are sent through this campaign, they are much more likely to be filtered by the
101
- # carriers. If link shortening is enabled for the account, the link shortener URL
102
- # will be used instead of what is provided. Reach out to support if you would like
103
- # to disable automatic link shortening.
103
+ # A sample link that might be sent by this campaign. This is required when
104
+ # `includes` contains `links`. Provide the same URL or domain that the campaign
105
+ # will use in production. If links from other domains are sent through this
106
+ # campaign, they are much more likely to be filtered by the carriers.
104
107
  sig { returns(T.nilable(String)) }
105
108
  attr_reader :link_sample
106
109
 
@@ -122,6 +125,7 @@ module SurgeAPI
122
125
  sig do
123
126
  params(
124
127
  id: String,
128
+ account_id: String,
125
129
  consent_flow: String,
126
130
  description: String,
127
131
  includes: T::Array[SurgeAPI::Campaign::Include::OrSymbol],
@@ -137,6 +141,8 @@ module SurgeAPI
137
141
  def self.new(
138
142
  # The campaign ID
139
143
  id:,
144
+ # The ID of the account that owns this campaign
145
+ account_id:,
140
146
  # A string explaining the method through which end users will opt in to receive
141
147
  # messages from the brand. Typically this should include URLs for opt-in forms or
142
148
  # screenshots that might be helpful in explaining the flow to someone unfamiliar
@@ -199,19 +205,18 @@ module SurgeAPI
199
205
  # This will be one of the following:
200
206
  #
201
207
  # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
202
- # T-Mobile customers each day. In this case your platform will be charged for
203
- # the setup fee for a low volume number upon receipt of the API request.
208
+ # T-Mobile customers each day. In this case your project will be charged for the
209
+ # setup fee for a low volume number upon receipt of the API request.
204
210
  # - `high` - The campaign will be allowed to send up to 200k SMS segments to
205
211
  # T-Mobile customers each day, depending on the trust score assigned by The
206
- # Campaign Registry. Your platform will be charged for the setup fee for a high
212
+ # Campaign Registry. Your project will be charged for the setup fee for a high
207
213
  # volume number upon receipt of the API request, and phone numbers will be
208
214
  # charged as high volume numbers going forward.
209
215
  volume:,
210
- # A sample link that might be sent by this campaign. If links from other domains
211
- # are sent through this campaign, they are much more likely to be filtered by the
212
- # carriers. If link shortening is enabled for the account, the link shortener URL
213
- # will be used instead of what is provided. Reach out to support if you would like
214
- # to disable automatic link shortening.
216
+ # A sample link that might be sent by this campaign. This is required when
217
+ # `includes` contains `links`. Provide the same URL or domain that the campaign
218
+ # will use in production. If links from other domains are sent through this
219
+ # campaign, they are much more likely to be filtered by the carriers.
215
220
  link_sample: nil,
216
221
  # The URL of the terms and conditions presented to end users when they opt in to
217
222
  # messaging. These terms and conditions may be shared among all of a platform's
@@ -225,6 +230,7 @@ module SurgeAPI
225
230
  override.returns(
226
231
  {
227
232
  id: String,
233
+ account_id: String,
228
234
  consent_flow: String,
229
235
  description: String,
230
236
  includes: T::Array[SurgeAPI::Campaign::Include::TaggedSymbol],
@@ -272,6 +278,7 @@ module SurgeAPI
272
278
 
273
279
  ACTIVE = T.let(:active, SurgeAPI::Campaign::Status::TaggedSymbol)
274
280
  CANCELED = T.let(:canceled, SurgeAPI::Campaign::Status::TaggedSymbol)
281
+ REJECTED = T.let(:rejected, SurgeAPI::Campaign::Status::TaggedSymbol)
275
282
  CREATED = T.let(:created, SurgeAPI::Campaign::Status::TaggedSymbol)
276
283
  DEACTIVATED =
277
284
  T.let(:deactivated, SurgeAPI::Campaign::Status::TaggedSymbol)
@@ -333,11 +340,11 @@ module SurgeAPI
333
340
  # This will be one of the following:
334
341
  #
335
342
  # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
336
- # T-Mobile customers each day. In this case your platform will be charged for
337
- # the setup fee for a low volume number upon receipt of the API request.
343
+ # T-Mobile customers each day. In this case your project will be charged for the
344
+ # setup fee for a low volume number upon receipt of the API request.
338
345
  # - `high` - The campaign will be allowed to send up to 200k SMS segments to
339
346
  # T-Mobile customers each day, depending on the trust score assigned by The
340
- # Campaign Registry. Your platform will be charged for the setup fee for a high
347
+ # Campaign Registry. Your project will be charged for the setup fee for a high
341
348
  # volume number upon receipt of the API request, and phone numbers will be
342
349
  # charged as high volume numbers going forward.
343
350
  module Volume
@@ -78,6 +78,10 @@ module SurgeAPI
78
78
  sig { returns(String) }
79
79
  attr_accessor :id
80
80
 
81
+ # The ID of the account that owns this campaign
82
+ sig { returns(String) }
83
+ attr_accessor :account_id
84
+
81
85
  # The status of the campaign. Will always be `active` for this event.
82
86
  sig do
83
87
  returns(
@@ -90,6 +94,7 @@ module SurgeAPI
90
94
  sig do
91
95
  params(
92
96
  id: String,
97
+ account_id: String,
93
98
  status:
94
99
  SurgeAPI::CampaignApprovedWebhookEvent::Data::Status::OrSymbol
95
100
  ).returns(T.attached_class)
@@ -97,6 +102,8 @@ module SurgeAPI
97
102
  def self.new(
98
103
  # The unique identifier for the campaign
99
104
  id:,
105
+ # The ID of the account that owns this campaign
106
+ account_id:,
100
107
  # The status of the campaign. Will always be `active` for this event.
101
108
  status:
102
109
  )
@@ -106,6 +113,7 @@ module SurgeAPI
106
113
  override.returns(
107
114
  {
108
115
  id: String,
116
+ account_id: String,
109
117
  status:
110
118
  SurgeAPI::CampaignApprovedWebhookEvent::Data::Status::TaggedSymbol
111
119
  }