surge_api 0.15.0 → 0.17.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 +6 -6
- data/lib/surge_api/client.rb +4 -0
- data/lib/surge_api/internal/cursor.rb +2 -2
- data/lib/surge_api/models/account_list_params.rb +34 -0
- data/lib/surge_api/models/attachment_get_file_params.rb +14 -0
- data/lib/surge_api/models/attachment_get_file_response.rb +19 -0
- data/lib/surge_api/models/link_followed_webhook_event.rb +15 -5
- data/lib/surge_api/models/message.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 +9 -1
- data/lib/surge_api/models/phone_number_purchase_params.rb +10 -1
- data/lib/surge_api/models.rb +4 -0
- data/lib/surge_api/resources/accounts.rb +29 -0
- data/lib/surge_api/resources/attachments.rb +35 -0
- data/lib/surge_api/resources/phone_numbers.rb +3 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +4 -0
- data/rbi/surge_api/client.rbi +3 -0
- data/rbi/surge_api/models/account_list_params.rbi +59 -0
- data/rbi/surge_api/models/attachment_get_file_params.rbi +27 -0
- data/rbi/surge_api/models/attachment_get_file_response.rbi +34 -0
- data/rbi/surge_api/models/link_followed_webhook_event.rbi +26 -7
- data/rbi/surge_api/models/message.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 +8 -0
- data/rbi/surge_api/models/phone_number_purchase_params.rbi +13 -0
- data/rbi/surge_api/models.rbi +4 -0
- data/rbi/surge_api/resources/accounts.rbi +18 -0
- data/rbi/surge_api/resources/attachments.rbi +27 -0
- data/rbi/surge_api/resources/phone_numbers.rbi +4 -0
- data/sig/surge_api/client.rbs +2 -0
- data/sig/surge_api/models/account_list_params.rbs +32 -0
- data/sig/surge_api/models/attachment_get_file_params.rbs +15 -0
- data/sig/surge_api/models/attachment_get_file_response.rbs +13 -0
- data/sig/surge_api/models/link_followed_webhook_event.rbs +22 -4
- data/sig/surge_api/models/message.rbs +5 -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_purchase_params.rbs +7 -0
- data/sig/surge_api/models.rbs +4 -0
- data/sig/surge_api/resources/accounts.rbs +6 -0
- data/sig/surge_api/resources/attachments.rbs +12 -0
- data/sig/surge_api/resources/phone_numbers.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: dcd65a3f11b5c187dcefe5f82f90dfef4bb4421e06115246ccda187f459e9202
|
|
4
|
+
data.tar.gz: c8bac9291bc751a4ddfdb952f70eb32fcb696ef886a5c3521f149e7235f18733
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0032493ed7b14b18fc06f216c37ed91814fbd61874e777604013cde0c694859767b177820dc298559024a9a2c7f39d878157e7e6b24035fce20ad07fa1b984e0'
|
|
7
|
+
data.tar.gz: abe1e0ff490003f4f4376847989c4b0f982abb34ac3eae1bc308b81abf22a03e4078dd08d49c23db58a91e271831d450fe2087938286455fcc381d126602a14c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0 (2026-05-04)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.16.0...v0.17.0](https://github.com/surgeapi/ruby-sdk/compare/v0.16.0...v0.17.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** list accounts endpoint ([510b3bc](https://github.com/surgeapi/ruby-sdk/commit/510b3bc3d2ab9b8659e5ca0701cef8fc2c5f2a2e))
|
|
10
|
+
|
|
11
|
+
## 0.16.0 (2026-04-22)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.15.0...v0.16.0](https://github.com/surgeapi/ruby-sdk/compare/v0.15.0...v0.16.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** add endpoint to get attachment file ([5475d91](https://github.com/surgeapi/ruby-sdk/commit/5475d91e283e6afb974243f11a259e9990471f88))
|
|
18
|
+
* **api:** add message to link.followed events ([1c36d5c](https://github.com/surgeapi/ruby-sdk/commit/1c36d5c6c21eb866aa5489ce0b70b01bfd01a9e4))
|
|
19
|
+
* **api:** add name to phone numbers ([ee71d0d](https://github.com/surgeapi/ruby-sdk/commit/ee71d0dcec71388ed0af4132759072cca94e11f0))
|
|
20
|
+
|
|
3
21
|
## 0.15.0 (2026-04-06)
|
|
4
22
|
|
|
5
23
|
Full Changelog: [v0.14.0...v0.15.0](https://github.com/surgeapi/ruby-sdk/compare/v0.14.0...v0.15.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.17.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.accounts.list
|
|
48
48
|
|
|
49
49
|
# Fetch single item from page.
|
|
50
|
-
|
|
51
|
-
puts(
|
|
50
|
+
account = page.data[0]
|
|
51
|
+
puts(account.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 |account|
|
|
55
|
+
puts(account.id)
|
|
56
56
|
end
|
|
57
57
|
```
|
|
58
58
|
|
data/lib/surge_api/client.rb
CHANGED
|
@@ -21,6 +21,9 @@ module SurgeAPI
|
|
|
21
21
|
# @return [SurgeAPI::Resources::Accounts]
|
|
22
22
|
attr_reader :accounts
|
|
23
23
|
|
|
24
|
+
# @return [SurgeAPI::Resources::Attachments]
|
|
25
|
+
attr_reader :attachments
|
|
26
|
+
|
|
24
27
|
# @return [SurgeAPI::Resources::Audiences]
|
|
25
28
|
attr_reader :audiences
|
|
26
29
|
|
|
@@ -99,6 +102,7 @@ module SurgeAPI
|
|
|
99
102
|
)
|
|
100
103
|
|
|
101
104
|
@accounts = SurgeAPI::Resources::Accounts.new(client: self)
|
|
105
|
+
@attachments = SurgeAPI::Resources::Attachments.new(client: self)
|
|
102
106
|
@audiences = SurgeAPI::Resources::Audiences.new(client: self)
|
|
103
107
|
@blasts = SurgeAPI::Resources::Blasts.new(client: self)
|
|
104
108
|
@campaigns = SurgeAPI::Resources::Campaigns.new(client: self)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Accounts#list
|
|
6
|
+
class AccountListParams < 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::AccountListParams} 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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Attachments#get_file
|
|
6
|
+
class AttachmentGetFileParams < SurgeAPI::Internal::Type::BaseModel
|
|
7
|
+
extend SurgeAPI::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include SurgeAPI::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!method initialize(request_options: {})
|
|
11
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
# @see SurgeAPI::Resources::Attachments#get_file
|
|
6
|
+
class AttachmentGetFileResponse < SurgeAPI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute error
|
|
8
|
+
# An error response
|
|
9
|
+
#
|
|
10
|
+
# @return [SurgeAPI::Models::Error]
|
|
11
|
+
required :error, -> { SurgeAPI::Error }
|
|
12
|
+
|
|
13
|
+
# @!method initialize(error:)
|
|
14
|
+
# An error response
|
|
15
|
+
#
|
|
16
|
+
# @param error [SurgeAPI::Models::Error] An error response
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -44,11 +44,19 @@ module SurgeAPI
|
|
|
44
44
|
# @return [String]
|
|
45
45
|
required :id, String
|
|
46
46
|
|
|
47
|
+
# @!attribute message
|
|
48
|
+
# A Message is a communication sent to a Contact.
|
|
49
|
+
#
|
|
50
|
+
# @return [SurgeAPI::Models::Message, nil]
|
|
51
|
+
required :message, -> { SurgeAPI::Message }, nil?: true
|
|
52
|
+
|
|
47
53
|
# @!attribute message_id
|
|
48
|
-
#
|
|
54
|
+
# @deprecated Use `message.id` instead.
|
|
49
55
|
#
|
|
50
|
-
#
|
|
51
|
-
|
|
56
|
+
# Deprecated. The unique identifier for the message that contained the link.
|
|
57
|
+
#
|
|
58
|
+
# @return [String, nil]
|
|
59
|
+
required :message_id, String, nil?: true
|
|
52
60
|
|
|
53
61
|
# @!attribute url
|
|
54
62
|
# The original URL that was shortened
|
|
@@ -56,12 +64,14 @@ module SurgeAPI
|
|
|
56
64
|
# @return [String]
|
|
57
65
|
required :url, String
|
|
58
66
|
|
|
59
|
-
# @!method initialize(id:, message_id:, url:)
|
|
67
|
+
# @!method initialize(id:, message:, message_id:, url:)
|
|
60
68
|
# The data associated with the event
|
|
61
69
|
#
|
|
62
70
|
# @param id [String] The unique identifier for the link
|
|
63
71
|
#
|
|
64
|
-
# @param
|
|
72
|
+
# @param message [SurgeAPI::Models::Message, nil] A Message is a communication sent to a Contact.
|
|
73
|
+
#
|
|
74
|
+
# @param message_id [String, nil] Deprecated. The unique identifier for the message that contained the link.
|
|
65
75
|
#
|
|
66
76
|
# @param url [String] The original URL that was shortened
|
|
67
77
|
end
|
|
@@ -139,6 +139,12 @@ module SurgeAPI
|
|
|
139
139
|
# @return [String]
|
|
140
140
|
required :id, String
|
|
141
141
|
|
|
142
|
+
# @!attribute name
|
|
143
|
+
# A human-readable name for the phone number
|
|
144
|
+
#
|
|
145
|
+
# @return [String, nil]
|
|
146
|
+
required :name, String, nil?: true
|
|
147
|
+
|
|
142
148
|
# @!attribute number
|
|
143
149
|
# The canonical format of the phone number.
|
|
144
150
|
#
|
|
@@ -151,11 +157,13 @@ module SurgeAPI
|
|
|
151
157
|
# @return [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type]
|
|
152
158
|
required :type, enum: -> { SurgeAPI::Message::Conversation::PhoneNumber::Type }
|
|
153
159
|
|
|
154
|
-
# @!method initialize(id:, number:, type:)
|
|
160
|
+
# @!method initialize(id:, name:, number:, type:)
|
|
155
161
|
# This is the phone number tied to the Surge account.
|
|
156
162
|
#
|
|
157
163
|
# @param id [String] Unique identifier for the phone number
|
|
158
164
|
#
|
|
165
|
+
# @param name [String, nil] A human-readable name for the phone number
|
|
166
|
+
#
|
|
159
167
|
# @param number [String] The canonical format of the phone number.
|
|
160
168
|
#
|
|
161
169
|
# @param type [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
|
|
@@ -16,6 +16,12 @@ module SurgeAPI
|
|
|
16
16
|
# @return [String, nil]
|
|
17
17
|
required :campaign_id, String, nil?: true
|
|
18
18
|
|
|
19
|
+
# @!attribute name
|
|
20
|
+
# A human-readable name for the phone number
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
required :name, String, nil?: true
|
|
24
|
+
|
|
19
25
|
# @!attribute number
|
|
20
26
|
# The phone number in E.164 format
|
|
21
27
|
#
|
|
@@ -28,13 +34,15 @@ module SurgeAPI
|
|
|
28
34
|
# @return [Symbol, SurgeAPI::Models::PhoneNumber::Type]
|
|
29
35
|
required :type, enum: -> { SurgeAPI::PhoneNumber::Type }
|
|
30
36
|
|
|
31
|
-
# @!method initialize(id:, campaign_id:, number:, type:)
|
|
37
|
+
# @!method initialize(id:, campaign_id:, name:, number:, type:)
|
|
32
38
|
# A phone number that can be used to send and receive messages and calls
|
|
33
39
|
#
|
|
34
40
|
# @param id [String] Unique identifier for the phone number
|
|
35
41
|
#
|
|
36
42
|
# @param campaign_id [String, nil] The unique identifier of the campaign this phone number is attached to, if any
|
|
37
43
|
#
|
|
44
|
+
# @param name [String, nil] A human-readable name for the phone number
|
|
45
|
+
#
|
|
38
46
|
# @param number [String] The phone number in E.164 format
|
|
39
47
|
#
|
|
40
48
|
# @param type [Symbol, SurgeAPI::Models::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
|
|
@@ -54,6 +54,12 @@ module SurgeAPI
|
|
|
54
54
|
# @return [String]
|
|
55
55
|
required :campaign_id, String
|
|
56
56
|
|
|
57
|
+
# @!attribute name
|
|
58
|
+
# A human-readable name for the phone number
|
|
59
|
+
#
|
|
60
|
+
# @return [String, nil]
|
|
61
|
+
required :name, String, nil?: true
|
|
62
|
+
|
|
57
63
|
# @!attribute number
|
|
58
64
|
# The phone number in E.164 format
|
|
59
65
|
#
|
|
@@ -66,13 +72,15 @@ module SurgeAPI
|
|
|
66
72
|
# @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type]
|
|
67
73
|
required :type, enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type }
|
|
68
74
|
|
|
69
|
-
# @!method initialize(id:, campaign_id:, number:, type:)
|
|
75
|
+
# @!method initialize(id:, campaign_id:, name:, number:, type:)
|
|
70
76
|
# The data associated with the event
|
|
71
77
|
#
|
|
72
78
|
# @param id [String] The unique identifier for the phone number
|
|
73
79
|
#
|
|
74
80
|
# @param campaign_id [String] The unique identifier of the campaign this phone number is attached to
|
|
75
81
|
#
|
|
82
|
+
# @param name [String, nil] A human-readable name for the phone number
|
|
83
|
+
#
|
|
76
84
|
# @param number [String] The phone number in E.164 format
|
|
77
85
|
#
|
|
78
86
|
# @param type [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type] Whether the phone number is local, toll-free, or short code
|
|
@@ -28,6 +28,13 @@ module SurgeAPI
|
|
|
28
28
|
# @return [Float, nil]
|
|
29
29
|
optional :longitude, Float
|
|
30
30
|
|
|
31
|
+
# @!attribute name
|
|
32
|
+
# A human-readable name for the phone number. If not provided, defaults to the
|
|
33
|
+
# formatted phone number.
|
|
34
|
+
#
|
|
35
|
+
# @return [String, nil]
|
|
36
|
+
optional :name, String
|
|
37
|
+
|
|
31
38
|
# @!attribute type
|
|
32
39
|
# Whether the phone number is local or toll-free. Can be omitted if area_code or
|
|
33
40
|
# latitude/longitude are provided.
|
|
@@ -35,7 +42,7 @@ module SurgeAPI
|
|
|
35
42
|
# @return [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type, nil]
|
|
36
43
|
optional :type, enum: -> { SurgeAPI::PhoneNumberPurchaseParams::Type }
|
|
37
44
|
|
|
38
|
-
# @!method initialize(area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {})
|
|
45
|
+
# @!method initialize(area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
|
|
39
46
|
# Some parameter documentations has been truncated, see
|
|
40
47
|
# {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
|
|
41
48
|
#
|
|
@@ -45,6 +52,8 @@ module SurgeAPI
|
|
|
45
52
|
#
|
|
46
53
|
# @param longitude [Float] Longitude to search for nearby phone numbers. Must be used with latitude. If pro
|
|
47
54
|
#
|
|
55
|
+
# @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
|
|
56
|
+
#
|
|
48
57
|
# @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
|
|
49
58
|
#
|
|
50
59
|
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
|
data/lib/surge_api/models.rb
CHANGED
|
@@ -45,12 +45,16 @@ module SurgeAPI
|
|
|
45
45
|
|
|
46
46
|
AccountCreateParams = SurgeAPI::Models::AccountCreateParams
|
|
47
47
|
|
|
48
|
+
AccountListParams = SurgeAPI::Models::AccountListParams
|
|
49
|
+
|
|
48
50
|
AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
|
|
49
51
|
|
|
50
52
|
AccountStatus = SurgeAPI::Models::AccountStatus
|
|
51
53
|
|
|
52
54
|
AccountUpdateParams = SurgeAPI::Models::AccountUpdateParams
|
|
53
55
|
|
|
56
|
+
AttachmentGetFileParams = SurgeAPI::Models::AttachmentGetFileParams
|
|
57
|
+
|
|
54
58
|
AudienceAddContactParams = SurgeAPI::Models::AudienceAddContactParams
|
|
55
59
|
|
|
56
60
|
AudienceCreateParams = SurgeAPI::Models::AudienceCreateParams
|
|
@@ -67,6 +67,35 @@ module SurgeAPI
|
|
|
67
67
|
)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
# Some parameter documentations has been truncated, see
|
|
71
|
+
# {SurgeAPI::Models::AccountListParams} for more details.
|
|
72
|
+
#
|
|
73
|
+
# List all accounts for the calling platform with cursor-based pagination.
|
|
74
|
+
#
|
|
75
|
+
# @overload list(after: nil, before: nil, request_options: {})
|
|
76
|
+
#
|
|
77
|
+
# @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
|
|
78
|
+
#
|
|
79
|
+
# @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
|
|
80
|
+
#
|
|
81
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
82
|
+
#
|
|
83
|
+
# @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::Account>]
|
|
84
|
+
#
|
|
85
|
+
# @see SurgeAPI::Models::AccountListParams
|
|
86
|
+
def list(params = {})
|
|
87
|
+
parsed, options = SurgeAPI::AccountListParams.dump_request(params)
|
|
88
|
+
query = SurgeAPI::Internal::Util.encode_query_params(parsed)
|
|
89
|
+
@client.request(
|
|
90
|
+
method: :get,
|
|
91
|
+
path: "accounts",
|
|
92
|
+
query: query,
|
|
93
|
+
page: SurgeAPI::Internal::Cursor,
|
|
94
|
+
model: SurgeAPI::Account,
|
|
95
|
+
options: options
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
70
99
|
# Archives an account and releases all associated resources.
|
|
71
100
|
#
|
|
72
101
|
# **Warning**: This action will:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Resources
|
|
5
|
+
class Attachments
|
|
6
|
+
# Redirects to a signed URL where the attachment file can be downloaded. URL is
|
|
7
|
+
# short-lived, so redirect should be followed immediately.
|
|
8
|
+
#
|
|
9
|
+
# @overload get_file(attachment_id, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param attachment_id [String] The ID of the attachment.
|
|
12
|
+
#
|
|
13
|
+
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
14
|
+
#
|
|
15
|
+
# @return [SurgeAPI::Models::AttachmentGetFileResponse]
|
|
16
|
+
#
|
|
17
|
+
# @see SurgeAPI::Models::AttachmentGetFileParams
|
|
18
|
+
def get_file(attachment_id, params = {})
|
|
19
|
+
@client.request(
|
|
20
|
+
method: :get,
|
|
21
|
+
path: ["attachments/%1$s/file", attachment_id],
|
|
22
|
+
model: SurgeAPI::Models::AttachmentGetFileResponse,
|
|
23
|
+
options: params[:request_options]
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @api private
|
|
28
|
+
#
|
|
29
|
+
# @param client [SurgeAPI::Client]
|
|
30
|
+
def initialize(client:)
|
|
31
|
+
@client = client
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -40,7 +40,7 @@ module SurgeAPI
|
|
|
40
40
|
# Purchase a new phone number for the account. You can specify search criteria or
|
|
41
41
|
# let the system select a random number.
|
|
42
42
|
#
|
|
43
|
-
# @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {})
|
|
43
|
+
# @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
|
|
44
44
|
#
|
|
45
45
|
# @param account_id [String] The account for which the phone number should be created.
|
|
46
46
|
#
|
|
@@ -50,6 +50,8 @@ module SurgeAPI
|
|
|
50
50
|
#
|
|
51
51
|
# @param longitude [Float] Longitude to search for nearby phone numbers. Must be used with latitude. If pro
|
|
52
52
|
#
|
|
53
|
+
# @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
|
|
54
|
+
#
|
|
53
55
|
# @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
|
|
54
56
|
#
|
|
55
57
|
# @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
|
data/lib/surge_api/version.rb
CHANGED
data/lib/surge_api.rb
CHANGED
|
@@ -58,9 +58,12 @@ require_relative "surge_api/models/message_params"
|
|
|
58
58
|
require_relative "surge_api/models/account"
|
|
59
59
|
require_relative "surge_api/models/account_archive_params"
|
|
60
60
|
require_relative "surge_api/models/account_create_params"
|
|
61
|
+
require_relative "surge_api/models/account_list_params"
|
|
61
62
|
require_relative "surge_api/models/account_retrieve_status_params"
|
|
62
63
|
require_relative "surge_api/models/account_status"
|
|
63
64
|
require_relative "surge_api/models/account_update_params"
|
|
65
|
+
require_relative "surge_api/models/attachment_get_file_params"
|
|
66
|
+
require_relative "surge_api/models/attachment_get_file_response"
|
|
64
67
|
require_relative "surge_api/models/audience_add_contact_params"
|
|
65
68
|
require_relative "surge_api/models/audience_create_params"
|
|
66
69
|
require_relative "surge_api/models/audience_create_response"
|
|
@@ -123,6 +126,7 @@ require_relative "surge_api/models/voicemail_received_webhook_event"
|
|
|
123
126
|
require_relative "surge_api/models/webhook_unwrap_params"
|
|
124
127
|
require_relative "surge_api/models"
|
|
125
128
|
require_relative "surge_api/resources/accounts"
|
|
129
|
+
require_relative "surge_api/resources/attachments"
|
|
126
130
|
require_relative "surge_api/resources/audiences"
|
|
127
131
|
require_relative "surge_api/resources/blasts"
|
|
128
132
|
require_relative "surge_api/resources/campaigns"
|
data/rbi/surge_api/client.rbi
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class AccountListParams < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
extend SurgeAPI::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include SurgeAPI::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(SurgeAPI::AccountListParams, SurgeAPI::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Cursor for forward pagination. Use the next_cursor from a previous response.
|
|
15
|
+
sig { returns(T.nilable(String)) }
|
|
16
|
+
attr_reader :after
|
|
17
|
+
|
|
18
|
+
sig { params(after: String).void }
|
|
19
|
+
attr_writer :after
|
|
20
|
+
|
|
21
|
+
# Cursor for backward pagination. Use the previous_cursor from a previous
|
|
22
|
+
# response.
|
|
23
|
+
sig { returns(T.nilable(String)) }
|
|
24
|
+
attr_reader :before
|
|
25
|
+
|
|
26
|
+
sig { params(before: String).void }
|
|
27
|
+
attr_writer :before
|
|
28
|
+
|
|
29
|
+
sig do
|
|
30
|
+
params(
|
|
31
|
+
after: String,
|
|
32
|
+
before: String,
|
|
33
|
+
request_options: SurgeAPI::RequestOptions::OrHash
|
|
34
|
+
).returns(T.attached_class)
|
|
35
|
+
end
|
|
36
|
+
def self.new(
|
|
37
|
+
# Cursor for forward pagination. Use the next_cursor from a previous response.
|
|
38
|
+
after: nil,
|
|
39
|
+
# Cursor for backward pagination. Use the previous_cursor from a previous
|
|
40
|
+
# response.
|
|
41
|
+
before: nil,
|
|
42
|
+
request_options: {}
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
sig do
|
|
47
|
+
override.returns(
|
|
48
|
+
{
|
|
49
|
+
after: String,
|
|
50
|
+
before: String,
|
|
51
|
+
request_options: SurgeAPI::RequestOptions
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
def to_hash
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class AttachmentGetFileParams < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
extend SurgeAPI::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include SurgeAPI::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(SurgeAPI::AttachmentGetFileParams, SurgeAPI::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig do
|
|
15
|
+
params(request_options: SurgeAPI::RequestOptions::OrHash).returns(
|
|
16
|
+
T.attached_class
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
def self.new(request_options: {})
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig { override.returns({ request_options: SurgeAPI::RequestOptions }) }
|
|
23
|
+
def to_hash
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module SurgeAPI
|
|
4
|
+
module Models
|
|
5
|
+
class AttachmentGetFileResponse < SurgeAPI::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
SurgeAPI::Models::AttachmentGetFileResponse,
|
|
10
|
+
SurgeAPI::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# An error response
|
|
15
|
+
sig { returns(SurgeAPI::Error) }
|
|
16
|
+
attr_reader :error
|
|
17
|
+
|
|
18
|
+
sig { params(error: SurgeAPI::Error::OrHash).void }
|
|
19
|
+
attr_writer :error
|
|
20
|
+
|
|
21
|
+
# An error response
|
|
22
|
+
sig { params(error: SurgeAPI::Error::OrHash).returns(T.attached_class) }
|
|
23
|
+
def self.new(
|
|
24
|
+
# An error response
|
|
25
|
+
error:
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
sig { override.returns({ error: SurgeAPI::Error }) }
|
|
30
|
+
def to_hash
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -75,8 +75,15 @@ module SurgeAPI
|
|
|
75
75
|
sig { returns(String) }
|
|
76
76
|
attr_accessor :id
|
|
77
77
|
|
|
78
|
-
#
|
|
79
|
-
sig { returns(
|
|
78
|
+
# A Message is a communication sent to a Contact.
|
|
79
|
+
sig { returns(T.nilable(SurgeAPI::Message)) }
|
|
80
|
+
attr_reader :message
|
|
81
|
+
|
|
82
|
+
sig { params(message: T.nilable(SurgeAPI::Message::OrHash)).void }
|
|
83
|
+
attr_writer :message
|
|
84
|
+
|
|
85
|
+
# Deprecated. The unique identifier for the message that contained the link.
|
|
86
|
+
sig { returns(T.nilable(String)) }
|
|
80
87
|
attr_accessor :message_id
|
|
81
88
|
|
|
82
89
|
# The original URL that was shortened
|
|
@@ -85,14 +92,19 @@ module SurgeAPI
|
|
|
85
92
|
|
|
86
93
|
# The data associated with the event
|
|
87
94
|
sig do
|
|
88
|
-
params(
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
params(
|
|
96
|
+
id: String,
|
|
97
|
+
message: T.nilable(SurgeAPI::Message::OrHash),
|
|
98
|
+
message_id: T.nilable(String),
|
|
99
|
+
url: String
|
|
100
|
+
).returns(T.attached_class)
|
|
91
101
|
end
|
|
92
102
|
def self.new(
|
|
93
103
|
# The unique identifier for the link
|
|
94
104
|
id:,
|
|
95
|
-
#
|
|
105
|
+
# A Message is a communication sent to a Contact.
|
|
106
|
+
message:,
|
|
107
|
+
# Deprecated. The unique identifier for the message that contained the link.
|
|
96
108
|
message_id:,
|
|
97
109
|
# The original URL that was shortened
|
|
98
110
|
url:
|
|
@@ -100,7 +112,14 @@ module SurgeAPI
|
|
|
100
112
|
end
|
|
101
113
|
|
|
102
114
|
sig do
|
|
103
|
-
override.returns(
|
|
115
|
+
override.returns(
|
|
116
|
+
{
|
|
117
|
+
id: String,
|
|
118
|
+
message: T.nilable(SurgeAPI::Message),
|
|
119
|
+
message_id: T.nilable(String),
|
|
120
|
+
url: String
|
|
121
|
+
}
|
|
122
|
+
)
|
|
104
123
|
end
|
|
105
124
|
def to_hash
|
|
106
125
|
end
|