surge_api 0.9.0 → 0.10.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 +18 -0
- data/README.md +1 -1
- data/lib/surge_api/client.rb +4 -0
- data/lib/surge_api/internal/util.rb +1 -1
- data/lib/surge_api/models/campaign.rb +27 -1
- data/lib/surge_api/models/campaign_retrieve_params.rb +14 -0
- data/lib/surge_api/models/message.rb +2 -2
- data/lib/surge_api/models/recording_completed_webhook_event.rb +136 -0
- data/lib/surge_api/models/recording_get_file_params.rb +14 -0
- data/lib/surge_api/models/recording_get_file_response.rb +19 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +5 -1
- data/lib/surge_api/models/voicemail_received_webhook_event.rb +144 -0
- data/lib/surge_api/models.rb +8 -0
- data/lib/surge_api/resources/campaigns.rb +20 -0
- data/lib/surge_api/resources/recordings.rb +35 -0
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +6 -0
- data/rbi/surge_api/client.rbi +3 -0
- data/rbi/surge_api/internal/util.rbi +1 -1
- data/rbi/surge_api/models/campaign.rbi +32 -0
- data/rbi/surge_api/models/campaign_retrieve_params.rbi +27 -0
- data/rbi/surge_api/models/message.rbi +3 -6
- data/rbi/surge_api/models/recording_completed_webhook_event.rbi +277 -0
- data/rbi/surge_api/models/recording_get_file_params.rbi +27 -0
- data/rbi/surge_api/models/recording_get_file_response.rbi +34 -0
- data/rbi/surge_api/models/unwrap_webhook_event.rbi +3 -1
- data/rbi/surge_api/models/voicemail_received_webhook_event.rbi +283 -0
- data/rbi/surge_api/models.rbi +10 -0
- data/rbi/surge_api/resources/campaigns.rbi +14 -0
- data/rbi/surge_api/resources/recordings.rbi +27 -0
- data/rbi/surge_api/resources/webhooks.rbi +3 -1
- data/sig/surge_api/client.rbs +2 -0
- data/sig/surge_api/models/campaign.rbs +28 -0
- data/sig/surge_api/models/campaign_retrieve_params.rbs +15 -0
- data/sig/surge_api/models/message.rbs +4 -6
- data/sig/surge_api/models/recording_completed_webhook_event.rbs +126 -0
- data/sig/surge_api/models/recording_get_file_params.rbs +15 -0
- data/sig/surge_api/models/recording_get_file_response.rbs +13 -0
- data/sig/surge_api/models/unwrap_webhook_event.rbs +2 -0
- data/sig/surge_api/models/voicemail_received_webhook_event.rbs +131 -0
- data/sig/surge_api/models.rbs +8 -0
- data/sig/surge_api/resources/campaigns.rbs +5 -0
- data/sig/surge_api/resources/recordings.rbs +12 -0
- data/sig/surge_api/resources/webhooks.rbs +3 -1
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ab0d460fe03be9712dc7d4ad68bc64e6ebb931573b9fe9ff91b8f36f2979514
|
|
4
|
+
data.tar.gz: 20488d8ba034a202671fa5cb1c3e0bde2c863bfa7826ed3ffb718911c34515ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abd73bd158429ed55c7343a89e85ce56ed40979df1278b20937250787bf360b91e1de84494abd4f1d2e9c2f3dc8f2bbfbedec04f1666b2d9b5798f976cda985f
|
|
7
|
+
data.tar.gz: bcbd4c0adb4baba0a737a833232f02abb63588f31a8d9ff70c39dee65037db86032efc12f34499c57ff46bd6b6b27c5276d6a9af4600fb290aced6e0014cda80
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 (2026-02-12)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.9.0...v0.10.0](https://github.com/surgeapi/ruby-sdk/compare/v0.9.0...v0.10.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add campaign.status field ([f0ab6be](https://github.com/surgeapi/ruby-sdk/commit/f0ab6bef5d1cbca9741b3731189e5a821c6abcb3))
|
|
10
|
+
* **api:** add get campaign endpoint ([511d2b3](https://github.com/surgeapi/ruby-sdk/commit/511d2b3cd36a3e4a1f1737093a02f5c31296c332))
|
|
11
|
+
* **api:** add recording.completed webhook ([9a72a0c](https://github.com/surgeapi/ruby-sdk/commit/9a72a0c754dad51ac7b02e84c3f8ce8e6ba85378))
|
|
12
|
+
* **api:** add voicemail.received webhook ([37edfcd](https://github.com/surgeapi/ruby-sdk/commit/37edfcd3a2d26f42ea5a0fbf5481e046486f4456))
|
|
13
|
+
* **api:** get recording file ([db0184e](https://github.com/surgeapi/ruby-sdk/commit/db0184e171168f74e20d91b65cea452a32aad263))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **api:** make message.blast_id nullable ([9096e75](https://github.com/surgeapi/ruby-sdk/commit/9096e75d5aa6803c4b11aba0fe2c61448abf3f6a))
|
|
19
|
+
* **client:** loosen json header parsing ([51f4092](https://github.com/surgeapi/ruby-sdk/commit/51f409235dc8e2c377411b3f53595df8fea9b4e4))
|
|
20
|
+
|
|
3
21
|
## 0.9.0 (2026-02-04)
|
|
4
22
|
|
|
5
23
|
Full Changelog: [v0.8.0...v0.9.0](https://github.com/surgeapi/ruby-sdk/compare/v0.8.0...v0.9.0)
|
data/README.md
CHANGED
data/lib/surge_api/client.rb
CHANGED
|
@@ -36,6 +36,9 @@ module SurgeAPI
|
|
|
36
36
|
# @return [SurgeAPI::Resources::PhoneNumbers]
|
|
37
37
|
attr_reader :phone_numbers
|
|
38
38
|
|
|
39
|
+
# @return [SurgeAPI::Resources::Recordings]
|
|
40
|
+
attr_reader :recordings
|
|
41
|
+
|
|
39
42
|
# @return [SurgeAPI::Resources::Users]
|
|
40
43
|
attr_reader :users
|
|
41
44
|
|
|
@@ -98,6 +101,7 @@ module SurgeAPI
|
|
|
98
101
|
@contacts = SurgeAPI::Resources::Contacts.new(client: self)
|
|
99
102
|
@messages = SurgeAPI::Resources::Messages.new(client: self)
|
|
100
103
|
@phone_numbers = SurgeAPI::Resources::PhoneNumbers.new(client: self)
|
|
104
|
+
@recordings = SurgeAPI::Resources::Recordings.new(client: self)
|
|
101
105
|
@users = SurgeAPI::Resources::Users.new(client: self)
|
|
102
106
|
@verifications = SurgeAPI::Resources::Verifications.new(client: self)
|
|
103
107
|
@webhooks = SurgeAPI::Resources::Webhooks.new(client: self)
|
|
@@ -485,7 +485,7 @@ module SurgeAPI
|
|
|
485
485
|
end
|
|
486
486
|
|
|
487
487
|
# @type [Regexp]
|
|
488
|
-
JSON_CONTENT = %r{^application/(?:
|
|
488
|
+
JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
|
|
489
489
|
# @type [Regexp]
|
|
490
490
|
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
|
491
491
|
|
|
@@ -60,6 +60,12 @@ module SurgeAPI
|
|
|
60
60
|
# @return [String]
|
|
61
61
|
required :privacy_policy_url, String
|
|
62
62
|
|
|
63
|
+
# @!attribute status
|
|
64
|
+
# The current status of the campaign.
|
|
65
|
+
#
|
|
66
|
+
# @return [Symbol, SurgeAPI::Models::Campaign::Status]
|
|
67
|
+
required :status, enum: -> { SurgeAPI::Campaign::Status }
|
|
68
|
+
|
|
63
69
|
# @!attribute use_cases
|
|
64
70
|
# A list containing 1-5 types of messages that will be sent with this campaign.
|
|
65
71
|
#
|
|
@@ -125,7 +131,7 @@ module SurgeAPI
|
|
|
125
131
|
# @return [String, nil]
|
|
126
132
|
optional :terms_and_conditions_url, String
|
|
127
133
|
|
|
128
|
-
# @!method initialize(id:, consent_flow:, description:, includes:, message_samples:, privacy_policy_url:, use_cases:, volume:, link_sample: nil, terms_and_conditions_url: nil)
|
|
134
|
+
# @!method initialize(id:, consent_flow:, description:, includes:, message_samples:, privacy_policy_url:, status:, use_cases:, volume:, link_sample: nil, terms_and_conditions_url: nil)
|
|
129
135
|
# Some parameter documentations has been truncated, see
|
|
130
136
|
# {SurgeAPI::Models::Campaign} for more details.
|
|
131
137
|
#
|
|
@@ -144,6 +150,8 @@ module SurgeAPI
|
|
|
144
150
|
#
|
|
145
151
|
# @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
|
|
146
152
|
#
|
|
153
|
+
# @param status [Symbol, SurgeAPI::Models::Campaign::Status] The current status of the campaign.
|
|
154
|
+
#
|
|
147
155
|
# @param use_cases [Array<Symbol, SurgeAPI::Models::Campaign::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
|
|
148
156
|
#
|
|
149
157
|
# @param volume [Symbol, SurgeAPI::Models::Campaign::Volume] This will be one of the following:
|
|
@@ -164,6 +172,24 @@ module SurgeAPI
|
|
|
164
172
|
# @return [Array<Symbol>]
|
|
165
173
|
end
|
|
166
174
|
|
|
175
|
+
# The current status of the campaign.
|
|
176
|
+
#
|
|
177
|
+
# @see SurgeAPI::Models::Campaign#status
|
|
178
|
+
module Status
|
|
179
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
180
|
+
|
|
181
|
+
ACTIVE = :active
|
|
182
|
+
CANCELED = :canceled
|
|
183
|
+
CREATED = :created
|
|
184
|
+
DEACTIVATED = :deactivated
|
|
185
|
+
IN_REVIEW = :in_review
|
|
186
|
+
PENDING = :pending
|
|
187
|
+
REJECTED = :rejected
|
|
188
|
+
|
|
189
|
+
# @!method self.values
|
|
190
|
+
# @return [Array<Symbol>]
|
|
191
|
+
end
|
|
192
|
+
|
|
167
193
|
module UseCase
|
|
168
194
|
extend SurgeAPI::Internal::Type::Enum
|
|
169
195
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Campaigns#retrieve
|
|
6
|
+
class CampaignRetrieveParams < 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
|
|
@@ -20,7 +20,7 @@ module SurgeAPI
|
|
|
20
20
|
# attribute messages back to a specific blast.
|
|
21
21
|
#
|
|
22
22
|
# @return [String, nil]
|
|
23
|
-
optional :blast_id, String
|
|
23
|
+
optional :blast_id, String, nil?: true
|
|
24
24
|
|
|
25
25
|
# @!attribute body
|
|
26
26
|
# The message body.
|
|
@@ -50,7 +50,7 @@ module SurgeAPI
|
|
|
50
50
|
#
|
|
51
51
|
# @param attachments [Array<SurgeAPI::Models::Message::Attachment>]
|
|
52
52
|
#
|
|
53
|
-
# @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
|
|
53
|
+
# @param blast_id [String, nil] The ID of the blast this message belongs to, if any. This can be used to attribu
|
|
54
54
|
#
|
|
55
55
|
# @param body [String, nil] The message body.
|
|
56
56
|
#
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class RecordingCompletedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute account_id
|
|
7
|
+
# The ID of the account in which this event occurred
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
required :account_id, String
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
# The data associated with the event
|
|
14
|
+
#
|
|
15
|
+
# @return [SurgeAPI::Models::RecordingCompletedWebhookEvent::Data]
|
|
16
|
+
required :data, -> { SurgeAPI::RecordingCompletedWebhookEvent::Data }
|
|
17
|
+
|
|
18
|
+
# @!attribute timestamp
|
|
19
|
+
# The timestamp when this event occurred, in ISO8601 format
|
|
20
|
+
#
|
|
21
|
+
# @return [Time]
|
|
22
|
+
required :timestamp, Time
|
|
23
|
+
|
|
24
|
+
# @!attribute type
|
|
25
|
+
# The type of the event. Always `recording.completed` for this event.
|
|
26
|
+
#
|
|
27
|
+
# @return [Symbol, :"recording.completed"]
|
|
28
|
+
required :type, const: :"recording.completed"
|
|
29
|
+
|
|
30
|
+
# @!method initialize(account_id:, data:, timestamp:, type: :"recording.completed")
|
|
31
|
+
# @param account_id [String] The ID of the account in which this event occurred
|
|
32
|
+
#
|
|
33
|
+
# @param data [SurgeAPI::Models::RecordingCompletedWebhookEvent::Data] The data associated with the event
|
|
34
|
+
#
|
|
35
|
+
# @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
|
|
36
|
+
#
|
|
37
|
+
# @param type [Symbol, :"recording.completed"] The type of the event. Always `recording.completed` for this event.
|
|
38
|
+
|
|
39
|
+
# @see SurgeAPI::Models::RecordingCompletedWebhookEvent#data
|
|
40
|
+
class Data < SurgeAPI::Internal::Type::BaseModel
|
|
41
|
+
# @!attribute id
|
|
42
|
+
# The unique identifier for the recording
|
|
43
|
+
#
|
|
44
|
+
# @return [String]
|
|
45
|
+
required :id, String
|
|
46
|
+
|
|
47
|
+
# @!attribute call
|
|
48
|
+
# The call that produced this recording
|
|
49
|
+
#
|
|
50
|
+
# @return [SurgeAPI::Models::RecordingCompletedWebhookEvent::Data::Call]
|
|
51
|
+
required :call, -> { SurgeAPI::RecordingCompletedWebhookEvent::Data::Call }
|
|
52
|
+
|
|
53
|
+
# @!attribute duration
|
|
54
|
+
# The duration of the recording in seconds
|
|
55
|
+
#
|
|
56
|
+
# @return [Integer]
|
|
57
|
+
required :duration, Integer
|
|
58
|
+
|
|
59
|
+
# @!method initialize(id:, call:, duration:)
|
|
60
|
+
# The data associated with the event
|
|
61
|
+
#
|
|
62
|
+
# @param id [String] The unique identifier for the recording
|
|
63
|
+
#
|
|
64
|
+
# @param call [SurgeAPI::Models::RecordingCompletedWebhookEvent::Data::Call] The call that produced this recording
|
|
65
|
+
#
|
|
66
|
+
# @param duration [Integer] The duration of the recording in seconds
|
|
67
|
+
|
|
68
|
+
# @see SurgeAPI::Models::RecordingCompletedWebhookEvent::Data#call
|
|
69
|
+
class Call < SurgeAPI::Internal::Type::BaseModel
|
|
70
|
+
# @!attribute id
|
|
71
|
+
# The unique identifier for the call
|
|
72
|
+
#
|
|
73
|
+
# @return [String]
|
|
74
|
+
required :id, String
|
|
75
|
+
|
|
76
|
+
# @!attribute contact
|
|
77
|
+
# A contact who has consented to receive messages
|
|
78
|
+
#
|
|
79
|
+
# @return [SurgeAPI::Models::Contact]
|
|
80
|
+
required :contact, -> { SurgeAPI::Contact }
|
|
81
|
+
|
|
82
|
+
# @!attribute duration
|
|
83
|
+
# The duration of the call in seconds
|
|
84
|
+
#
|
|
85
|
+
# @return [Integer]
|
|
86
|
+
required :duration, Integer
|
|
87
|
+
|
|
88
|
+
# @!attribute initiated_at
|
|
89
|
+
# When the call was initiated
|
|
90
|
+
#
|
|
91
|
+
# @return [Time]
|
|
92
|
+
required :initiated_at, Time
|
|
93
|
+
|
|
94
|
+
# @!attribute status
|
|
95
|
+
# The status of the call
|
|
96
|
+
#
|
|
97
|
+
# @return [Symbol, SurgeAPI::Models::RecordingCompletedWebhookEvent::Data::Call::Status]
|
|
98
|
+
required :status, enum: -> { SurgeAPI::RecordingCompletedWebhookEvent::Data::Call::Status }
|
|
99
|
+
|
|
100
|
+
# @!method initialize(id:, contact:, duration:, initiated_at:, status:)
|
|
101
|
+
# The call that produced this recording
|
|
102
|
+
#
|
|
103
|
+
# @param id [String] The unique identifier for the call
|
|
104
|
+
#
|
|
105
|
+
# @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
|
|
106
|
+
#
|
|
107
|
+
# @param duration [Integer] The duration of the call in seconds
|
|
108
|
+
#
|
|
109
|
+
# @param initiated_at [Time] When the call was initiated
|
|
110
|
+
#
|
|
111
|
+
# @param status [Symbol, SurgeAPI::Models::RecordingCompletedWebhookEvent::Data::Call::Status] The status of the call
|
|
112
|
+
|
|
113
|
+
# The status of the call
|
|
114
|
+
#
|
|
115
|
+
# @see SurgeAPI::Models::RecordingCompletedWebhookEvent::Data::Call#status
|
|
116
|
+
module Status
|
|
117
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
118
|
+
|
|
119
|
+
BUSY = :busy
|
|
120
|
+
CANCELED = :canceled
|
|
121
|
+
COMPLETED = :completed
|
|
122
|
+
FAILED = :failed
|
|
123
|
+
IN_PROGRESS = :in_progress
|
|
124
|
+
MISSED = :missed
|
|
125
|
+
NO_ANSWER = :no_answer
|
|
126
|
+
QUEUED = :queued
|
|
127
|
+
RINGING = :ringing
|
|
128
|
+
|
|
129
|
+
# @!method self.values
|
|
130
|
+
# @return [Array<Symbol>]
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Recordings#get_file
|
|
6
|
+
class RecordingGetFileParams < 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::Recordings#get_file
|
|
6
|
+
class RecordingGetFileResponse < 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
|
|
@@ -27,8 +27,12 @@ module SurgeAPI
|
|
|
27
27
|
|
|
28
28
|
variant :"message.sent", -> { SurgeAPI::MessageSentWebhookEvent }
|
|
29
29
|
|
|
30
|
+
variant :"recording.completed", -> { SurgeAPI::RecordingCompletedWebhookEvent }
|
|
31
|
+
|
|
32
|
+
variant :"voicemail.received", -> { SurgeAPI::VoicemailReceivedWebhookEvent }
|
|
33
|
+
|
|
30
34
|
# @!method self.variants
|
|
31
|
-
# @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent)]
|
|
35
|
+
# @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent)]
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
end
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class VoicemailReceivedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute account_id
|
|
7
|
+
# The ID of the account in which this event occurred
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
required :account_id, String
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
# The data associated with the event
|
|
14
|
+
#
|
|
15
|
+
# @return [SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data]
|
|
16
|
+
required :data, -> { SurgeAPI::VoicemailReceivedWebhookEvent::Data }
|
|
17
|
+
|
|
18
|
+
# @!attribute timestamp
|
|
19
|
+
# The timestamp when this event occurred, in ISO8601 format
|
|
20
|
+
#
|
|
21
|
+
# @return [Time]
|
|
22
|
+
required :timestamp, Time
|
|
23
|
+
|
|
24
|
+
# @!attribute type
|
|
25
|
+
# The type of the event. Always `voicemail.received` for this event.
|
|
26
|
+
#
|
|
27
|
+
# @return [Symbol, :"voicemail.received"]
|
|
28
|
+
required :type, const: :"voicemail.received"
|
|
29
|
+
|
|
30
|
+
# @!method initialize(account_id:, data:, timestamp:, type: :"voicemail.received")
|
|
31
|
+
# @param account_id [String] The ID of the account in which this event occurred
|
|
32
|
+
#
|
|
33
|
+
# @param data [SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data] The data associated with the event
|
|
34
|
+
#
|
|
35
|
+
# @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
|
|
36
|
+
#
|
|
37
|
+
# @param type [Symbol, :"voicemail.received"] The type of the event. Always `voicemail.received` for this event.
|
|
38
|
+
|
|
39
|
+
# @see SurgeAPI::Models::VoicemailReceivedWebhookEvent#data
|
|
40
|
+
class Data < SurgeAPI::Internal::Type::BaseModel
|
|
41
|
+
# @!attribute id
|
|
42
|
+
# The unique identifier for the voicemail
|
|
43
|
+
#
|
|
44
|
+
# @return [String]
|
|
45
|
+
required :id, String
|
|
46
|
+
|
|
47
|
+
# @!attribute call
|
|
48
|
+
# The call that resulted in this voicemail
|
|
49
|
+
#
|
|
50
|
+
# @return [SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data::Call]
|
|
51
|
+
required :call, -> { SurgeAPI::VoicemailReceivedWebhookEvent::Data::Call }
|
|
52
|
+
|
|
53
|
+
# @!attribute duration
|
|
54
|
+
# The duration of the voicemail in seconds
|
|
55
|
+
#
|
|
56
|
+
# @return [Integer]
|
|
57
|
+
required :duration, Integer
|
|
58
|
+
|
|
59
|
+
# @!attribute recording_id
|
|
60
|
+
# The unique identifier for the recording
|
|
61
|
+
#
|
|
62
|
+
# @return [String]
|
|
63
|
+
required :recording_id, String
|
|
64
|
+
|
|
65
|
+
# @!method initialize(id:, call:, duration:, recording_id:)
|
|
66
|
+
# The data associated with the event
|
|
67
|
+
#
|
|
68
|
+
# @param id [String] The unique identifier for the voicemail
|
|
69
|
+
#
|
|
70
|
+
# @param call [SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data::Call] The call that resulted in this voicemail
|
|
71
|
+
#
|
|
72
|
+
# @param duration [Integer] The duration of the voicemail in seconds
|
|
73
|
+
#
|
|
74
|
+
# @param recording_id [String] The unique identifier for the recording
|
|
75
|
+
|
|
76
|
+
# @see SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data#call
|
|
77
|
+
class Call < SurgeAPI::Internal::Type::BaseModel
|
|
78
|
+
# @!attribute id
|
|
79
|
+
# The unique identifier for the call
|
|
80
|
+
#
|
|
81
|
+
# @return [String]
|
|
82
|
+
required :id, String
|
|
83
|
+
|
|
84
|
+
# @!attribute contact
|
|
85
|
+
# A contact who has consented to receive messages
|
|
86
|
+
#
|
|
87
|
+
# @return [SurgeAPI::Models::Contact]
|
|
88
|
+
required :contact, -> { SurgeAPI::Contact }
|
|
89
|
+
|
|
90
|
+
# @!attribute duration
|
|
91
|
+
# The duration of the call in seconds
|
|
92
|
+
#
|
|
93
|
+
# @return [Integer]
|
|
94
|
+
required :duration, Integer
|
|
95
|
+
|
|
96
|
+
# @!attribute initiated_at
|
|
97
|
+
# When the call was initiated
|
|
98
|
+
#
|
|
99
|
+
# @return [Time]
|
|
100
|
+
required :initiated_at, Time
|
|
101
|
+
|
|
102
|
+
# @!attribute status
|
|
103
|
+
# The status of the call
|
|
104
|
+
#
|
|
105
|
+
# @return [Symbol, SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data::Call::Status]
|
|
106
|
+
required :status, enum: -> { SurgeAPI::VoicemailReceivedWebhookEvent::Data::Call::Status }
|
|
107
|
+
|
|
108
|
+
# @!method initialize(id:, contact:, duration:, initiated_at:, status:)
|
|
109
|
+
# The call that resulted in this voicemail
|
|
110
|
+
#
|
|
111
|
+
# @param id [String] The unique identifier for the call
|
|
112
|
+
#
|
|
113
|
+
# @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
|
|
114
|
+
#
|
|
115
|
+
# @param duration [Integer] The duration of the call in seconds
|
|
116
|
+
#
|
|
117
|
+
# @param initiated_at [Time] When the call was initiated
|
|
118
|
+
#
|
|
119
|
+
# @param status [Symbol, SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data::Call::Status] The status of the call
|
|
120
|
+
|
|
121
|
+
# The status of the call
|
|
122
|
+
#
|
|
123
|
+
# @see SurgeAPI::Models::VoicemailReceivedWebhookEvent::Data::Call#status
|
|
124
|
+
module Status
|
|
125
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
126
|
+
|
|
127
|
+
BUSY = :busy
|
|
128
|
+
CANCELED = :canceled
|
|
129
|
+
COMPLETED = :completed
|
|
130
|
+
FAILED = :failed
|
|
131
|
+
IN_PROGRESS = :in_progress
|
|
132
|
+
MISSED = :missed
|
|
133
|
+
NO_ANSWER = :no_answer
|
|
134
|
+
QUEUED = :queued
|
|
135
|
+
RINGING = :ringing
|
|
136
|
+
|
|
137
|
+
# @!method self.values
|
|
138
|
+
# @return [Array<Symbol>]
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
data/lib/surge_api/models.rb
CHANGED
|
@@ -65,6 +65,8 @@ module SurgeAPI
|
|
|
65
65
|
|
|
66
66
|
CampaignParams = SurgeAPI::Models::CampaignParams
|
|
67
67
|
|
|
68
|
+
CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
|
|
69
|
+
|
|
68
70
|
Contact = SurgeAPI::Models::Contact
|
|
69
71
|
|
|
70
72
|
ContactCreateParams = SurgeAPI::Models::ContactCreateParams
|
|
@@ -111,6 +113,10 @@ module SurgeAPI
|
|
|
111
113
|
|
|
112
114
|
PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
|
|
113
115
|
|
|
116
|
+
RecordingCompletedWebhookEvent = SurgeAPI::Models::RecordingCompletedWebhookEvent
|
|
117
|
+
|
|
118
|
+
RecordingGetFileParams = SurgeAPI::Models::RecordingGetFileParams
|
|
119
|
+
|
|
114
120
|
UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
|
|
115
121
|
|
|
116
122
|
User = SurgeAPI::Models::User
|
|
@@ -135,5 +141,7 @@ module SurgeAPI
|
|
|
135
141
|
|
|
136
142
|
VerificationCreateParams = SurgeAPI::Models::VerificationCreateParams
|
|
137
143
|
|
|
144
|
+
VoicemailReceivedWebhookEvent = SurgeAPI::Models::VoicemailReceivedWebhookEvent
|
|
145
|
+
|
|
138
146
|
WebhookUnwrapParams = SurgeAPI::Models::WebhookUnwrapParams
|
|
139
147
|
end
|
|
@@ -35,6 +35,26 @@ module SurgeAPI
|
|
|
35
35
|
)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# Retrieves a Campaign object.
|
|
39
|
+
#
|
|
40
|
+
# @overload retrieve(id, request_options: {})
|
|
41
|
+
#
|
|
42
|
+
# @param id [String] The ID of the campaign to retrieve.
|
|
43
|
+
#
|
|
44
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
45
|
+
#
|
|
46
|
+
# @return [SurgeAPI::Models::Campaign]
|
|
47
|
+
#
|
|
48
|
+
# @see SurgeAPI::Models::CampaignRetrieveParams
|
|
49
|
+
def retrieve(id, params = {})
|
|
50
|
+
@client.request(
|
|
51
|
+
method: :get,
|
|
52
|
+
path: ["campaigns/%1$s", id],
|
|
53
|
+
model: SurgeAPI::Campaign,
|
|
54
|
+
options: params[:request_options]
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
38
58
|
# @api private
|
|
39
59
|
#
|
|
40
60
|
# @param client [SurgeAPI::Client]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Resources
|
|
5
|
+
class Recordings
|
|
6
|
+
# Redirects to a signed URL where the recording audio file can be downloaded. URL
|
|
7
|
+
# is short-lived, so redirect should be followed immediately.
|
|
8
|
+
#
|
|
9
|
+
# @overload get_file(recording_id, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param recording_id [String] The ID of the recording.
|
|
12
|
+
#
|
|
13
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
14
|
+
#
|
|
15
|
+
# @return [SurgeAPI::Models::RecordingGetFileResponse]
|
|
16
|
+
#
|
|
17
|
+
# @see SurgeAPI::Models::RecordingGetFileParams
|
|
18
|
+
def get_file(recording_id, params = {})
|
|
19
|
+
@client.request(
|
|
20
|
+
method: :get,
|
|
21
|
+
path: ["recordings/%1$s/file", recording_id],
|
|
22
|
+
model: SurgeAPI::Models::RecordingGetFileResponse,
|
|
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
|
|
@@ -5,7 +5,7 @@ module SurgeAPI
|
|
|
5
5
|
class Webhooks
|
|
6
6
|
# @param payload [String] The raw webhook payload as a string
|
|
7
7
|
#
|
|
8
|
-
# @return [SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent]
|
|
8
|
+
# @return [SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent]
|
|
9
9
|
def unwrap(payload)
|
|
10
10
|
parsed = JSON.parse(payload, symbolize_names: true)
|
|
11
11
|
SurgeAPI::Internal::Type::Converter.coerce(SurgeAPI::Models::UnwrapWebhookEvent, parsed)
|
data/lib/surge_api/version.rb
CHANGED
data/lib/surge_api.rb
CHANGED
|
@@ -67,6 +67,7 @@ require_relative "surge_api/models/call_ended_webhook_event"
|
|
|
67
67
|
require_relative "surge_api/models/campaign"
|
|
68
68
|
require_relative "surge_api/models/campaign_approved_webhook_event"
|
|
69
69
|
require_relative "surge_api/models/campaign_create_params"
|
|
70
|
+
require_relative "surge_api/models/campaign_retrieve_params"
|
|
70
71
|
require_relative "surge_api/models/contact"
|
|
71
72
|
require_relative "surge_api/models/contact_create_params"
|
|
72
73
|
require_relative "surge_api/models/contact_list_params"
|
|
@@ -89,6 +90,9 @@ require_relative "surge_api/models/organization"
|
|
|
89
90
|
require_relative "surge_api/models/phone_number"
|
|
90
91
|
require_relative "surge_api/models/phone_number_list_params"
|
|
91
92
|
require_relative "surge_api/models/phone_number_purchase_params"
|
|
93
|
+
require_relative "surge_api/models/recording_completed_webhook_event"
|
|
94
|
+
require_relative "surge_api/models/recording_get_file_params"
|
|
95
|
+
require_relative "surge_api/models/recording_get_file_response"
|
|
92
96
|
require_relative "surge_api/models/unwrap_webhook_event"
|
|
93
97
|
require_relative "surge_api/models/user"
|
|
94
98
|
require_relative "surge_api/models/user_create_params"
|
|
@@ -101,6 +105,7 @@ require_relative "surge_api/models/verification"
|
|
|
101
105
|
require_relative "surge_api/models/verification_check"
|
|
102
106
|
require_relative "surge_api/models/verification_check_params"
|
|
103
107
|
require_relative "surge_api/models/verification_create_params"
|
|
108
|
+
require_relative "surge_api/models/voicemail_received_webhook_event"
|
|
104
109
|
require_relative "surge_api/models/webhook_unwrap_params"
|
|
105
110
|
require_relative "surge_api/models"
|
|
106
111
|
require_relative "surge_api/resources/accounts"
|
|
@@ -109,6 +114,7 @@ require_relative "surge_api/resources/campaigns"
|
|
|
109
114
|
require_relative "surge_api/resources/contacts"
|
|
110
115
|
require_relative "surge_api/resources/messages"
|
|
111
116
|
require_relative "surge_api/resources/phone_numbers"
|
|
117
|
+
require_relative "surge_api/resources/recordings"
|
|
112
118
|
require_relative "surge_api/resources/users"
|
|
113
119
|
require_relative "surge_api/resources/verifications"
|
|
114
120
|
require_relative "surge_api/resources/webhooks"
|
data/rbi/surge_api/client.rbi
CHANGED
|
@@ -296,7 +296,7 @@ module SurgeAPI
|
|
|
296
296
|
end
|
|
297
297
|
|
|
298
298
|
JSON_CONTENT =
|
|
299
|
-
T.let(%r{^application/(?:
|
|
299
|
+
T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp)
|
|
300
300
|
JSONL_CONTENT =
|
|
301
301
|
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
|
|
302
302
|
|