surge_api 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cdf5f24e69c710419d1609ebc934daaafd1be183603d3f364e6a3d4085fa9b9
4
- data.tar.gz: 65ecd730b0df9e65ab06bd73a272bbff75e7f3b17c5136173ca26d48e92364bb
3
+ metadata.gz: da7c01aaa992d5a9324e6a320821c240261535e5c85ef840624e00e82ff3a722
4
+ data.tar.gz: 1219ffe72345fb81de26f7f7be3c6a05d11d790de928bb8e3821c59ca837ad86
5
5
  SHA512:
6
- metadata.gz: 40416443213907937c15359db9fd573680ec1c0d6038a727304b632125d1331e765d980e4617afe0d80b98db12a1d7405bb3cd84d9b9be2a416ccda6ec9f7857
7
- data.tar.gz: 20d73f3c32f237a86513ed84416b0ac144ff35f7ccd722bf57e79aa3a4fe44ee2525f91d523f67cd8b1b4819dfe3c3a9fe4b0f2c17cc56b280e2fe9f681d5386
6
+ metadata.gz: 44b3bd94a28e639bdae0131f72893b3e0fbbccc4ef11eaef833cd4214d167879bbbdb36ab964ce991c07d8cf844b2a59225c1a2e4afd231ac1045472e6c5f2b0
7
+ data.tar.gz: aeba66370a29d5bc640f998625e6bde7e3a040f9579a24253442d434d9b671fa1f46d42c84afb07913958d696836e89a226ab2a989585ec90fc156150e45bbb2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 (2026-01-10)
4
+
5
+ Full Changelog: [v0.3.0...v0.4.0](https://github.com/surgeapi/ruby-sdk/compare/v0.3.0...v0.4.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add archive account endpoint ([b56a3ac](https://github.com/surgeapi/ruby-sdk/commit/b56a3ac799df5e73cfea5416bb6af32cdeaac64d))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * issue where json.parse errors when receiving HTTP 204 with nobody ([a54e6ff](https://github.com/surgeapi/ruby-sdk/commit/a54e6ff310c9d5d146161a33971eb0dc541c9774))
15
+
16
+
17
+ ### Chores
18
+
19
+ * **internal:** codegen related update ([6dda266](https://github.com/surgeapi/ruby-sdk/commit/6dda2669de3018139c1ff15a9c23edda513fd899))
20
+ * move `cgi` into dependencies for ruby 4 ([03ce06b](https://github.com/surgeapi/ruby-sdk/commit/03ce06b6a4f4d7f510dee6ece06e89ff93ede89d))
21
+
3
22
  ## 0.3.0 (2025-12-17)
4
23
 
5
24
  Full Changelog: [v0.2.1...v0.3.0](https://github.com/surgeapi/ruby-sdk/compare/v0.2.1...v0.3.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.3.0"
20
+ gem "surge_api", "~> 0.4.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -657,7 +657,8 @@ module SurgeAPI
657
657
  def decode_content(headers, stream:, suppress_error: false)
658
658
  case (content_type = headers["content-type"])
659
659
  in SurgeAPI::Internal::Util::JSON_CONTENT
660
- json = stream.to_a.join
660
+ return nil if (json = stream.to_a.join).empty?
661
+
661
662
  begin
662
663
  JSON.parse(json, symbolize_names: true)
663
664
  rescue JSON::ParserError => e
@@ -667,7 +668,11 @@ module SurgeAPI
667
668
  in SurgeAPI::Internal::Util::JSONL_CONTENT
668
669
  lines = decode_lines(stream)
669
670
  chain_fused(lines) do |y|
670
- lines.each { y << JSON.parse(_1, symbolize_names: true) }
671
+ lines.each do
672
+ next if _1.empty?
673
+
674
+ y << JSON.parse(_1, symbolize_names: true)
675
+ end
671
676
  end
672
677
  in %r{^text/event-stream}
673
678
  lines = decode_lines(stream)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Accounts#archive
6
+ class AccountArchiveParams < 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
@@ -41,6 +41,8 @@ module SurgeAPI
41
41
 
42
42
  Account = SurgeAPI::Models::Account
43
43
 
44
+ AccountArchiveParams = SurgeAPI::Models::AccountArchiveParams
45
+
44
46
  AccountCreateParams = SurgeAPI::Models::AccountCreateParams
45
47
 
46
48
  AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
@@ -67,6 +67,35 @@ module SurgeAPI
67
67
  )
68
68
  end
69
69
 
70
+ # Archives an account and releases all associated resources.
71
+ #
72
+ # **Warning**: This action will:
73
+ #
74
+ # - Release all phone numbers associated with the account
75
+ # - Deactivate all campaigns
76
+ # - Make the account unusable for sending messages
77
+ #
78
+ # This operation is irreversible. If you need to send SMS in the future, you will
79
+ # need to re-register new phone numbers and campaigns.
80
+ #
81
+ # @overload archive(id, request_options: {})
82
+ #
83
+ # @param id [String] The ID of the account to archive.
84
+ #
85
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
86
+ #
87
+ # @return [SurgeAPI::Models::Account]
88
+ #
89
+ # @see SurgeAPI::Models::AccountArchiveParams
90
+ def archive(id, params = {})
91
+ @client.request(
92
+ method: :delete,
93
+ path: ["accounts/%1$s", id],
94
+ model: SurgeAPI::Account,
95
+ options: params[:request_options]
96
+ )
97
+ end
98
+
70
99
  # Check an account's status and capabilities
71
100
  #
72
101
  # @overload retrieve_status(account_id, capabilities: nil, request_options: {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -55,6 +55,7 @@ require_relative "surge_api/client"
55
55
  require_relative "surge_api/models/campaign_params"
56
56
  require_relative "surge_api/models/message_params"
57
57
  require_relative "surge_api/models/account"
58
+ require_relative "surge_api/models/account_archive_params"
58
59
  require_relative "surge_api/models/account_create_params"
59
60
  require_relative "surge_api/models/account_retrieve_status_params"
60
61
  require_relative "surge_api/models/account_status"
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class AccountArchiveParams < 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::AccountArchiveParams, 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
@@ -3,6 +3,8 @@
3
3
  module SurgeAPI
4
4
  Account = SurgeAPI::Models::Account
5
5
 
6
+ AccountArchiveParams = SurgeAPI::Models::AccountArchiveParams
7
+
6
8
  AccountCreateParams = SurgeAPI::Models::AccountCreateParams
7
9
 
8
10
  AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
@@ -65,6 +65,29 @@ module SurgeAPI
65
65
  )
66
66
  end
67
67
 
68
+ # Archives an account and releases all associated resources.
69
+ #
70
+ # **Warning**: This action will:
71
+ #
72
+ # - Release all phone numbers associated with the account
73
+ # - Deactivate all campaigns
74
+ # - Make the account unusable for sending messages
75
+ #
76
+ # This operation is irreversible. If you need to send SMS in the future, you will
77
+ # need to re-register new phone numbers and campaigns.
78
+ sig do
79
+ params(
80
+ id: String,
81
+ request_options: SurgeAPI::RequestOptions::OrHash
82
+ ).returns(SurgeAPI::Account)
83
+ end
84
+ def archive(
85
+ # The ID of the account to archive.
86
+ id,
87
+ request_options: {}
88
+ )
89
+ end
90
+
68
91
  # Check an account's status and capabilities
69
92
  sig do
70
93
  params(
@@ -0,0 +1,15 @@
1
+ module SurgeAPI
2
+ module Models
3
+ type account_archive_params =
4
+ { } & SurgeAPI::Internal::Type::request_parameters
5
+
6
+ class AccountArchiveParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ def initialize: (?request_options: SurgeAPI::request_opts) -> void
11
+
12
+ def to_hash: -> { request_options: SurgeAPI::RequestOptions }
13
+ end
14
+ end
15
+ end
@@ -1,6 +1,8 @@
1
1
  module SurgeAPI
2
2
  class Account = SurgeAPI::Models::Account
3
3
 
4
+ class AccountArchiveParams = SurgeAPI::Models::AccountArchiveParams
5
+
4
6
  class AccountCreateParams = SurgeAPI::Models::AccountCreateParams
5
7
 
6
8
  class AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
@@ -18,6 +18,11 @@ module SurgeAPI
18
18
  ?request_options: SurgeAPI::request_opts
19
19
  ) -> SurgeAPI::Account
20
20
 
21
+ def archive: (
22
+ String id,
23
+ ?request_options: SurgeAPI::request_opts
24
+ ) -> SurgeAPI::Account
25
+
21
26
  def retrieve_status: (
22
27
  String account_id,
23
28
  ?capabilities: ::Array[SurgeAPI::Models::AccountRetrieveStatusParams::capability],
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-17 00:00:00.000000000 Z
11
+ date: 2026-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cgi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: connection_pool
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +70,7 @@ files:
56
70
  - lib/surge_api/internal/util.rb
57
71
  - lib/surge_api/models.rb
58
72
  - lib/surge_api/models/account.rb
73
+ - lib/surge_api/models/account_archive_params.rb
59
74
  - lib/surge_api/models/account_create_params.rb
60
75
  - lib/surge_api/models/account_retrieve_status_params.rb
61
76
  - lib/surge_api/models/account_status.rb
@@ -130,6 +145,7 @@ files:
130
145
  - rbi/surge_api/internal/util.rbi
131
146
  - rbi/surge_api/models.rbi
132
147
  - rbi/surge_api/models/account.rbi
148
+ - rbi/surge_api/models/account_archive_params.rbi
133
149
  - rbi/surge_api/models/account_create_params.rbi
134
150
  - rbi/surge_api/models/account_retrieve_status_params.rbi
135
151
  - rbi/surge_api/models/account_status.rbi
@@ -203,6 +219,7 @@ files:
203
219
  - sig/surge_api/internal/util.rbs
204
220
  - sig/surge_api/models.rbs
205
221
  - sig/surge_api/models/account.rbs
222
+ - sig/surge_api/models/account_archive_params.rbs
206
223
  - sig/surge_api/models/account_create_params.rbs
207
224
  - sig/surge_api/models/account_retrieve_status_params.rbs
208
225
  - sig/surge_api/models/account_status.rbs