surge_api 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/README.md +6 -6
- data/lib/surge_api/internal/cursor.rb +2 -2
- data/lib/surge_api/internal/util.rb +31 -0
- data/lib/surge_api/models/blast_create_params.rb +4 -4
- data/lib/surge_api/models/campaign.rb +0 -1
- data/lib/surge_api/models/campaign_list_params.rb +34 -0
- data/lib/surge_api/models/message.rb +18 -3
- data/lib/surge_api/models/message_delivered_webhook_event.rb +9 -1
- data/lib/surge_api/models/message_failed_webhook_event.rb +9 -1
- data/lib/surge_api/models/message_received_webhook_event.rb +9 -1
- data/lib/surge_api/models/message_sent_webhook_event.rb +9 -1
- data/lib/surge_api/models/phone_number.rb +9 -1
- data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +96 -0
- data/lib/surge_api/models/recording_delete_params.rb +14 -0
- data/lib/surge_api/models/recording_delete_response.rb +101 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +3 -1
- data/lib/surge_api/models.rb +6 -0
- data/lib/surge_api/resources/accounts.rb +2 -1
- data/lib/surge_api/resources/blasts.rb +1 -1
- data/lib/surge_api/resources/campaigns.rb +31 -0
- data/lib/surge_api/resources/contacts.rb +2 -1
- data/lib/surge_api/resources/messages.rb +2 -1
- data/lib/surge_api/resources/phone_numbers.rb +2 -1
- data/lib/surge_api/resources/recordings.rb +21 -0
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +4 -0
- data/rbi/surge_api/internal/util.rbi +20 -0
- data/rbi/surge_api/models/blast_create_params.rbi +4 -4
- data/rbi/surge_api/models/campaign.rbi +0 -1
- data/rbi/surge_api/models/campaign_list_params.rbi +59 -0
- data/rbi/surge_api/models/message.rbi +42 -6
- data/rbi/surge_api/models/message_delivered_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/message_failed_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/message_received_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/message_sent_webhook_event.rbi +8 -0
- data/rbi/surge_api/models/phone_number.rbi +8 -0
- data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +181 -0
- data/rbi/surge_api/models/recording_delete_params.rbi +27 -0
- data/rbi/surge_api/models/recording_delete_response.rbi +211 -0
- data/rbi/surge_api/models/unwrap_webhook_event.rbi +1 -0
- data/rbi/surge_api/models.rbi +7 -0
- data/rbi/surge_api/resources/blasts.rbi +2 -2
- data/rbi/surge_api/resources/campaigns.rbi +21 -0
- data/rbi/surge_api/resources/recordings.rbi +15 -0
- data/rbi/surge_api/resources/webhooks.rbi +1 -0
- data/sig/surge_api/internal/util.rbs +10 -0
- data/sig/surge_api/models/campaign.rbs +1 -8
- data/sig/surge_api/models/campaign_list_params.rbs +32 -0
- data/sig/surge_api/models/message.rbs +33 -5
- data/sig/surge_api/models/message_delivered_webhook_event.rbs +5 -0
- data/sig/surge_api/models/message_failed_webhook_event.rbs +5 -0
- data/sig/surge_api/models/message_received_webhook_event.rbs +5 -0
- data/sig/surge_api/models/message_sent_webhook_event.rbs +5 -0
- data/sig/surge_api/models/phone_number.rbs +10 -1
- data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +79 -0
- data/sig/surge_api/models/recording_delete_params.rbs +15 -0
- data/sig/surge_api/models/recording_delete_response.rbs +94 -0
- data/sig/surge_api/models/unwrap_webhook_event.rbs +1 -0
- data/sig/surge_api/models.rbs +6 -0
- data/sig/surge_api/resources/campaigns.rbs +7 -0
- data/sig/surge_api/resources/recordings.rbs +5 -0
- data/sig/surge_api/resources/webhooks.rbs +1 -0
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8012d35d6b7aaae2d18541e688d7605e1ee985153b70ebec72790ddb0ba3b28b
|
|
4
|
+
data.tar.gz: 7051be5e16f4e06b7eafac3c3b8b7554fc06710c5b6a0104e8f4dabe6ba8f448
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50cb8dd9f5162634bb262e93eda01ed24d9af0d8c0c45171d4642969e7824292cea2465ef00d199a85e62e0ad7a38288ed082c44f7a529210c13802e0cfbcf77
|
|
7
|
+
data.tar.gz: 4b0d24f6c73cfb6b038ac5c9663cbf2c83917770eff0f3d0d36fe9006cfc2adf80892f9c65b693380f3f9e671362af3e2ef93a1cb5743dc3d39e935d57ed12ed
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0 (2026-03-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.11.0...v0.12.0](https://github.com/surgeapi/ruby-sdk/compare/v0.11.0...v0.12.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add campaign ID to phone numbers ([76e02a6](https://github.com/surgeapi/ruby-sdk/commit/76e02a67b248539548b0bc918178dcb9749ef2aa))
|
|
10
|
+
* **api:** add phoneNumberAttachedToCampaign webhook ([b145691](https://github.com/surgeapi/ruby-sdk/commit/b14569150ea04fd2d74f9f17ff0ab3bbf00d9c19))
|
|
11
|
+
* **api:** remove 'pending' campaign status ([067f38a](https://github.com/surgeapi/ruby-sdk/commit/067f38adf747327111ad032362f5e9faf31dddce))
|
|
12
|
+
* **api:** rename segments to audiences ([69c982c](https://github.com/surgeapi/ruby-sdk/commit/69c982c90af4999babdff64a46ffe5df1d54391a))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* properly mock time in ruby ci tests ([6c75ef3](https://github.com/surgeapi/ruby-sdk/commit/6c75ef31490dc13fb591146b2b27a8a3c8f3495c))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* **ci:** add build step ([4999f0c](https://github.com/surgeapi/ruby-sdk/commit/4999f0c610b73f42d468fc200aeafe002f4947b0))
|
|
23
|
+
* **internal:** codegen related update ([bd1d5f0](https://github.com/surgeapi/ruby-sdk/commit/bd1d5f019b6ec12acdca6e36af2c46065dab0e70))
|
|
24
|
+
|
|
25
|
+
## 0.11.0 (2026-02-22)
|
|
26
|
+
|
|
27
|
+
Full Changelog: [v0.10.0...v0.11.0](https://github.com/surgeapi/ruby-sdk/compare/v0.10.0...v0.11.0)
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **api:** add list campaigns endpoint ([253f71e](https://github.com/surgeapi/ruby-sdk/commit/253f71e0ac6ba81778c59aeddf33a6a80b898ac3))
|
|
32
|
+
* **api:** add metadata to message webhooks ([6827521](https://github.com/surgeapi/ruby-sdk/commit/68275214c295b5b102ef3c05a62ed08a03794ac6))
|
|
33
|
+
* **api:** delete recording endpoint ([64d7bf2](https://github.com/surgeapi/ruby-sdk/commit/64d7bf2f8730fa7a11a4b38c07ade41a850bf5a8))
|
|
34
|
+
* **api:** make attachment type an enum ([2897de1](https://github.com/surgeapi/ruby-sdk/commit/2897de13cd5eb3c95c30b251b7baf7edf5c0b6d7))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Chores
|
|
38
|
+
|
|
39
|
+
* **internal:** remove mock server code ([1411557](https://github.com/surgeapi/ruby-sdk/commit/1411557864e6741dc576fe5802cbd2bb2dcaa9e6))
|
|
40
|
+
* **test:** update skip reason message ([cbb9e45](https://github.com/surgeapi/ruby-sdk/commit/cbb9e4564283c9b1e733c443bba93cefe10d0f85))
|
|
41
|
+
* update mock server docs ([cd3da3a](https://github.com/surgeapi/ruby-sdk/commit/cd3da3a27ea9d4d5a511ecf8ea82ca4fbe00eaef))
|
|
42
|
+
|
|
3
43
|
## 0.10.0 (2026-02-12)
|
|
4
44
|
|
|
5
45
|
Full Changelog: [v0.9.0...v0.10.0](https://github.com/surgeapi/ruby-sdk/compare/v0.9.0...v0.10.0)
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
17
17
|
<!-- x-release-please-start-version -->
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "surge_api", "~> 0.
|
|
20
|
+
gem "surge_api", "~> 0.12.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
|
@@ -44,15 +44,15 @@ List methods in the Surge API are paginated.
|
|
|
44
44
|
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
|
|
45
45
|
|
|
46
46
|
```ruby
|
|
47
|
-
page = surge.
|
|
47
|
+
page = surge.campaigns.list
|
|
48
48
|
|
|
49
49
|
# Fetch single item from page.
|
|
50
|
-
|
|
51
|
-
puts(
|
|
50
|
+
campaign = page.data[0]
|
|
51
|
+
puts(campaign.id)
|
|
52
52
|
|
|
53
53
|
# Automatically fetches more pages as needed.
|
|
54
|
-
page.auto_paging_each do |
|
|
55
|
-
puts(
|
|
54
|
+
page.auto_paging_each do |campaign|
|
|
55
|
+
puts(campaign.id)
|
|
56
56
|
end
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -490,6 +490,37 @@ module SurgeAPI
|
|
|
490
490
|
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
|
491
491
|
|
|
492
492
|
class << self
|
|
493
|
+
# @api private
|
|
494
|
+
#
|
|
495
|
+
# @param query [Hash{Symbol=>Object}]
|
|
496
|
+
#
|
|
497
|
+
# @return [Hash{Symbol=>Object}]
|
|
498
|
+
def encode_query_params(query)
|
|
499
|
+
out = {}
|
|
500
|
+
query.each { write_query_param_element!(out, _1, _2) }
|
|
501
|
+
out
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
# @api private
|
|
505
|
+
#
|
|
506
|
+
# @param collection [Hash{Symbol=>Object}]
|
|
507
|
+
# @param key [String]
|
|
508
|
+
# @param element [Object]
|
|
509
|
+
#
|
|
510
|
+
# @return [nil]
|
|
511
|
+
private def write_query_param_element!(collection, key, element)
|
|
512
|
+
case element
|
|
513
|
+
in Hash
|
|
514
|
+
element.each do |name, value|
|
|
515
|
+
write_query_param_element!(collection, "#{key}[#{name}]", value)
|
|
516
|
+
end
|
|
517
|
+
in Array
|
|
518
|
+
collection[key] = element.map(&:to_s).join(",")
|
|
519
|
+
else
|
|
520
|
+
collection[key] = element.to_s
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
493
524
|
# @api private
|
|
494
525
|
#
|
|
495
526
|
# @param y [Enumerator::Yielder]
|
|
@@ -41,9 +41,9 @@ module SurgeAPI
|
|
|
41
41
|
optional :name, String
|
|
42
42
|
|
|
43
43
|
# @!attribute segments
|
|
44
|
-
# @deprecated Use `to` to specify recipients instead.
|
|
44
|
+
# @deprecated Use `to` with audience IDs (`aud_...`) to specify audience recipients instead.
|
|
45
45
|
#
|
|
46
|
-
# Deprecated. Use `to` instead.
|
|
46
|
+
# Deprecated. Use `to` with audience IDs instead.
|
|
47
47
|
#
|
|
48
48
|
# @return [Array<String>, nil]
|
|
49
49
|
optional :segments, SurgeAPI::Internal::Type::ArrayOf[String]
|
|
@@ -56,7 +56,7 @@ module SurgeAPI
|
|
|
56
56
|
|
|
57
57
|
# @!attribute to
|
|
58
58
|
# List of recipients to whom the blast should be sent. This can be a combination
|
|
59
|
-
# of contact IDs,
|
|
59
|
+
# of contact IDs, audience IDs, and phone numbers.
|
|
60
60
|
#
|
|
61
61
|
# @return [Array<String>, nil]
|
|
62
62
|
optional :to, SurgeAPI::Internal::Type::ArrayOf[String]
|
|
@@ -75,7 +75,7 @@ module SurgeAPI
|
|
|
75
75
|
#
|
|
76
76
|
# @param name [String] Optional name for the blast.
|
|
77
77
|
#
|
|
78
|
-
# @param segments [Array<String>] Deprecated. Use `to` instead.
|
|
78
|
+
# @param segments [Array<String>] Deprecated. Use `to` with audience IDs instead.
|
|
79
79
|
#
|
|
80
80
|
# @param send_at [Time] When to send the blast. If not provided, sends immediately.
|
|
81
81
|
#
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Campaigns#list
|
|
6
|
+
class CampaignListParams < SurgeAPI::Internal::Type::BaseModel
|
|
7
|
+
extend SurgeAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include SurgeAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute after
|
|
11
|
+
# Cursor for forward pagination. Use the next_cursor from a previous response.
|
|
12
|
+
#
|
|
13
|
+
# @return [String, nil]
|
|
14
|
+
optional :after, String
|
|
15
|
+
|
|
16
|
+
# @!attribute before
|
|
17
|
+
# Cursor for backward pagination. Use the previous_cursor from a previous
|
|
18
|
+
# response.
|
|
19
|
+
#
|
|
20
|
+
# @return [String, nil]
|
|
21
|
+
optional :before, String
|
|
22
|
+
|
|
23
|
+
# @!method initialize(after: nil, before: nil, request_options: {})
|
|
24
|
+
# Some parameter documentations has been truncated, see
|
|
25
|
+
# {SurgeAPI::Models::CampaignListParams} for more details.
|
|
26
|
+
#
|
|
27
|
+
# @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
|
|
28
|
+
#
|
|
29
|
+
# @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
|
|
30
|
+
#
|
|
31
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -68,8 +68,8 @@ module SurgeAPI
|
|
|
68
68
|
# @!attribute type
|
|
69
69
|
# The type of attachment.
|
|
70
70
|
#
|
|
71
|
-
# @return [
|
|
72
|
-
optional :type,
|
|
71
|
+
# @return [Symbol, SurgeAPI::Models::Message::Attachment::Type, nil]
|
|
72
|
+
optional :type, enum: -> { SurgeAPI::Message::Attachment::Type }
|
|
73
73
|
|
|
74
74
|
# @!attribute url
|
|
75
75
|
# The URL of the attachment.
|
|
@@ -82,9 +82,24 @@ module SurgeAPI
|
|
|
82
82
|
#
|
|
83
83
|
# @param id [String] Unique identifier for the object.
|
|
84
84
|
#
|
|
85
|
-
# @param type [
|
|
85
|
+
# @param type [Symbol, SurgeAPI::Models::Message::Attachment::Type] The type of attachment.
|
|
86
86
|
#
|
|
87
87
|
# @param url [String] The URL of the attachment.
|
|
88
|
+
|
|
89
|
+
# The type of attachment.
|
|
90
|
+
#
|
|
91
|
+
# @see SurgeAPI::Models::Message::Attachment#type
|
|
92
|
+
module Type
|
|
93
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
94
|
+
|
|
95
|
+
FILE = :file
|
|
96
|
+
IMAGE = :image
|
|
97
|
+
LINK = :link
|
|
98
|
+
VIDEO = :video
|
|
99
|
+
|
|
100
|
+
# @!method self.values
|
|
101
|
+
# @return [Array<Symbol>]
|
|
102
|
+
end
|
|
88
103
|
end
|
|
89
104
|
|
|
90
105
|
# @see SurgeAPI::Models::Message#conversation
|
|
@@ -62,6 +62,12 @@ module SurgeAPI
|
|
|
62
62
|
# @return [Time]
|
|
63
63
|
required :delivered_at, Time
|
|
64
64
|
|
|
65
|
+
# @!attribute metadata
|
|
66
|
+
# Set of key-value pairs that will be stored with the object.
|
|
67
|
+
#
|
|
68
|
+
# @return [Hash{Symbol=>String}]
|
|
69
|
+
required :metadata, SurgeAPI::Internal::Type::HashOf[String]
|
|
70
|
+
|
|
65
71
|
# @!attribute attachments
|
|
66
72
|
# Attachments included with the message
|
|
67
73
|
#
|
|
@@ -76,7 +82,7 @@ module SurgeAPI
|
|
|
76
82
|
# @return [String, nil]
|
|
77
83
|
optional :blast_id, String
|
|
78
84
|
|
|
79
|
-
# @!method initialize(id:, body:, conversation:, delivered_at:, attachments: nil, blast_id: nil)
|
|
85
|
+
# @!method initialize(id:, body:, conversation:, delivered_at:, metadata:, attachments: nil, blast_id: nil)
|
|
80
86
|
# Some parameter documentations has been truncated, see
|
|
81
87
|
# {SurgeAPI::Models::MessageDeliveredWebhookEvent::Data} for more details.
|
|
82
88
|
#
|
|
@@ -90,6 +96,8 @@ module SurgeAPI
|
|
|
90
96
|
#
|
|
91
97
|
# @param delivered_at [Time] When the message was delivered
|
|
92
98
|
#
|
|
99
|
+
# @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
|
|
100
|
+
#
|
|
93
101
|
# @param attachments [Array<SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment>] Attachments included with the message
|
|
94
102
|
#
|
|
95
103
|
# @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
|
|
@@ -68,6 +68,12 @@ module SurgeAPI
|
|
|
68
68
|
# @return [String]
|
|
69
69
|
required :failure_reason, String
|
|
70
70
|
|
|
71
|
+
# @!attribute metadata
|
|
72
|
+
# Set of key-value pairs that will be stored with the object.
|
|
73
|
+
#
|
|
74
|
+
# @return [Hash{Symbol=>String}]
|
|
75
|
+
required :metadata, SurgeAPI::Internal::Type::HashOf[String]
|
|
76
|
+
|
|
71
77
|
# @!attribute attachments
|
|
72
78
|
# Attachments included with the message
|
|
73
79
|
#
|
|
@@ -82,7 +88,7 @@ module SurgeAPI
|
|
|
82
88
|
# @return [String, nil]
|
|
83
89
|
optional :blast_id, String
|
|
84
90
|
|
|
85
|
-
# @!method initialize(id:, body:, conversation:, failed_at:, failure_reason:, attachments: nil, blast_id: nil)
|
|
91
|
+
# @!method initialize(id:, body:, conversation:, failed_at:, failure_reason:, metadata:, attachments: nil, blast_id: nil)
|
|
86
92
|
# Some parameter documentations has been truncated, see
|
|
87
93
|
# {SurgeAPI::Models::MessageFailedWebhookEvent::Data} for more details.
|
|
88
94
|
#
|
|
@@ -98,6 +104,8 @@ module SurgeAPI
|
|
|
98
104
|
#
|
|
99
105
|
# @param failure_reason [String] The reason the message failed to be delivered
|
|
100
106
|
#
|
|
107
|
+
# @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
|
|
108
|
+
#
|
|
101
109
|
# @param attachments [Array<SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment>] Attachments included with the message
|
|
102
110
|
#
|
|
103
111
|
# @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
|
|
@@ -56,6 +56,12 @@ module SurgeAPI
|
|
|
56
56
|
# @return [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation]
|
|
57
57
|
required :conversation, -> { SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation }
|
|
58
58
|
|
|
59
|
+
# @!attribute metadata
|
|
60
|
+
# Set of key-value pairs that will be stored with the object.
|
|
61
|
+
#
|
|
62
|
+
# @return [Hash{Symbol=>String}]
|
|
63
|
+
required :metadata, SurgeAPI::Internal::Type::HashOf[String]
|
|
64
|
+
|
|
59
65
|
# @!attribute received_at
|
|
60
66
|
# When the message was received
|
|
61
67
|
#
|
|
@@ -76,7 +82,7 @@ module SurgeAPI
|
|
|
76
82
|
# @return [String, nil]
|
|
77
83
|
optional :blast_id, String
|
|
78
84
|
|
|
79
|
-
# @!method initialize(id:, body:, conversation:, received_at:, attachments: nil, blast_id: nil)
|
|
85
|
+
# @!method initialize(id:, body:, conversation:, metadata:, received_at:, attachments: nil, blast_id: nil)
|
|
80
86
|
# Some parameter documentations has been truncated, see
|
|
81
87
|
# {SurgeAPI::Models::MessageReceivedWebhookEvent::Data} for more details.
|
|
82
88
|
#
|
|
@@ -88,6 +94,8 @@ module SurgeAPI
|
|
|
88
94
|
#
|
|
89
95
|
# @param conversation [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation] The conversation this message belongs to
|
|
90
96
|
#
|
|
97
|
+
# @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
|
|
98
|
+
#
|
|
91
99
|
# @param received_at [Time] When the message was received
|
|
92
100
|
#
|
|
93
101
|
# @param attachments [Array<SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment>] Attachments included with the message
|
|
@@ -56,6 +56,12 @@ module SurgeAPI
|
|
|
56
56
|
# @return [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation]
|
|
57
57
|
required :conversation, -> { SurgeAPI::MessageSentWebhookEvent::Data::Conversation }
|
|
58
58
|
|
|
59
|
+
# @!attribute metadata
|
|
60
|
+
# Set of key-value pairs that will be stored with the object.
|
|
61
|
+
#
|
|
62
|
+
# @return [Hash{Symbol=>String}]
|
|
63
|
+
required :metadata, SurgeAPI::Internal::Type::HashOf[String]
|
|
64
|
+
|
|
59
65
|
# @!attribute sent_at
|
|
60
66
|
# When the message was sent
|
|
61
67
|
#
|
|
@@ -76,7 +82,7 @@ module SurgeAPI
|
|
|
76
82
|
# @return [String, nil]
|
|
77
83
|
optional :blast_id, String
|
|
78
84
|
|
|
79
|
-
# @!method initialize(id:, body:, conversation:, sent_at:, attachments: nil, blast_id: nil)
|
|
85
|
+
# @!method initialize(id:, body:, conversation:, metadata:, sent_at:, attachments: nil, blast_id: nil)
|
|
80
86
|
# Some parameter documentations has been truncated, see
|
|
81
87
|
# {SurgeAPI::Models::MessageSentWebhookEvent::Data} for more details.
|
|
82
88
|
#
|
|
@@ -88,6 +94,8 @@ module SurgeAPI
|
|
|
88
94
|
#
|
|
89
95
|
# @param conversation [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation] The conversation this message belongs to
|
|
90
96
|
#
|
|
97
|
+
# @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
|
|
98
|
+
#
|
|
91
99
|
# @param sent_at [Time] When the message was sent
|
|
92
100
|
#
|
|
93
101
|
# @param attachments [Array<SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment>] Attachments included with the message
|
|
@@ -10,6 +10,12 @@ module SurgeAPI
|
|
|
10
10
|
# @return [String]
|
|
11
11
|
required :id, String
|
|
12
12
|
|
|
13
|
+
# @!attribute campaign_id
|
|
14
|
+
# The unique identifier of the campaign this phone number is attached to, if any
|
|
15
|
+
#
|
|
16
|
+
# @return [String, nil]
|
|
17
|
+
required :campaign_id, String, nil?: true
|
|
18
|
+
|
|
13
19
|
# @!attribute number
|
|
14
20
|
# The phone number in E.164 format
|
|
15
21
|
#
|
|
@@ -22,11 +28,13 @@ module SurgeAPI
|
|
|
22
28
|
# @return [Symbol, SurgeAPI::Models::PhoneNumber::Type]
|
|
23
29
|
required :type, enum: -> { SurgeAPI::PhoneNumber::Type }
|
|
24
30
|
|
|
25
|
-
# @!method initialize(id:, number:, type:)
|
|
31
|
+
# @!method initialize(id:, campaign_id:, number:, type:)
|
|
26
32
|
# A phone number that can be used to send and receive messages and calls
|
|
27
33
|
#
|
|
28
34
|
# @param id [String] Unique identifier for the phone number
|
|
29
35
|
#
|
|
36
|
+
# @param campaign_id [String, nil] The unique identifier of the campaign this phone number is attached to, if any
|
|
37
|
+
#
|
|
30
38
|
# @param number [String] The phone number in E.164 format
|
|
31
39
|
#
|
|
32
40
|
# @param type [Symbol, SurgeAPI::Models::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class PhoneNumberAttachedToCampaignWebhookEvent < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute account_id
|
|
7
|
+
# The ID of the account in which this event occurred
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
required :account_id, String
|
|
11
|
+
|
|
12
|
+
# @!attribute data
|
|
13
|
+
# The data associated with the event
|
|
14
|
+
#
|
|
15
|
+
# @return [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data]
|
|
16
|
+
required :data, -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data }
|
|
17
|
+
|
|
18
|
+
# @!attribute timestamp
|
|
19
|
+
# The timestamp when this event occurred, in ISO8601 format
|
|
20
|
+
#
|
|
21
|
+
# @return [Time]
|
|
22
|
+
required :timestamp, Time
|
|
23
|
+
|
|
24
|
+
# @!attribute type
|
|
25
|
+
# The type of the event. Always `phone_number.attached_to_campaign` for this
|
|
26
|
+
# event.
|
|
27
|
+
#
|
|
28
|
+
# @return [Symbol, :"phone_number.attached_to_campaign"]
|
|
29
|
+
required :type, const: :"phone_number.attached_to_campaign"
|
|
30
|
+
|
|
31
|
+
# @!method initialize(account_id:, data:, timestamp:, type: :"phone_number.attached_to_campaign")
|
|
32
|
+
# Some parameter documentations has been truncated, see
|
|
33
|
+
# {SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent} for more details.
|
|
34
|
+
#
|
|
35
|
+
# @param account_id [String] The ID of the account in which this event occurred
|
|
36
|
+
#
|
|
37
|
+
# @param data [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data] The data associated with the event
|
|
38
|
+
#
|
|
39
|
+
# @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
|
|
40
|
+
#
|
|
41
|
+
# @param type [Symbol, :"phone_number.attached_to_campaign"] The type of the event. Always `phone_number.attached_to_campaign` for this event
|
|
42
|
+
|
|
43
|
+
# @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent#data
|
|
44
|
+
class Data < SurgeAPI::Internal::Type::BaseModel
|
|
45
|
+
# @!attribute id
|
|
46
|
+
# The unique identifier for the phone number
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
required :id, String
|
|
50
|
+
|
|
51
|
+
# @!attribute campaign_id
|
|
52
|
+
# The unique identifier of the campaign this phone number is attached to
|
|
53
|
+
#
|
|
54
|
+
# @return [String]
|
|
55
|
+
required :campaign_id, String
|
|
56
|
+
|
|
57
|
+
# @!attribute number
|
|
58
|
+
# The phone number in E.164 format
|
|
59
|
+
#
|
|
60
|
+
# @return [String]
|
|
61
|
+
required :number, String
|
|
62
|
+
|
|
63
|
+
# @!attribute type
|
|
64
|
+
# Whether the phone number is local, toll-free, or short code
|
|
65
|
+
#
|
|
66
|
+
# @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type]
|
|
67
|
+
required :type, enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type }
|
|
68
|
+
|
|
69
|
+
# @!method initialize(id:, campaign_id:, number:, type:)
|
|
70
|
+
# The data associated with the event
|
|
71
|
+
#
|
|
72
|
+
# @param id [String] The unique identifier for the phone number
|
|
73
|
+
#
|
|
74
|
+
# @param campaign_id [String] The unique identifier of the campaign this phone number is attached to
|
|
75
|
+
#
|
|
76
|
+
# @param number [String] The phone number in E.164 format
|
|
77
|
+
#
|
|
78
|
+
# @param type [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type] Whether the phone number is local, toll-free, or short code
|
|
79
|
+
|
|
80
|
+
# Whether the phone number is local, toll-free, or short code
|
|
81
|
+
#
|
|
82
|
+
# @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data#type
|
|
83
|
+
module Type
|
|
84
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
85
|
+
|
|
86
|
+
LOCAL = :local
|
|
87
|
+
SHORT_CODE = :short_code
|
|
88
|
+
TOLL_FREE = :toll_free
|
|
89
|
+
|
|
90
|
+
# @!method self.values
|
|
91
|
+
# @return [Array<Symbol>]
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Recordings#delete
|
|
6
|
+
class RecordingDeleteParams < 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,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Recordings#delete
|
|
6
|
+
class RecordingDeleteResponse < SurgeAPI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# The unique identifier for the recording
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :id, String
|
|
12
|
+
|
|
13
|
+
# @!attribute call
|
|
14
|
+
# The call that produced this recording
|
|
15
|
+
#
|
|
16
|
+
# @return [SurgeAPI::Models::RecordingDeleteResponse::Call]
|
|
17
|
+
required :call, -> { SurgeAPI::Models::RecordingDeleteResponse::Call }
|
|
18
|
+
|
|
19
|
+
# @!attribute duration
|
|
20
|
+
# The duration of the recording in seconds
|
|
21
|
+
#
|
|
22
|
+
# @return [Integer]
|
|
23
|
+
required :duration, Integer
|
|
24
|
+
|
|
25
|
+
# @!method initialize(id:, call:, duration:)
|
|
26
|
+
# A call recording
|
|
27
|
+
#
|
|
28
|
+
# @param id [String] The unique identifier for the recording
|
|
29
|
+
#
|
|
30
|
+
# @param call [SurgeAPI::Models::RecordingDeleteResponse::Call] The call that produced this recording
|
|
31
|
+
#
|
|
32
|
+
# @param duration [Integer] The duration of the recording in seconds
|
|
33
|
+
|
|
34
|
+
# @see SurgeAPI::Models::RecordingDeleteResponse#call
|
|
35
|
+
class Call < SurgeAPI::Internal::Type::BaseModel
|
|
36
|
+
# @!attribute id
|
|
37
|
+
# The unique identifier for the call
|
|
38
|
+
#
|
|
39
|
+
# @return [String]
|
|
40
|
+
required :id, String
|
|
41
|
+
|
|
42
|
+
# @!attribute contact
|
|
43
|
+
# A contact who has consented to receive messages
|
|
44
|
+
#
|
|
45
|
+
# @return [SurgeAPI::Models::Contact]
|
|
46
|
+
required :contact, -> { SurgeAPI::Contact }
|
|
47
|
+
|
|
48
|
+
# @!attribute duration
|
|
49
|
+
# The duration of the call in seconds
|
|
50
|
+
#
|
|
51
|
+
# @return [Integer]
|
|
52
|
+
required :duration, Integer
|
|
53
|
+
|
|
54
|
+
# @!attribute initiated_at
|
|
55
|
+
# When the call was initiated
|
|
56
|
+
#
|
|
57
|
+
# @return [Time]
|
|
58
|
+
required :initiated_at, Time
|
|
59
|
+
|
|
60
|
+
# @!attribute status
|
|
61
|
+
# The status of the call
|
|
62
|
+
#
|
|
63
|
+
# @return [Symbol, SurgeAPI::Models::RecordingDeleteResponse::Call::Status]
|
|
64
|
+
required :status, enum: -> { SurgeAPI::Models::RecordingDeleteResponse::Call::Status }
|
|
65
|
+
|
|
66
|
+
# @!method initialize(id:, contact:, duration:, initiated_at:, status:)
|
|
67
|
+
# The call that produced this recording
|
|
68
|
+
#
|
|
69
|
+
# @param id [String] The unique identifier for the call
|
|
70
|
+
#
|
|
71
|
+
# @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
|
|
72
|
+
#
|
|
73
|
+
# @param duration [Integer] The duration of the call in seconds
|
|
74
|
+
#
|
|
75
|
+
# @param initiated_at [Time] When the call was initiated
|
|
76
|
+
#
|
|
77
|
+
# @param status [Symbol, SurgeAPI::Models::RecordingDeleteResponse::Call::Status] The status of the call
|
|
78
|
+
|
|
79
|
+
# The status of the call
|
|
80
|
+
#
|
|
81
|
+
# @see SurgeAPI::Models::RecordingDeleteResponse::Call#status
|
|
82
|
+
module Status
|
|
83
|
+
extend SurgeAPI::Internal::Type::Enum
|
|
84
|
+
|
|
85
|
+
BUSY = :busy
|
|
86
|
+
CANCELED = :canceled
|
|
87
|
+
COMPLETED = :completed
|
|
88
|
+
FAILED = :failed
|
|
89
|
+
IN_PROGRESS = :in_progress
|
|
90
|
+
MISSED = :missed
|
|
91
|
+
NO_ANSWER = :no_answer
|
|
92
|
+
QUEUED = :queued
|
|
93
|
+
RINGING = :ringing
|
|
94
|
+
|
|
95
|
+
# @!method self.values
|
|
96
|
+
# @return [Array<Symbol>]
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -27,12 +27,14 @@ module SurgeAPI
|
|
|
27
27
|
|
|
28
28
|
variant :"message.sent", -> { SurgeAPI::MessageSentWebhookEvent }
|
|
29
29
|
|
|
30
|
+
variant :"phone_number.attached_to_campaign", -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent }
|
|
31
|
+
|
|
30
32
|
variant :"recording.completed", -> { SurgeAPI::RecordingCompletedWebhookEvent }
|
|
31
33
|
|
|
32
34
|
variant :"voicemail.received", -> { SurgeAPI::VoicemailReceivedWebhookEvent }
|
|
33
35
|
|
|
34
36
|
# @!method self.variants
|
|
35
|
-
# @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent)]
|
|
37
|
+
# @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::LinkFollowedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent, SurgeAPI::Models::RecordingCompletedWebhookEvent, SurgeAPI::Models::VoicemailReceivedWebhookEvent)]
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
data/lib/surge_api/models.rb
CHANGED
|
@@ -63,6 +63,8 @@ module SurgeAPI
|
|
|
63
63
|
|
|
64
64
|
CampaignCreateParams = SurgeAPI::Models::CampaignCreateParams
|
|
65
65
|
|
|
66
|
+
CampaignListParams = SurgeAPI::Models::CampaignListParams
|
|
67
|
+
|
|
66
68
|
CampaignParams = SurgeAPI::Models::CampaignParams
|
|
67
69
|
|
|
68
70
|
CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
|
|
@@ -109,12 +111,16 @@ module SurgeAPI
|
|
|
109
111
|
|
|
110
112
|
PhoneNumber = SurgeAPI::Models::PhoneNumber
|
|
111
113
|
|
|
114
|
+
PhoneNumberAttachedToCampaignWebhookEvent = SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
|
|
115
|
+
|
|
112
116
|
PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
|
|
113
117
|
|
|
114
118
|
PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
|
|
115
119
|
|
|
116
120
|
RecordingCompletedWebhookEvent = SurgeAPI::Models::RecordingCompletedWebhookEvent
|
|
117
121
|
|
|
122
|
+
RecordingDeleteParams = SurgeAPI::Models::RecordingDeleteParams
|
|
123
|
+
|
|
118
124
|
RecordingGetFileParams = SurgeAPI::Models::RecordingGetFileParams
|
|
119
125
|
|
|
120
126
|
UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
|