surge_api 0.19.0 → 0.20.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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +7 -7
  4. data/lib/surge_api/models/phone_number.rb +55 -4
  5. data/lib/surge_api/models/phone_number_attached_to_campaign_webhook_event.rb +60 -3
  6. data/lib/surge_api/models/phone_number_list_available_numbers_params.rb +88 -0
  7. data/lib/surge_api/models/phone_number_list_available_numbers_response.rb +61 -0
  8. data/lib/surge_api/models/phone_number_purchase_params.rb +10 -1
  9. data/lib/surge_api/models/phone_number_retrieve_params.rb +22 -0
  10. data/lib/surge_api/models.rb +4 -0
  11. data/lib/surge_api/resources/phone_numbers.rb +66 -3
  12. data/lib/surge_api/version.rb +1 -1
  13. data/lib/surge_api.rb +3 -0
  14. data/rbi/surge_api/models/phone_number.rbi +108 -2
  15. data/rbi/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbi +129 -2
  16. data/rbi/surge_api/models/phone_number_list_available_numbers_params.rbi +183 -0
  17. data/rbi/surge_api/models/phone_number_list_available_numbers_response.rbi +139 -0
  18. data/rbi/surge_api/models/phone_number_purchase_params.rbi +13 -0
  19. data/rbi/surge_api/models/phone_number_retrieve_params.rbi +43 -0
  20. data/rbi/surge_api/models.rbi +5 -0
  21. data/rbi/surge_api/resources/phone_numbers.rbi +59 -2
  22. data/sig/surge_api/models/phone_number.rbs +41 -0
  23. data/sig/surge_api/models/phone_number_attached_to_campaign_webhook_event.rbs +41 -0
  24. data/sig/surge_api/models/phone_number_list_available_numbers_params.rbs +83 -0
  25. data/sig/surge_api/models/phone_number_list_available_numbers_response.rbs +52 -0
  26. data/sig/surge_api/models/phone_number_purchase_params.rbs +7 -0
  27. data/sig/surge_api/models/phone_number_retrieve_params.rbs +20 -0
  28. data/sig/surge_api/models.rbs +4 -0
  29. data/sig/surge_api/resources/phone_numbers.rbs +16 -0
  30. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e4a0bcd739442f5fcd6b9ca030978f0da11f700af746fac3675be506613fea9
4
- data.tar.gz: c87b52cbe1bc4ebf481ba325bf303df5789b149eb4b8873d9a4d5f526416db69
3
+ metadata.gz: 2c7a5d469cecb86e54c11530c7f97365e055e1990f7689c060a574cb7a7db892
4
+ data.tar.gz: 9b8688276c1c6de57242aa3ea37846db616c6dd9fb9d0cb89928d17ff9faa816
5
5
  SHA512:
