surge_api 0.24.0 → 0.26.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +9 -9
- data/lib/surge_api/client.rb +4 -0
- data/lib/surge_api/internal/type/union.rb +2 -2
- data/lib/surge_api/models/call_ended_webhook_event.rb +8 -3
- data/lib/surge_api/models/campaign.rb +15 -7
- data/lib/surge_api/models/campaign_approved_webhook_event.rb +9 -1
- data/lib/surge_api/models/campaign_params.rb +6 -6
- data/lib/surge_api/models/campaign_rejected_webhook_event.rb +135 -0
- data/lib/surge_api/models/campaign_submitted_webhook_event.rb +74 -0
- data/lib/surge_api/models/campaign_update_params.rb +188 -1
- data/lib/surge_api/models/campaign_warning_webhook_event.rb +134 -0
- data/lib/surge_api/models/message.rb +28 -2
- data/lib/surge_api/models/message_delivered_webhook_event.rb +20 -1
- data/lib/surge_api/models/message_failed_webhook_event.rb +17 -5
- data/lib/surge_api/models/message_received_webhook_event.rb +20 -1
- data/lib/surge_api/models/message_sent_webhook_event.rb +20 -1
- data/lib/surge_api/models/phone_number.rb +9 -1
- data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +9 -1
- data/lib/surge_api/models/phone_number_imported_webhook_event.rb +9 -1
- data/lib/surge_api/models/phone_number_purchase_params.rb +9 -1
- data/lib/surge_api/models/phone_number_update_params.rb +9 -1
- data/lib/surge_api/models/toll_free_campaign.rb +132 -0
- data/lib/surge_api/models/toll_free_campaign_consent_flow.rb +176 -0
- data/lib/surge_api/models/toll_free_campaign_create_params.rb +22 -0
- data/lib/surge_api/models/toll_free_campaign_list_params.rb +42 -0
- data/lib/surge_api/models/toll_free_campaign_params.rb +286 -0
- data/lib/surge_api/models/toll_free_campaign_retrieve_params.rb +22 -0
- data/lib/surge_api/models/toll_free_campaign_update_params.rb +278 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +7 -1
- data/lib/surge_api/models/user_create_token_params.rb +15 -1
- data/lib/surge_api/models.rb +20 -0
- data/lib/surge_api/resources/accounts.rb +2 -2
- data/lib/surge_api/resources/campaigns.rb +26 -8
- data/lib/surge_api/resources/phone_numbers.rb +6 -2
- data/lib/surge_api/resources/toll_free_campaigns.rb +140 -0
- data/lib/surge_api/resources/users.rb +6 -1
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +11 -0
- data/rbi/surge_api/client.rbi +3 -0
- data/rbi/surge_api/models/call_ended_webhook_event.rbi +6 -3
- data/rbi/surge_api/models/campaign.rbi +17 -9
- data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/campaign_params.rbi +9 -9
- data/rbi/surge_api/models/campaign_rejected_webhook_event.rbi +269 -0
- data/rbi/surge_api/models/campaign_submitted_webhook_event.rbi +149 -0
- data/rbi/surge_api/models/campaign_update_params.rbi +378 -1
- data/rbi/surge_api/models/campaign_warning_webhook_event.rbi +259 -0
- data/rbi/surge_api/models/message.rbi +28 -0
- data/rbi/surge_api/models/message_delivered_webhook_event.rbi +22 -0
- data/rbi/surge_api/models/message_failed_webhook_event.rbi +21 -5
- data/rbi/surge_api/models/message_received_webhook_event.rbi +22 -0
- data/rbi/surge_api/models/message_sent_webhook_event.rbi +22 -0
- data/rbi/surge_api/models/phone_number.rbi +8 -0
- data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/phone_number_imported_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/phone_number_purchase_params.rbi +11 -0
- data/rbi/surge_api/models/phone_number_update_params.rbi +11 -0
- data/rbi/surge_api/models/toll_free_campaign.rbi +230 -0
- data/rbi/surge_api/models/toll_free_campaign_consent_flow.rbi +476 -0
- data/rbi/surge_api/models/toll_free_campaign_create_params.rbi +43 -0
- data/rbi/surge_api/models/toll_free_campaign_list_params.rbi +70 -0
- data/rbi/surge_api/models/toll_free_campaign_params.rbi +711 -0
- data/rbi/surge_api/models/toll_free_campaign_retrieve_params.rbi +43 -0
- data/rbi/surge_api/models/toll_free_campaign_update_params.rbi +760 -0
- data/rbi/surge_api/models/unwrap_webhook_event.rbi +3 -0
- data/rbi/surge_api/models/user_create_token_params.rbi +17 -0
- data/rbi/surge_api/models.rbi +22 -0
- data/rbi/surge_api/resources/accounts.rbi +2 -2
- data/rbi/surge_api/resources/campaigns.rbi +94 -12
- data/rbi/surge_api/resources/phone_numbers.rbi +6 -0
- data/rbi/surge_api/resources/toll_free_campaigns.rbi +129 -0
- data/rbi/surge_api/resources/users.rbi +6 -0
- data/rbi/surge_api/resources/webhooks.rbi +3 -0
- data/sig/surge_api/client.rbs +2 -0
- data/sig/surge_api/models/campaign.rbs +5 -0
- data/sig/surge_api/models/campaign_approved_webhook_event.rbs +5 -0
- data/sig/surge_api/models/campaign_rejected_webhook_event.rbs +115 -0
- data/sig/surge_api/models/campaign_submitted_webhook_event.rbs +67 -0
- data/sig/surge_api/models/campaign_update_params.rbs +128 -2
- data/sig/surge_api/models/campaign_warning_webhook_event.rbs +114 -0
- data/sig/surge_api/models/message.rbs +15 -0
- data/sig/surge_api/models/message_delivered_webhook_event.rbs +10 -0
- data/sig/surge_api/models/message_failed_webhook_event.rbs +9 -4
- data/sig/surge_api/models/message_received_webhook_event.rbs +10 -0
- data/sig/surge_api/models/message_sent_webhook_event.rbs +10 -0
- data/sig/surge_api/models/phone_number.rbs +5 -0
- data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +5 -0
- data/sig/surge_api/models/phone_number_imported_webhook_event.rbs +5 -0
- data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
- data/sig/surge_api/models/phone_number_update_params.rbs +12 -1
- data/sig/surge_api/models/toll_free_campaign.rbs +126 -0
- data/sig/surge_api/models/toll_free_campaign_consent_flow.rbs +207 -0
- data/sig/surge_api/models/toll_free_campaign_create_params.rbs +25 -0
- data/sig/surge_api/models/toll_free_campaign_list_params.rbs +36 -0
- data/sig/surge_api/models/toll_free_campaign_params.rbs +321 -0
- data/sig/surge_api/models/toll_free_campaign_retrieve_params.rbs +23 -0
- data/sig/surge_api/models/toll_free_campaign_update_params.rbs +332 -0
- data/sig/surge_api/models/unwrap_webhook_event.rbs +3 -0
- data/sig/surge_api/models/user_create_token_params.rbs +7 -1
- data/sig/surge_api/models.rbs +20 -0
- data/sig/surge_api/resources/campaigns.rbs +9 -1
- data/sig/surge_api/resources/phone_numbers.rbs +2 -0
- data/sig/surge_api/resources/toll_free_campaigns.rbs +44 -0
- data/sig/surge_api/resources/users.rbs +1 -0
- data/sig/surge_api/resources/webhooks.rbs +3 -0
- metadata +50 -7
|
@@ -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
|
|
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
|
|
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
|
|
57
|
-
#
|
|
58
|
-
# campaign
|
|
59
|
-
#
|
|
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,
|
|
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
|
|
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
|
|
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::PhoneNumberImportedWebhookEvent, 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")
|
data/lib/surge_api/version.rb
CHANGED
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"
|
|
@@ -119,6 +123,12 @@ require_relative "surge_api/models/recording_list_params"
|
|
|
119
123
|
require_relative "surge_api/models/recording_list_response"
|
|
120
124
|
require_relative "surge_api/models/recording_retrieve_params"
|
|
121
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"
|
|
122
132
|
require_relative "surge_api/models/unwrap_webhook_event"
|
|
123
133
|
require_relative "surge_api/models/user"
|
|
124
134
|
require_relative "surge_api/models/user_create_params"
|
|
@@ -144,6 +154,7 @@ require_relative "surge_api/resources/contacts"
|
|
|
144
154
|
require_relative "surge_api/resources/messages"
|
|
145
155
|
require_relative "surge_api/resources/phone_numbers"
|
|
146
156
|
require_relative "surge_api/resources/recordings"
|
|
157
|
+
require_relative "surge_api/resources/toll_free_campaigns"
|
|
147
158
|
require_relative "surge_api/resources/users"
|
|
148
159
|
require_relative "surge_api/resources/verifications"
|
|
149
160
|
require_relative "surge_api/resources/webhooks"
|
data/rbi/surge_api/client.rbi
CHANGED
|
@@ -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,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,11 +90,11 @@ 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
|
|
90
|
-
#
|
|
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
|
|
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) }
|
|
@@ -121,6 +125,7 @@ module SurgeAPI
|
|
|
121
125
|
sig do
|
|
122
126
|
params(
|
|
123
127
|
id: String,
|
|
128
|
+
account_id: String,
|
|
124
129
|
consent_flow: String,
|
|
125
130
|
description: String,
|
|
126
131
|
includes: T::Array[SurgeAPI::Campaign::Include::OrSymbol],
|
|
@@ -136,6 +141,8 @@ module SurgeAPI
|
|
|
136
141
|
def self.new(
|
|
137
142
|
# The campaign ID
|
|
138
143
|
id:,
|
|
144
|
+
# The ID of the account that owns this campaign
|
|
145
|
+
account_id:,
|
|
139
146
|
# A string explaining the method through which end users will opt in to receive
|
|
140
147
|
# messages from the brand. Typically this should include URLs for opt-in forms or
|
|
141
148
|
# screenshots that might be helpful in explaining the flow to someone unfamiliar
|
|
@@ -198,11 +205,11 @@ module SurgeAPI
|
|
|
198
205
|
# This will be one of the following:
|
|
199
206
|
#
|
|
200
207
|
# - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
201
|
-
# T-Mobile customers each day. In this case your
|
|
202
|
-
#
|
|
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.
|
|
203
210
|
# - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
204
211
|
# T-Mobile customers each day, depending on the trust score assigned by The
|
|
205
|
-
# Campaign Registry. Your
|
|
212
|
+
# Campaign Registry. Your project will be charged for the setup fee for a high
|
|
206
213
|
# volume number upon receipt of the API request, and phone numbers will be
|
|
207
214
|
# charged as high volume numbers going forward.
|
|
208
215
|
volume:,
|
|
@@ -223,6 +230,7 @@ module SurgeAPI
|
|
|
223
230
|
override.returns(
|
|
224
231
|
{
|
|
225
232
|
id: String,
|
|
233
|
+
account_id: String,
|
|
226
234
|
consent_flow: String,
|
|
227
235
|
description: String,
|
|
228
236
|
includes: T::Array[SurgeAPI::Campaign::Include::TaggedSymbol],
|
|
@@ -332,11 +340,11 @@ module SurgeAPI
|
|
|
332
340
|
# This will be one of the following:
|
|
333
341
|
#
|
|
334
342
|
# - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
335
|
-
# T-Mobile customers each day. In this case your
|
|
336
|
-
#
|
|
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.
|
|
337
345
|
# - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
338
346
|
# T-Mobile customers each day, depending on the trust score assigned by The
|
|
339
|
-
# Campaign Registry. Your
|
|
347
|
+
# Campaign Registry. Your project will be charged for the setup fee for a high
|
|
340
348
|
# volume number upon receipt of the API request, and phone numbers will be
|
|
341
349
|
# charged as high volume numbers going forward.
|
|
342
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
|
}
|
|
@@ -97,11 +97,11 @@ module SurgeAPI
|
|
|
97
97
|
# This will be one of the following:
|
|
98
98
|
#
|
|
99
99
|
# - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
100
|
-
# T-Mobile customers each day. In this case your
|
|
101
|
-
#
|
|
100
|
+
# T-Mobile customers each day. In this case your project will be charged for the
|
|
101
|
+
# setup fee for a low volume number upon receipt of the API request.
|
|
102
102
|
# - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
103
103
|
# T-Mobile customers each day, depending on the trust score assigned by The
|
|
104
|
-
# Campaign Registry. Your
|
|
104
|
+
# Campaign Registry. Your project will be charged for the setup fee for a high
|
|
105
105
|
# volume number upon receipt of the API request, and phone numbers will be
|
|
106
106
|
# charged as high volume numbers going forward.
|
|
107
107
|
sig do
|
|
@@ -228,11 +228,11 @@ module SurgeAPI
|
|
|
228
228
|
# This will be one of the following:
|
|
229
229
|
#
|
|
230
230
|
# - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
231
|
-
# T-Mobile customers each day. In this case your
|
|
232
|
-
#
|
|
231
|
+
# T-Mobile customers each day. In this case your project will be charged for the
|
|
232
|
+
# setup fee for a low volume number upon receipt of the API request.
|
|
233
233
|
# - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
234
234
|
# T-Mobile customers each day, depending on the trust score assigned by The
|
|
235
|
-
# Campaign Registry. Your
|
|
235
|
+
# Campaign Registry. Your project will be charged for the setup fee for a high
|
|
236
236
|
# volume number upon receipt of the API request, and phone numbers will be
|
|
237
237
|
# charged as high volume numbers going forward.
|
|
238
238
|
volume:,
|
|
@@ -356,11 +356,11 @@ module SurgeAPI
|
|
|
356
356
|
# This will be one of the following:
|
|
357
357
|
#
|
|
358
358
|
# - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
359
|
-
# T-Mobile customers each day. In this case your
|
|
360
|
-
#
|
|
359
|
+
# T-Mobile customers each day. In this case your project will be charged for the
|
|
360
|
+
# setup fee for a low volume number upon receipt of the API request.
|
|
361
361
|
# - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
362
362
|
# T-Mobile customers each day, depending on the trust score assigned by The
|
|
363
|
-
# Campaign Registry. Your
|
|
363
|
+
# Campaign Registry. Your project will be charged for the setup fee for a high
|
|
364
364
|
# volume number upon receipt of the API request, and phone numbers will be
|
|
365
365
|
# charged as high volume numbers going forward.
|
|
366
366
|
module Volume
|