6
- metadata.gz: c8c6a4eae6015cdcc0e950d1f629194ea88d7df136c469c5859c49a5c65a47e05cecca62d6ac9c6f42f2d1f35cd9a067d6ae9bb9ed2617f95b49786334597338
7
- data.tar.gz: 4f82ac61c2cf4a14780d9796fbf67ad90b503ff14ff429eb42b8ac8a652cd6b06ff7ec8cffe244e9c3591f314e9bbff7b9e1c3f142cfff81d045b82bd3f7393b
6
+ metadata.gz: 7ac007b01940925b65714cd5f48c76ba82ff502450e316a971ba89bc578bd18deef2135ebf95c2a6c4f617688ad77f29d92ce149ab85ca57acf25a80de6f26ed
7
+ data.tar.gz: 95caca6f433199cdea6a8f1ef3ace3d87d1a431e8bb3f12e2d99b788951d9bed9dfd934e9463b21c4d8d2da0c1fdc382db8cbb2abadc801ef9a13ad0d4d50efa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.20.0 (2026-07-14)
4
+
5
+ Full Changelog: [v0.19.0...v0.20.0](https://github.com/surgeapi/ruby-sdk/compare/v0.19.0...v0.20.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add campaign to phone numbers ([037405d](https://github.com/surgeapi/ruby-sdk/commit/037405d891eaa84c91ede8b963d91a1910b1379e))
10
+ * **api:** add list available phone numbers endpoint ([d54f29f](https://github.com/surgeapi/ruby-sdk/commit/d54f29f90abc8cdc9d42577775bdbe727898d19f))
11
+ * **api:** add phone number field to purchase endpoint ([d9eafc6](https://github.com/surgeapi/ruby-sdk/commit/d9eafc611da5fb60b149eda5a676d3ca276b3780))
12
+ * **api:** add retrieve phone number endpoint ([2f15b40](https://github.com/surgeapi/ruby-sdk/commit/2f15b4093fd0ed099e41c2292ca9a433458eec19))
13
+
3
14
  ## 0.19.0 (2026-07-06)
4
15
 
5
16
  Full Changelog: [v0.18.0...v0.19.0](https://github.com/surgeapi/ruby-sdk/compare/v0.18.0...v0.19.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.19.0"
20
+ gem "surge_api", "~> 0.20.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -261,23 +261,23 @@ Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::E
261
261
 
262
262
  ```ruby
263
263
  # :local
264
- puts(SurgeAPI::PhoneNumberPurchaseParams::Type::LOCAL)
264
+ puts(SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::LOCAL)
265
265
 
266
- # Revealed type: `T.all(SurgeAPI::PhoneNumberPurchaseParams::Type, Symbol)`
267
- T.reveal_type(SurgeAPI::PhoneNumberPurchaseParams::Type::LOCAL)
266
+ # Revealed type: `T.all(SurgeAPI::PhoneNumberListAvailableNumbersParams::Type, Symbol)`
267
+ T.reveal_type(SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::LOCAL)
268
268
  ```
269
269
 
270
270
  Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
271
271
 
272
272
  ```ruby
273
273
  # Using the enum constants preserves the tagged type information:
274
- surge.phone_numbers.purchase(
275
- type: SurgeAPI::PhoneNumberPurchaseParams::Type::LOCAL,
274
+ surge.phone_numbers.list_available_numbers(
275
+ type: SurgeAPI::PhoneNumberListAvailableNumbersParams::Type::LOCAL,
276
276
  # …
277
277
  )
278
278
 
279
279
  # Literal values are also permissible:
280
- surge.phone_numbers.purchase(
280
+ surge.phone_numbers.list_available_numbers(
281
281
  type: :local,
282
282
  # …
283
283
  )
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SurgeAPI
4
4
  module Models
5
- # @see SurgeAPI::Resources::PhoneNumbers#update
5
+ # @see SurgeAPI::Resources::PhoneNumbers#retrieve
6
6
  class PhoneNumber < SurgeAPI::Internal::Type::BaseModel
7
7
  # @!attribute id
8
8
  # Unique identifier for the phone number
@@ -10,8 +10,17 @@ module SurgeAPI
10
10
  # @return [String]
11
11
  required :id, String
12
12
 
13
+ # @!attribute campaign
14
+ # Campaign attachment details for a domestic local phone number
15
+ #
16
+ # @return [SurgeAPI::Models::PhoneNumber::Campaign, nil]
17
+ required :campaign, -> { SurgeAPI::PhoneNumber::Campaign }, nil?: true
18
+
13
19
  # @!attribute campaign_id
14
- # The unique identifier of the campaign this phone number is attached to, if any
20
+ # @deprecated Use `campaign.id` instead.
21
+ #
22
+ # Deprecated. The unique identifier of the campaign this phone number is attached
23
+ # to, if any
15
24
  #
16
25
  # @return [String, nil]
17
26
  required :campaign_id, String, nil?: true
@@ -34,12 +43,17 @@ module SurgeAPI
34
43
  # @return [Symbol, SurgeAPI::Models::PhoneNumber::Type]
35
44
  required :type, enum: -> { SurgeAPI::PhoneNumber::Type }
36
45
 
37
- # @!method initialize(id:, campaign_id:, name:, number:, type:)
46
+ # @!method initialize(id:, campaign:, campaign_id:, name:, number:, type:)
47
+ # Some parameter documentations has been truncated, see
48
+ # {SurgeAPI::Models::PhoneNumber} for more details.
49
+ #
38
50
  # A phone number that can be used to send and receive messages and calls
39
51
  #
40
52
  # @param id [String] Unique identifier for the phone number
41
53
  #
42
- # @param campaign_id [String, nil] The unique identifier of the campaign this phone number is attached to, if any
54
+ # @param campaign [SurgeAPI::Models::PhoneNumber::Campaign, nil] Campaign attachment details for a domestic local phone number
55
+ #
56
+ # @param campaign_id [String, nil] Deprecated. The unique identifier of the campaign this phone number is attached
43
57
  #
44
58
  # @param name [String, nil] A human-readable name for the phone number
45
59
  #
@@ -47,6 +61,43 @@ module SurgeAPI
47
61
  #
48
62
  # @param type [Symbol, SurgeAPI::Models::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
49
63
 
64
+ # @see SurgeAPI::Models::PhoneNumber#campaign
65
+ class Campaign < SurgeAPI::Internal::Type::BaseModel
66
+ # @!attribute id
67
+ # The unique identifier of the campaign this phone number is attached to
68
+ #
69
+ # @return [String]
70
+ required :id, String
71
+
72
+ # @!attribute attachment_status
73
+ # The current campaign attachment status for this phone number.
74
+ #
75
+ # @return [Symbol, SurgeAPI::Models::PhoneNumber::Campaign::AttachmentStatus]
76
+ required :attachment_status, enum: -> { SurgeAPI::PhoneNumber::Campaign::AttachmentStatus }
77
+
78
+ # @!method initialize(id:, attachment_status:)
79
+ # Campaign attachment details for a domestic local phone number
80
+ #
81
+ # @param id [String] The unique identifier of the campaign this phone number is attached to
82
+ #
83
+ # @param attachment_status [Symbol, SurgeAPI::Models::PhoneNumber::Campaign::AttachmentStatus] The current campaign attachment status for this phone number.
84
+
85
+ # The current campaign attachment status for this phone number.
86
+ #
87
+ # @see SurgeAPI::Models::PhoneNumber::Campaign#attachment_status
88
+ module AttachmentStatus
89
+ extend SurgeAPI::Internal::Type::Enum
90
+
91
+ ATTACHED = :attached
92
+ ATTACHMENT_PENDING = :attachment_pending
93
+ DETACHED = :detached
94
+ DETACHMENT_PENDING = :detachment_pending
95
+
96
+ # @!method self.values
97
+ # @return [Array<Symbol>]
98
+ end
99
+ end
100
+
50
101
  # Whether the phone number is local, toll-free, or short code
51
102
  #
52
103
  # @see SurgeAPI::Models::PhoneNumber#type
@@ -48,8 +48,21 @@ module SurgeAPI
48
48
  # @return [String]
49
49
  required :id, String
50
50
 
51
+ # @!attribute campaign
52
+ # Campaign attachment details for a domestic local phone number
53
+ #
54
+ # @return [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign, nil]
55
+ required :campaign,
56
+ -> {
57
+ SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign
58
+ },
59
+ nil?: true
60
+
51
61
  # @!attribute campaign_id
52
- # The unique identifier of the campaign this phone number is attached to
62
+ # @deprecated Use `campaign.id` instead.
63
+ #
64
+ # Deprecated. The unique identifier of the campaign this phone number is attached
65
+ # to
53
66
  #
54
67
  # @return [String]
55
68
  required :campaign_id, String
@@ -72,12 +85,18 @@ module SurgeAPI
72
85
  # @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type]
73
86
  required :type, enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type }
74
87
 
75
- # @!method initialize(id:, campaign_id:, name:, number:, type:)
88
+ # @!method initialize(id:, campaign:, campaign_id:, name:, number:, type:)
89
+ # Some parameter documentations has been truncated, see
90
+ # {SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data} for more
91
+ # details.
92
+ #
76
93
  # The data associated with the event
77
94
  #
78
95
  # @param id [String] The unique identifier for the phone number
79
96
  #
80
- # @param campaign_id [String] The unique identifier of the campaign this phone number is attached to
97
+ # @param campaign [SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign, nil] Campaign attachment details for a domestic local phone number
98
+ #
99
+ # @param campaign_id [String] Deprecated. The unique identifier of the campaign this phone number is attached
81
100
  #
82
101
  # @param name [String, nil] A human-readable name for the phone number
83
102
  #
@@ -85,6 +104,44 @@ module SurgeAPI
85
104
  #
86
105
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Type] Whether the phone number is local, toll-free, or short code
87
106
 
107
+ # @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data#campaign
108
+ class Campaign < SurgeAPI::Internal::Type::BaseModel
109
+ # @!attribute id
110
+ # The unique identifier of the campaign this phone number is attached to
111
+ #
112
+ # @return [String]
113
+ required :id, String
114
+
115
+ # @!attribute attachment_status
116
+ # The current campaign attachment status for this phone number.
117
+ #
118
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus]
119
+ required :attachment_status,
120
+ enum: -> { SurgeAPI::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus }
121
+
122
+ # @!method initialize(id:, attachment_status:)
123
+ # Campaign attachment details for a domestic local phone number
124
+ #
125
+ # @param id [String] The unique identifier of the campaign this phone number is attached to
126
+ #
127
+ # @param attachment_status [Symbol, SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign::AttachmentStatus] The current campaign attachment status for this phone number.
128
+
129
+ # The current campaign attachment status for this phone number.
130
+ #
131
+ # @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data::Campaign#attachment_status
132
+ module AttachmentStatus
133
+ extend SurgeAPI::Internal::Type::Enum
134
+
135
+ ATTACHED = :attached
136
+ ATTACHMENT_PENDING = :attachment_pending
137
+ DETACHED = :detached
138
+ DETACHMENT_PENDING = :detachment_pending
139
+
140
+ # @!method self.values
141
+ # @return [Array<Symbol>]
142
+ end
143
+ end
144
+
88
145
  # Whether the phone number is local, toll-free, or short code
89
146
  #
90
147
  # @see SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent::Data#type
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::PhoneNumbers#list_available_numbers
6
+ class PhoneNumberListAvailableNumbersParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute account_id
11
+ # The account ID to list available phone numbers for.
12
+ #
13
+ # @return [String]
14
+ required :account_id, String
15
+
16
+ # @!attribute type
17
+ # Whether to search for local or toll-free numbers.
18
+ #
19
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Type]
20
+ required :type, enum: -> { SurgeAPI::PhoneNumberListAvailableNumbersParams::Type }
21
+
22
+ # @!attribute after
23
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
24
+ #
25
+ # @return [String, nil]
26
+ optional :after, String
27
+
28
+ # @!attribute area_code
29
+ # Filter by 3-digit area code.
30
+ #
31
+ # @return [String, nil]
32
+ optional :area_code, String
33
+
34
+ # @!attribute before
35
+ # Cursor for backward pagination. Use the previous_cursor from a previous
36
+ # response.
37
+ #
38
+ # @return [String, nil]
39
+ optional :before, String
40
+
41
+ # @!attribute country
42
+ # ISO country code to search in.
43
+ #
44
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Country, nil]
45
+ optional :country, enum: -> { SurgeAPI::PhoneNumberListAvailableNumbersParams::Country }
46
+
47
+ # @!method initialize(account_id:, type:, after: nil, area_code: nil, before: nil, country: nil, request_options: {})
48
+ # Some parameter documentations has been truncated, see
49
+ # {SurgeAPI::Models::PhoneNumberListAvailableNumbersParams} for more details.
50
+ #
51
+ # @param account_id [String] The account ID to list available phone numbers for.
52
+ #
53
+ # @param type [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Type] Whether to search for local or toll-free numbers.
54
+ #
55
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
56
+ #
57
+ # @param area_code [String] Filter by 3-digit area code.
58
+ #
59
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
60
+ #
61
+ # @param country [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Country] ISO country code to search in.
62
+ #
63
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
64
+
65
+ # Whether to search for local or toll-free numbers.
66
+ module Type
67
+ extend SurgeAPI::Internal::Type::Enum
68
+
69
+ LOCAL = :local
70
+ TOLL_FREE = :toll_free
71
+
72
+ # @!method self.values
73
+ # @return [Array<Symbol>]
74
+ end
75
+
76
+ # ISO country code to search in.
77
+ module Country
78
+ extend SurgeAPI::Internal::Type::Enum
79
+
80
+ US = :US
81
+ CA = :CA
82
+
83
+ # @!method self.values
84
+ # @return [Array<Symbol>]
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::PhoneNumbers#list_available_numbers
6
+ class PhoneNumberListAvailableNumbersResponse < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute country
8
+ # ISO country code for the phone number
9
+ #
10
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Country]
11
+ required :country, enum: -> { SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Country }
12
+
13
+ # @!attribute number
14
+ # The phone number in E.164 format
15
+ #
16
+ # @return [String]
17
+ required :number, String
18
+
19
+ # @!attribute type
20
+ # Whether the phone number is local or toll-free
21
+ #
22
+ # @return [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Type]
23
+ required :type, enum: -> { SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Type }
24
+
25
+ # @!method initialize(country:, number:, type:)
26
+ # A phone number available for purchase from Surge inventory
27
+ #
28
+ # @param country [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Country] ISO country code for the phone number
29
+ #
30
+ # @param number [String] The phone number in E.164 format
31
+ #
32
+ # @param type [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse::Type] Whether the phone number is local or toll-free
33
+
34
+ # ISO country code for the phone number
35
+ #
36
+ # @see SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse#country
37
+ module Country
38
+ extend SurgeAPI::Internal::Type::Enum
39
+
40
+ US = :US
41
+ CA = :CA
42
+
43
+ # @!method self.values
44
+ # @return [Array<Symbol>]
45
+ end
46
+
47
+ # Whether the phone number is local or toll-free
48
+ #
49
+ # @see SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse#type
50
+ module Type
51
+ extend SurgeAPI::Internal::Type::Enum
52
+
53
+ LOCAL = :local
54
+ TOLL_FREE = :toll_free
55
+
56
+ # @!method self.values
57
+ # @return [Array<Symbol>]
58
+ end
59
+ end
60
+ end
61
+ end
@@ -41,6 +41,13 @@ module SurgeAPI
41
41
  # @return [String, nil]
42
42
  optional :name, String
43
43
 
44
+ # @!attribute phone_number
45
+ # The exact phone number to purchase in E.164 format. When provided, all other
46
+ # search parameters are ignored.
47
+ #
48
+ # @return [String, nil]
49
+ optional :phone_number, String
50
+
44
51
  # @!attribute type
45
52
  # Whether the phone number is local or toll-free. Can be omitted if area_code or
46
53
  # latitude/longitude are provided.
@@ -48,7 +55,7 @@ module SurgeAPI
48
55
  # @return [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type, nil]
49
56
  optional :type, enum: -> { SurgeAPI::PhoneNumberPurchaseParams::Type }
50
57
 
51
- # @!method initialize(account_id:, area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
58
+ # @!method initialize(account_id:, area_code: nil, latitude: nil, longitude: nil, name: nil, phone_number: nil, type: nil, request_options: {})
52
59
  # Some parameter documentations has been truncated, see
53
60
  # {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
54
61
  #
@@ -62,6 +69,8 @@ module SurgeAPI
62
69
  #
63
70
  # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
64
71
  #
72
+ # @param phone_number [String] The exact phone number to purchase in E.164 format. When provided, all other sea
73
+ #
65
74
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
66
75
  #
67
76
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::PhoneNumbers#retrieve
6
+ class PhoneNumberRetrieveParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ # The ID of the phone number to retrieve.
12
+ #
13
+ # @return [String]
14
+ required :id, String
15
+
16
+ # @!method initialize(id:, request_options: {})
17
+ # @param id [String] The ID of the phone number to retrieve.
18
+ #
19
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -125,12 +125,16 @@ module SurgeAPI
125
125
 
126
126
  PhoneNumberAttachedToCampaignWebhookEvent = SurgeAPI::Models::PhoneNumberAttachedToCampaignWebhookEvent
127
127
 
128
+ PhoneNumberListAvailableNumbersParams = SurgeAPI::Models::PhoneNumberListAvailableNumbersParams
129
+
128
130
  PhoneNumberListParams = SurgeAPI::Models::PhoneNumberListParams
129
131
 
130
132
  PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
131
133
 
132
134
  PhoneNumberReleaseParams = SurgeAPI::Models::PhoneNumberReleaseParams
133
135
 
136
+ PhoneNumberRetrieveParams = SurgeAPI::Models::PhoneNumberRetrieveParams
137
+
134
138
  PhoneNumberUpdateParams = SurgeAPI::Models::PhoneNumberUpdateParams
135
139
 
136
140
  RecordingCompletedWebhookEvent = SurgeAPI::Models::RecordingCompletedWebhookEvent
@@ -3,6 +3,26 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class PhoneNumbers
6
+ # Retrieves a PhoneNumber object.
7
+ #
8
+ # @overload retrieve(id, request_options: {})
9
+ #
10
+ # @param id [String] The ID of the phone number to retrieve.
11
+ #
12
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [SurgeAPI::Models::PhoneNumber]
15
+ #
16
+ # @see SurgeAPI::Models::PhoneNumberRetrieveParams
17
+ def retrieve(id, params = {})
18
+ @client.request(
19
+ method: :get,
20
+ path: ["phone_numbers/%1$s", id],
21
+ model: SurgeAPI::PhoneNumber,
22
+ options: params[:request_options]
23
+ )
24
+ end
25
+
6
26
  # Updates a phone number's details.
7
27
  #
8
28
  # @overload update(id, campaign_id: nil, name: nil, request_options: {})
@@ -60,13 +80,54 @@ module SurgeAPI
60
80
  )
61
81
  end
62
82
 
83
+ # Some parameter documentations has been truncated, see
84
+ # {SurgeAPI::Models::PhoneNumberListAvailableNumbersParams} for more details.
85
+ #
86
+ # Browse purchasable phone numbers from Surge inventory before buying.
87
+ #
88
+ # Pagination cursors are always null for now.
89
+ #
90
+ # @overload list_available_numbers(account_id, type:, after: nil, area_code: nil, before: nil, country: nil, request_options: {})
91
+ #
92
+ # @param account_id [String] The account ID to list available phone numbers for.
93
+ #
94
+ # @param type [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Type] Whether to search for local or toll-free numbers.
95
+ #
96
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
97
+ #
98
+ # @param area_code [String] Filter by 3-digit area code.
99
+ #
100
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
101
+ #
102
+ # @param country [Symbol, SurgeAPI::Models::PhoneNumberListAvailableNumbersParams::Country] ISO country code to search in.
103
+ #
104
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
105
+ #
106
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse>]
107
+ #
108
+ # @see SurgeAPI::Models::PhoneNumberListAvailableNumbersParams
109
+ def list_available_numbers(account_id, params)
110
+ parsed, options = SurgeAPI::PhoneNumberListAvailableNumbersParams.dump_request(params)
111
+ query = SurgeAPI::Internal::Util.encode_query_params(parsed)
112
+ @client.request(
113
+ method: :get,
114
+ path: ["accounts/%1$s/available_phone_numbers", account_id],
115
+ query: query,
116
+ page: SurgeAPI::Internal::Cursor,
117
+ model: SurgeAPI::Models::PhoneNumberListAvailableNumbersResponse,
118
+ options: options
119
+ )
120
+ end
121
+
63
122
  # Some parameter documentations has been truncated, see
64
123
  # {SurgeAPI::Models::PhoneNumberPurchaseParams} for more details.
65
124
  #
66
- # Purchase a new phone number for the account. You can specify search criteria or
67
- # let the system select a random number.
125
+ # Purchase a new phone number for the account. You can specify an exact phone
126
+ # number, search criteria, or let the system select a random number.
68
127
  #
69
- # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, type: nil, request_options: {})
128
+ # When `phone_number` is provided, all other search parameters are ignored.
129
+ #
130
+ # @overload purchase(account_id, area_code: nil, latitude: nil, longitude: nil, name: nil, phone_number: nil, type: nil, request_options: {})
70
131
  #
71
132
  # @param account_id [String] The account for which the phone number should be created.
72
133
  #
@@ -78,6 +139,8 @@ module SurgeAPI
78
139
  #
79
140
  # @param name [String] A human-readable name for the phone number. If not provided, defaults to the for
80
141
  #
142
+ # @param phone_number [String] The exact phone number to purchase in E.164 format. When provided, all other sea
143
+ #
81
144
  # @param type [Symbol, SurgeAPI::Models::PhoneNumberPurchaseParams::Type] Whether the phone number is local or toll-free. Can be omitted if area_code or l
82
145
  #
83
146
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.19.0"
4
+ VERSION = "0.20.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -99,9 +99,12 @@ require_relative "surge_api/models/message_sent_webhook_event"
99
99
  require_relative "surge_api/models/organization"
100
100
  require_relative "surge_api/models/phone_number"
101
101
  require_relative "surge_api/models/phone_number_attached_to_campaign_webhook_event"
102
+ require_relative "surge_api/models/phone_number_list_available_numbers_params"
103
+ require_relative "surge_api/models/phone_number_list_available_numbers_response"
102
104
  require_relative "surge_api/models/phone_number_list_params"
103
105
  require_relative "surge_api/models/phone_number_purchase_params"
104
106
  require_relative "surge_api/models/phone_number_release_params"
107
+ require_relative "surge_api/models/phone_number_retrieve_params"
105
108
  require_relative "surge_api/models/phone_number_update_params"
106
109
  require_relative "surge_api/models/recording_completed_webhook_event"
107
110
  require_relative "surge_api/models/recording_delete_params"