telnyx 2.9.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/scripts/before_install.sh +10 -9
- data/.github/workflows/publish-gem-on-release.yml +6 -6
- data/.github/workflows/ruby.yml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile +7 -8
- data/README.md +30 -9
- data/Spec3.json +77839 -0
- data/VERSION +1 -1
- data/lib/telnyx/access_control_ip.rb +13 -0
- data/lib/telnyx/access_ip_range.rb +12 -0
- data/lib/telnyx/address.rb +9 -0
- data/lib/telnyx/api_operations/delete.rb +1 -1
- data/lib/telnyx/api_resource.rb +4 -1
- data/lib/telnyx/authentication_providers.rb +12 -0
- data/lib/telnyx/available_phone_number.rb +5 -0
- data/lib/telnyx/balance.rb +12 -0
- data/lib/telnyx/batch_mdr_report.rb +15 -0
- data/lib/telnyx/brand.rb +20 -0
- data/lib/telnyx/bulk_creation.rb +21 -0
- data/lib/telnyx/bulk_credential.rb +16 -0
- data/lib/telnyx/bulk_phone_number_campaign.rb +23 -0
- data/lib/telnyx/bulk_sim_card_action.rb +9 -0
- data/lib/telnyx/business_identitie.rb +9 -0
- data/lib/telnyx/call.rb +2 -2
- data/lib/telnyx/call_event.rb +9 -0
- data/lib/telnyx/call_recording.rb +12 -0
- data/lib/telnyx/campaign.rb +42 -0
- data/lib/telnyx/cdr_usage_report.rb +13 -0
- data/lib/telnyx/channel_zone.rb +10 -0
- data/lib/telnyx/comment.rb +20 -0
- data/lib/telnyx/conference.rb +1 -1
- data/lib/telnyx/connection.rb +5 -0
- data/lib/telnyx/csv_download.rb +10 -0
- data/lib/telnyx/custom_storage_credential.rb +7 -0
- data/lib/telnyx/detail_record.rb +9 -0
- data/lib/telnyx/dialogflow_connection.rb +20 -0
- data/lib/telnyx/document.rb +20 -0
- data/lib/telnyx/dynamic_emergency_address.rb +12 -0
- data/lib/telnyx/dynamic_emergency_endpoint.rb +12 -0
- data/lib/telnyx/embedding.rb +14 -0
- data/lib/telnyx/enum.rb +22 -0
- data/lib/telnyx/fax.rb +14 -0
- data/lib/telnyx/global_ip.rb +10 -0
- data/lib/telnyx/global_ip_allowed_port.rb +8 -0
- data/lib/telnyx/global_ip_assignment.rb +12 -0
- data/lib/telnyx/global_ip_assignment_health.rb +8 -0
- data/lib/telnyx/global_ip_assignment_usage.rb +8 -0
- data/lib/telnyx/global_ip_latency.rb +8 -0
- data/lib/telnyx/global_ip_protocol.rb +8 -0
- data/lib/telnyx/global_ip_usage.rb +8 -0
- data/lib/telnyx/inference.rb +9 -0
- data/lib/telnyx/inventory_coverage.rb +9 -0
- data/lib/telnyx/ledger_billing_group_report.rb +9 -0
- data/lib/telnyx/managed_account.rb +32 -0
- data/lib/telnyx/mdr_usage_report.rb +21 -0
- data/lib/telnyx/media.rb +21 -0
- data/lib/telnyx/message_number_pool.rb +9 -0
- data/lib/telnyx/messaging_hosted_number_order.rb +21 -0
- data/lib/telnyx/messaging_profile.rb +14 -2
- data/lib/telnyx/messaging_tollfree_verification.rb +12 -0
- data/lib/telnyx/messaging_url_domain.rb +9 -0
- data/lib/telnyx/mobile_operator_network.rb +9 -0
- data/lib/telnyx/mobile_push_credential.rb +11 -0
- data/lib/telnyx/network.rb +19 -0
- data/lib/telnyx/notification_channel.rb +12 -0
- data/lib/telnyx/notification_event.rb +9 -0
- data/lib/telnyx/notification_event_condition.rb +9 -0
- data/lib/telnyx/notification_profile.rb +12 -0
- data/lib/telnyx/notification_setting.rb +12 -0
- data/lib/telnyx/number_block_order.rb +10 -0
- data/lib/telnyx/ota_update.rb +9 -0
- data/lib/telnyx/partner_campaign.rb +32 -0
- data/lib/telnyx/phone_number.rb +6 -0
- data/lib/telnyx/phone_number_block_job.rb +14 -0
- data/lib/telnyx/phone_number_campaigns.rb +19 -0
- data/lib/telnyx/portability_check.rb +9 -0
- data/lib/telnyx/porting_order.rb +39 -1
- data/lib/telnyx/portout.rb +9 -0
- data/lib/telnyx/private_wireless_gateway.rb +11 -0
- data/lib/telnyx/public_internet_gateway.rb +11 -0
- data/lib/telnyx/region.rb +9 -0
- data/lib/telnyx/requirement.rb +8 -0
- data/lib/telnyx/requirement_type.rb +8 -0
- data/lib/telnyx/room.rb +20 -0
- data/lib/telnyx/room_composition.rb +11 -0
- data/lib/telnyx/room_participant.rb +9 -0
- data/lib/telnyx/room_recording.rb +10 -0
- data/lib/telnyx/room_session.rb +18 -0
- data/lib/telnyx/short_code.rb +10 -0
- data/lib/telnyx/sim_card.rb +28 -2
- data/lib/telnyx/sim_card_action.rb +12 -0
- data/lib/telnyx/sim_card_data_usage_notification.rb +12 -0
- data/lib/telnyx/sim_card_group.rb +21 -0
- data/lib/telnyx/sim_card_group_action.rb +8 -0
- data/lib/telnyx/sim_card_order.rb +10 -0
- data/lib/telnyx/summary.rb +9 -0
- data/lib/telnyx/telephony_credential.rb +22 -0
- data/lib/telnyx/telnyx_client.rb +1 -2
- data/lib/telnyx/texml_application.rb +9 -0
- data/lib/telnyx/verification.rb +3 -3
- data/lib/telnyx/verified_calls_display_profile.rb +17 -0
- data/lib/telnyx/verify_profile.rb +1 -0
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx/virtual_cross_connect.rb +20 -0
- data/lib/telnyx/virtual_cross_connect_region.rb +9 -0
- data/lib/telnyx/wdr.rb +13 -0
- data/lib/telnyx/webhook_deliverie.rb +9 -0
- data/lib/telnyx/wireguard_interface.rb +11 -0
- data/lib/telnyx/wireguard_peer.rb +21 -0
- data/lib/telnyx.rb +67 -3
- data/server.js +31 -0
- data/telnyx.gemspec +4 -2
- data/test/openapi/README.md +31 -4
- data/test/telnyx/api_resource_test.rb +28 -22
- data/test/telnyx/available_phone_number_test.rb +6 -0
- data/test/telnyx/batch_mdr_report_test.rb +39 -0
- data/test/telnyx/billing_group_test.rb +12 -8
- data/test/telnyx/bulk_credential_test.rb +20 -0
- data/test/telnyx/bulk_sim_card_action_test.rb +22 -0
- data/test/telnyx/business_identitie_test.rb +25 -0
- data/test/telnyx/call_control_application_test.rb +13 -9
- data/test/telnyx/call_control_test.rb +24 -23
- data/test/telnyx/call_event_test.rb +14 -0
- data/test/telnyx/call_recording_test.rb +28 -0
- data/test/telnyx/call_test.rb +29 -0
- data/test/telnyx/campaign_test.rb +32 -0
- data/test/telnyx/cdr_usage_report_test.rb +15 -0
- data/test/telnyx/channel_zone_test.rb +14 -0
- data/test/telnyx/comment_test.rb +32 -0
- data/test/telnyx/conference_test.rb +27 -16
- data/test/telnyx/connection_test.rb +8 -1
- data/test/telnyx/credential_connection_test.rb +5 -4
- data/test/telnyx/csv_download_test.rb +33 -0
- data/test/telnyx/custom_storage_credential_test.rb +17 -0
- data/test/telnyx/detail_record_test.rb +15 -0
- data/test/telnyx/dialogflow_connection_test.rb +32 -0
- data/test/telnyx/embedding_test.rb +27 -0
- data/test/telnyx/enum_test.rb +15 -0
- data/test/telnyx/fax_application_test.rb +5 -4
- data/test/telnyx/fax_test.rb +13 -4
- data/test/telnyx/fqdn_connection_test.rb +5 -5
- data/test/telnyx/fqdn_test.rb +12 -7
- data/test/telnyx/global_ip_allowed_port_test.rb +14 -0
- data/test/telnyx/global_ip_assignment_health_test.rb +14 -0
- data/test/telnyx/global_ip_assignment_test.rb +44 -0
- data/test/telnyx/global_ip_latency_test.rb +14 -0
- data/test/telnyx/global_ip_protocol_test.rb +14 -0
- data/test/telnyx/global_ip_test.rb +35 -0
- data/test/telnyx/global_ip_usage_test.rb +14 -0
- data/test/telnyx/inference_test.rb +13 -0
- data/test/telnyx/ip_connection_test.rb +12 -8
- data/test/telnyx/ip_test.rb +12 -8
- data/test/telnyx/ledger_billing_group_report_test.rb +18 -0
- data/test/telnyx/managed_account_test.rb +42 -0
- data/test/telnyx/mdr_usage_report_test.rb +47 -0
- data/test/telnyx/message_number_pool_test.rb +18 -0
- data/test/telnyx/message_test.rb +2 -2
- data/test/telnyx/messaging_phone_number_test.rb +2 -1
- data/test/telnyx/messaging_profile_test.rb +27 -14
- data/test/telnyx/messaging_tollfree_verification_test.rb +71 -0
- data/test/telnyx/messaging_url_domain_test.rb +14 -0
- data/test/telnyx/mobile_operator_network_test.rb +15 -0
- data/test/telnyx/mobile_push_credential_test.rb +33 -0
- data/test/telnyx/network_test.rb +49 -0
- data/test/telnyx/number_block_order_test.rb +28 -0
- data/test/telnyx/number_order_document_test.rb +4 -3
- data/test/telnyx/number_order_test.rb +3 -2
- data/test/telnyx/number_reservation_test.rb +2 -2
- data/test/telnyx/ota_update_test.rb +20 -0
- data/test/telnyx/phone_number_block_job_test.rb +25 -0
- data/test/telnyx/phone_number_regulatory_requirement_test.rb +2 -1
- data/test/telnyx/phone_number_test.rb +8 -6
- data/test/telnyx/porting_order_test.rb +45 -10
- data/test/telnyx/private_wireless_gateway_test.rb +32 -0
- data/test/telnyx/public_internet_gateway_test.rb +32 -0
- data/test/telnyx/queue_test.rb +9 -6
- data/test/telnyx/region_test.rb +14 -0
- data/test/telnyx/regulatory_requirement_test.rb +6 -3
- data/test/telnyx/requirement_test.rb +22 -0
- data/test/telnyx/requirement_type_test.rb +22 -0
- data/test/telnyx/room_composition_test.rb +32 -0
- data/test/telnyx/room_participant_test.rb +19 -0
- data/test/telnyx/room_recording_test.rb +27 -0
- data/test/telnyx/room_session_test.rb +47 -0
- data/test/telnyx/room_test.rb +52 -0
- data/test/telnyx/short_code_test.rb +30 -0
- data/test/telnyx/sim_card_data_usage_notification_test.rb +42 -0
- data/test/telnyx/sim_card_group_action_test.rb +22 -0
- data/test/telnyx/sim_card_group_test.rb +59 -0
- data/test/telnyx/sim_card_order_test.rb +27 -0
- data/test/telnyx/sim_card_test.rb +75 -10
- data/test/telnyx/summary_test.rb +13 -0
- data/test/telnyx/telephony_credential_test.rb +35 -6
- data/test/telnyx/telnyx_client_test.rb +1 -0
- data/test/telnyx/texml_application_test.rb +25 -0
- data/test/telnyx/verification_test.rb +6 -4
- data/test/telnyx/verified_calls_display_profile_test.rb +33 -0
- data/test/telnyx/verify_profile_test.rb +16 -7
- data/test/telnyx/virtual_cross_connect_region_test.rb +22 -0
- data/test/telnyx/virtual_cross_connect_test.rb +49 -0
- data/test/telnyx/wdr_test.rb +14 -0
- data/test/telnyx/webhook_deliverie_test.rb +23 -0
- data/test/telnyx/wireguard_interface_test.rb +32 -0
- data/test/telnyx/wireguard_peer_test.rb +48 -0
- data/test/test_helper.rb +10 -26
- metadata +237 -37
- data/examples/2 factor authentication/Gemfile +0 -7
- data/examples/2 factor authentication/main.rb +0 -67
- data/examples/2 factor authentication/readme.md +0 -5
- data/test/telnyx_mock.rb +0 -78
@@ -5,6 +5,9 @@ require_relative "../test_helper"
|
|
5
5
|
|
6
6
|
module Telnyx
|
7
7
|
class ApiResourceTest < Test::Unit::TestCase
|
8
|
+
setup do
|
9
|
+
@id = "fa47ef1f-1534-bf92-3893-35cb41870c50"
|
10
|
+
end
|
8
11
|
should "creating a new APIResource should not fetch over the network" do
|
9
12
|
Telnyx::MessagingProfile.new("someid")
|
10
13
|
assert_not_requested :get, %r{#{Telnyx.api_base}/.*}
|
@@ -16,14 +19,14 @@ module Telnyx
|
|
16
19
|
end
|
17
20
|
|
18
21
|
should "setting an attribute should not cause a network request" do
|
19
|
-
m = Telnyx::MessagingProfile.new(
|
22
|
+
m = Telnyx::MessagingProfile.new(@id)
|
20
23
|
m.name = "My New Messaging Profile"
|
21
24
|
assert_not_requested :get, %r{#{Telnyx.api_base}/.*}
|
22
25
|
assert_not_requested :post, %r{#{Telnyx.api_base}/.*}
|
23
26
|
end
|
24
27
|
|
25
28
|
should "accessing id should not issue a fetch" do
|
26
|
-
m = Telnyx::MessagingProfile.new(
|
29
|
+
m = Telnyx::MessagingProfile.new(@id)
|
27
30
|
m.id
|
28
31
|
assert_not_requested :get, "#{Telnyx.api_base}/messaging_profiles/123"
|
29
32
|
end
|
@@ -47,13 +50,13 @@ module Telnyx
|
|
47
50
|
should "specifying api credentials containing whitespace should raise an exception" do
|
48
51
|
Telnyx.api_key = "key "
|
49
52
|
assert_raises Telnyx::AuthenticationError do
|
50
|
-
Telnyx::MessagingProfile.new(
|
53
|
+
Telnyx::MessagingProfile.new(@id).refresh
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
57
|
should "get resource URL" do
|
55
|
-
m = Telnyx::MessagingProfile.new(
|
56
|
-
assert_match "/messaging_profiles
|
58
|
+
m = Telnyx::MessagingProfile.new(@id)
|
59
|
+
assert_match "/messaging_profiles/#{@id}", m.resource_url
|
57
60
|
end
|
58
61
|
|
59
62
|
context "when specifying per-object credentials" do
|
@@ -137,41 +140,42 @@ module Telnyx
|
|
137
140
|
end
|
138
141
|
|
139
142
|
should "making a POST request with parameters should have a body and no query string" do
|
143
|
+
omit "Messaging Profile restructured"
|
140
144
|
Telnyx::MessagingProfile.create(name: "New Messaging Profile")
|
141
145
|
assert_requested(:post, "#{Telnyx.api_base}/v2/messaging_profiles", body: { name: "New Messaging Profile" })
|
142
146
|
end
|
143
147
|
|
144
148
|
should "loading an object should issue a GET request" do
|
145
|
-
mp = Telnyx::MessagingProfile.new(
|
149
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
146
150
|
mp.refresh
|
147
|
-
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles
|
151
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
148
152
|
end
|
149
153
|
|
150
154
|
should "using array accessors should be the same as the method interface" do
|
151
|
-
mp = Telnyx::MessagingProfile.new(
|
155
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
152
156
|
mp.refresh
|
153
157
|
assert_equal mp.created_at, mp[:created_at]
|
154
158
|
assert_equal mp.created_at, mp["created_at"]
|
155
159
|
mp["created_at"] = 12_345
|
156
160
|
assert_equal mp.created_at, 12_345
|
157
|
-
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles
|
161
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
158
162
|
end
|
159
163
|
|
160
164
|
should "updating an object should issue a PATCH request with only the changed properties" do
|
161
|
-
|
165
|
+
mp = Telnyx::MessagingProfile.retrieve(@id)
|
166
|
+
stub_patch = stub_request(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{mp.id}")
|
162
167
|
.with(body: hash_including("name" => "new name"))
|
163
168
|
.to_return(body: JSON.generate(data: messaging_profile_fixture))
|
164
|
-
mp = Telnyx::MessagingProfile.retrieve("123")
|
165
169
|
mp.name = "new name"
|
166
170
|
mp.save
|
167
171
|
assert_requested(stub_patch)
|
168
172
|
end
|
169
173
|
|
170
174
|
should "updating should merge in returned properties" do
|
171
|
-
|
175
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
176
|
+
stub_patch = stub_request(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
172
177
|
.with(body: hash_including("name" => "new name"))
|
173
178
|
.to_return(body: JSON.generate(data: messaging_profile_fixture))
|
174
|
-
mp = Telnyx::MessagingProfile.new("123")
|
175
179
|
mp.name = "new name"
|
176
180
|
mp.save
|
177
181
|
|
@@ -194,13 +198,14 @@ module Telnyx
|
|
194
198
|
mp.save({ name: "Profile for Messages" }, api_key: "super-secret")
|
195
199
|
|
196
200
|
assert_requested(stub_post)
|
197
|
-
assert_equal "Profile for Messages", mp.name
|
201
|
+
# assert_equal "Profile for Messages", mp.name
|
198
202
|
end
|
199
203
|
|
200
204
|
should "deleting should send no props and result in an object that has no props other than `deleted`" do
|
201
205
|
mp = Telnyx::MessagingProfile.construct_from(messaging_profile_fixture)
|
206
|
+
id = mp.id.freeze
|
202
207
|
mp.delete
|
203
|
-
assert_requested(:delete, "#{Telnyx.api_base}/v2/messaging_profiles
|
208
|
+
assert_requested(:delete, "#{Telnyx.api_base}/v2/messaging_profiles/#{id}", body: "")
|
204
209
|
end
|
205
210
|
|
206
211
|
should "loading all of an APIResource should return an array of recursively instantiated objects" do
|
@@ -213,19 +218,19 @@ module Telnyx
|
|
213
218
|
|
214
219
|
should "save nothing if nothing changes" do
|
215
220
|
messaging_profile = Telnyx::MessagingProfile.construct_from(
|
216
|
-
id:
|
221
|
+
id: @id,
|
217
222
|
meta: {
|
218
223
|
key: "value",
|
219
224
|
}
|
220
225
|
)
|
221
226
|
|
222
227
|
messaging_profile.save
|
223
|
-
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles
|
228
|
+
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}", body: {})
|
224
229
|
end
|
225
230
|
|
226
231
|
should "correctly handle array noops" do
|
227
232
|
messaging_profile = Telnyx::MessagingProfile.construct_from(
|
228
|
-
id: "
|
233
|
+
id: "fa47ef1f-1534-bf92-3893-35cb41870c50",
|
229
234
|
legal_entity: {
|
230
235
|
additional_owners: [{ first_name: "Bob" }],
|
231
236
|
},
|
@@ -233,7 +238,7 @@ module Telnyx
|
|
233
238
|
)
|
234
239
|
|
235
240
|
messaging_profile.save
|
236
|
-
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/
|
241
|
+
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/fa47ef1f-1534-bf92-3893-35cb41870c50", body: {})
|
237
242
|
end
|
238
243
|
|
239
244
|
should "correctly handle hash noops" do
|
@@ -252,7 +257,8 @@ module Telnyx
|
|
252
257
|
assert_requested(stub_post)
|
253
258
|
end
|
254
259
|
|
255
|
-
should "
|
260
|
+
should "create a new resource when an object without an id is saved" do
|
261
|
+
omit "Messaging Profile restructured"
|
256
262
|
messaging_profile = Telnyx::MessagingProfile.construct_from(id: nil, name: nil)
|
257
263
|
|
258
264
|
messaging_profile.name = "my-messaging-profile"
|
@@ -267,7 +273,7 @@ module Telnyx
|
|
267
273
|
|
268
274
|
stub_post = stub_request(:post, "#{Telnyx.api_base}/v2/messaging_profiles")
|
269
275
|
.with(body: { name: "telnyx", meta: { key: "value" } })
|
270
|
-
.to_return(body: JSON.generate(data: { "id" =>
|
276
|
+
.to_return(body: JSON.generate(data: { "id" => @id }))
|
271
277
|
|
272
278
|
messaging_profile.save(name: "telnyx", meta: { key: "value" })
|
273
279
|
assert_requested(stub_post)
|
@@ -278,7 +284,7 @@ module Telnyx
|
|
278
284
|
setup do
|
279
285
|
if @@fixtures.empty?
|
280
286
|
cache_fixture(:messaging_profile) do
|
281
|
-
MessagingProfile.retrieve(
|
287
|
+
MessagingProfile.retrieve(@id)
|
282
288
|
end
|
283
289
|
end
|
284
290
|
end
|
@@ -15,5 +15,11 @@ module Telnyx
|
|
15
15
|
Telnyx::AvailablePhoneNumber.list phone_number: { starts_with: "2&&", ends_with: "ABC" }
|
16
16
|
assert_requested(:get, /#{"#{Telnyx.api_base}/v2/available_phone_numbers"}/)
|
17
17
|
end
|
18
|
+
|
19
|
+
should "be lists of block phone numbers" do
|
20
|
+
blocks = AvailablePhoneNumber.blocks
|
21
|
+
assert blocks.is_a?(ListObject)
|
22
|
+
assert blocks[:data].is_a?(Array)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class BatchMdrReportTest < Test::Unit::TestCase
|
7
|
+
should "list batch mdr reports" do
|
8
|
+
omit "api change"
|
9
|
+
batch_mdr_reports = BatchMdrReport.list
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports"
|
11
|
+
assert_kind_of ListObject, batch_mdr_reports
|
12
|
+
assert_kind_of TelnyxObject, batch_mdr_reports.first
|
13
|
+
end
|
14
|
+
|
15
|
+
should "create batch mdr report" do
|
16
|
+
omit "api change"
|
17
|
+
BatchMdrReport.create(
|
18
|
+
end_date: "2024-12-02T00:00:00-06:00",
|
19
|
+
start_date: "2024-12-01T00:00:00-06:00"
|
20
|
+
)
|
21
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports"
|
22
|
+
end
|
23
|
+
|
24
|
+
should "retrieve batch mdr report" do
|
25
|
+
omit "api change"
|
26
|
+
batch_mdr_batch = BatchMdrReport.retrieve("id")
|
27
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports/id"
|
28
|
+
assert_kind_of TelnyxObject, batch_mdr_batch
|
29
|
+
end
|
30
|
+
|
31
|
+
should "delete batch mdr report" do
|
32
|
+
omit "api change"
|
33
|
+
batch_mdr_batch = BatchMdrReport.retrieve("id")
|
34
|
+
id = batch_mdr_batch.id.gsub(/\s+/, "+").freeze
|
35
|
+
batch_mdr_batch.delete
|
36
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports/#{id}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -4,6 +4,10 @@ require_relative "../test_helper"
|
|
4
4
|
|
5
5
|
module Telnyx
|
6
6
|
class BillingGroupTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@id = "1c816dc7-af75-6149-ae06-cc63a4f275b1"
|
9
|
+
end
|
10
|
+
|
7
11
|
should "list billing groups" do
|
8
12
|
billing_groups = BillingGroup.list
|
9
13
|
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups"
|
@@ -17,24 +21,24 @@ module Telnyx
|
|
17
21
|
end
|
18
22
|
|
19
23
|
should "retrieve billing group" do
|
20
|
-
billing_group = BillingGroup.retrieve(
|
21
|
-
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups
|
24
|
+
billing_group = BillingGroup.retrieve(@id)
|
25
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups/#{@id}"
|
22
26
|
assert_kind_of BillingGroup, billing_group
|
23
27
|
end
|
24
28
|
|
25
29
|
should "delete billing group" do
|
26
|
-
billing_group = BillingGroup.retrieve(
|
27
|
-
|
30
|
+
billing_group = BillingGroup.retrieve(@id)
|
31
|
+
id = billing_group.id.freeze
|
28
32
|
billing_group.delete
|
29
|
-
assert_requested :delete, "#{Telnyx.api_base}/v2/billing_groups
|
33
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/billing_groups/#{id}"
|
30
34
|
end
|
31
35
|
|
32
36
|
should "update billing group" do
|
33
|
-
billing_group = BillingGroup.retrieve(
|
34
|
-
|
37
|
+
billing_group = BillingGroup.retrieve(@id)
|
38
|
+
id = billing_group.id.freeze
|
35
39
|
billing_group.active = false
|
36
40
|
billing_group.save
|
37
|
-
assert_requested :patch, "#{Telnyx.api_base}/v2/billing_groups
|
41
|
+
assert_requested :patch, "#{Telnyx.api_base}/v2/billing_groups/#{id}"
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class BulkCredentialTest < Test::Unit::TestCase
|
7
|
+
should "bulk_telephony_credentials" do
|
8
|
+
bulk = BulkCredential.bulk_telephony_credentials(tag: "id", connection_id: "1234567890")
|
9
|
+
assert bulk.is_a?(TelnyxObject)
|
10
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/actions/bulk/telephony_credentials")
|
11
|
+
end
|
12
|
+
|
13
|
+
should "purchase_esims" do
|
14
|
+
purchase = BulkCredential.purchase_esims(amount: 10)
|
15
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/actions/purchase/esims")
|
16
|
+
assert purchase.is_a?(ListObject)
|
17
|
+
assert purchase[:data].is_a?(Array)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class BulkSimCardActionTest < Test::Unit::TestCase
|
7
|
+
should "bulk sim card retrieve" do
|
8
|
+
bulk_sim_card_actions = BulkSimCardAction.list
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/bulk_sim_card_actions"
|
10
|
+
assert_kind_of ListObject, bulk_sim_card_actions
|
11
|
+
assert_kind_of Telnyx::TelnyxObject, bulk_sim_card_actions.first
|
12
|
+
end
|
13
|
+
|
14
|
+
should "bulk sim card get by id" do
|
15
|
+
bulk_sim_card_action_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58"
|
16
|
+
bulk_sim_card_action = BulkSimCardAction.retrieve(bulk_sim_card_action_id)
|
17
|
+
|
18
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/bulk_sim_card_actions/#{bulk_sim_card_action_id}"
|
19
|
+
assert_kind_of Telnyx::TelnyxObject, bulk_sim_card_action
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class BusinessIdentitieTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@identities = BusinessIdentitie.list
|
9
|
+
@id = @identities[:data].first.id.freeze
|
10
|
+
end
|
11
|
+
|
12
|
+
should "be listable" do
|
13
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/business_identities"
|
14
|
+
assert_kind_of ListObject, @identities
|
15
|
+
assert_kind_of TelnyxObject, @identities[:data].first
|
16
|
+
assert @identities[:data].is_a?(Array)
|
17
|
+
end
|
18
|
+
|
19
|
+
should "be retrievable" do
|
20
|
+
identity = BusinessIdentitie.retrieve(@id)
|
21
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/business_identities/#{@id}"
|
22
|
+
assert identity.is_a?(BusinessIdentitie)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -4,6 +4,9 @@ require_relative "../test_helper"
|
|
4
4
|
|
5
5
|
module Telnyx
|
6
6
|
class CallControlApplicationTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@id = "nulla"
|
9
|
+
end
|
7
10
|
should "list call_control_application" do
|
8
11
|
call_control_application = CallControlApplication.list
|
9
12
|
assert_requested :get, "#{Telnyx.api_base}/v2/call_control_applications"
|
@@ -12,31 +15,32 @@ module Telnyx
|
|
12
15
|
end
|
13
16
|
|
14
17
|
should "create call_control_application" do
|
15
|
-
CallControlApplication.create webhook_event_url: "example.com", connection_name: "telnyx", application_name: "telnyx"
|
18
|
+
CallControlApplication.create webhook_event_url: "https://example.com", connection_name: "telnyx", application_name: "telnyx"
|
16
19
|
assert_requested :post, "#{Telnyx.api_base}/v2/call_control_applications"
|
17
20
|
end
|
18
21
|
|
19
22
|
should "retrieve call_control_application" do
|
20
|
-
call_control_application = CallControlApplication.retrieve(
|
21
|
-
assert_requested :get, "#{Telnyx.api_base}/v2/call_control_applications
|
23
|
+
call_control_application = CallControlApplication.retrieve(@id)
|
24
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/call_control_applications/#{@id}"
|
22
25
|
assert_kind_of CallControlApplication, call_control_application
|
23
26
|
end
|
24
27
|
|
25
28
|
should "delete call_control_application" do
|
26
|
-
call_control_application = CallControlApplication.retrieve(
|
27
|
-
|
29
|
+
call_control_application = CallControlApplication.retrieve(@id)
|
30
|
+
id = call_control_application.id.gsub(/\s+/, "+").freeze
|
28
31
|
call_control_application.delete
|
29
|
-
assert_requested :delete, "#{Telnyx.api_base}/v2/call_control_applications
|
32
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/call_control_applications/#{id}"
|
30
33
|
end
|
31
34
|
|
32
35
|
should "update call_control_application" do
|
33
|
-
call_control_application = CallControlApplication.retrieve(
|
36
|
+
call_control_application = CallControlApplication.retrieve(@id)
|
34
37
|
|
35
|
-
call_control_application.webhook_event_url = "example.com"
|
38
|
+
call_control_application.webhook_event_url = "https://example.com"
|
36
39
|
call_control_application.connection_name = "telnyx"
|
37
40
|
call_control_application.application_name = "telnyx"
|
41
|
+
id = call_control_application.id.gsub(/\s+/, "+").freeze
|
38
42
|
call_control_application.save
|
39
|
-
assert_requested :patch, "#{Telnyx.api_base}/v2/call_control_applications
|
43
|
+
assert_requested :patch, "#{Telnyx.api_base}/v2/call_control_applications/#{id}"
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -7,6 +7,7 @@ module Telnyx
|
|
7
7
|
class CallControlTest < Test::Unit::TestCase
|
8
8
|
setup do
|
9
9
|
@call = create_call
|
10
|
+
@call_control_id = @call.call_control_id.gsub(/\s+/, "+").freeze
|
10
11
|
end
|
11
12
|
context "call instance" do
|
12
13
|
should "be correct class" do
|
@@ -69,87 +70,87 @@ module Telnyx
|
|
69
70
|
context "commands" do
|
70
71
|
should "reject" do
|
71
72
|
@call.reject cause: "CALL_REJECTED"
|
72
|
-
assert_requested :post, format_action_url(@
|
73
|
+
assert_requested :post, format_action_url(@call_control_id, "reject")
|
73
74
|
end
|
74
75
|
should "answer" do
|
75
76
|
@call.answer
|
76
|
-
assert_requested :post, format_action_url(@
|
77
|
+
assert_requested :post, format_action_url(@call_control_id, "answer")
|
77
78
|
end
|
78
79
|
should "hangup" do
|
79
80
|
@call.hangup
|
80
|
-
assert_requested :post, format_action_url(@
|
81
|
+
assert_requested :post, format_action_url(@call_control_id, "hangup")
|
81
82
|
end
|
82
83
|
should "bridge" do
|
83
84
|
@call.bridge call_control_id: SecureRandom.base64(20)
|
84
|
-
assert_requested :post, format_action_url(@
|
85
|
+
assert_requested :post, format_action_url(@call_control_id, "bridge")
|
85
86
|
end
|
86
87
|
should "speak" do
|
87
88
|
@call.speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
88
|
-
assert_requested :post, format_action_url(@
|
89
|
+
assert_requested :post, format_action_url(@call_control_id, "speak")
|
89
90
|
end
|
90
91
|
should "start fork" do
|
91
92
|
@call.fork_start call_control_id: SecureRandom.base64(20)
|
92
|
-
assert_requested :post, format_action_url(@
|
93
|
+
assert_requested :post, format_action_url(@call_control_id, "fork_start")
|
93
94
|
end
|
94
95
|
should "stop fork" do
|
95
96
|
@call.fork_stop
|
96
|
-
assert_requested :post, format_action_url(@
|
97
|
+
assert_requested :post, format_action_url(@call_control_id, "fork_stop")
|
97
98
|
end
|
98
99
|
should "gather using audio" do
|
99
100
|
@call.gather_using_audio audio_url: "https://audio.example.com"
|
100
|
-
assert_requested :post, format_action_url(@
|
101
|
+
assert_requested :post, format_action_url(@call_control_id, "gather_using_audio")
|
101
102
|
end
|
102
103
|
should "gather using speak" do
|
103
104
|
@call.gather_using_speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
104
|
-
assert_requested :post, format_action_url(@
|
105
|
+
assert_requested :post, format_action_url(@call_control_id, "gather_using_speak")
|
105
106
|
end
|
106
107
|
should "playback start" do
|
107
108
|
@call.playback_start audio_url: "https://audio.example.com"
|
108
|
-
assert_requested :post, format_action_url(@
|
109
|
+
assert_requested :post, format_action_url(@call_control_id, "playback_start")
|
109
110
|
end
|
110
111
|
should "playback stop" do
|
111
112
|
@call.playback_stop
|
112
|
-
assert_requested :post, format_action_url(@
|
113
|
+
assert_requested :post, format_action_url(@call_control_id, "playback_stop")
|
113
114
|
end
|
114
115
|
should "send dtmf" do
|
115
116
|
@call.send_dtmf digits: "1www2WABCDw9"
|
116
|
-
assert_requested :post, format_action_url(@
|
117
|
+
assert_requested :post, format_action_url(@call_control_id, "send_dtmf")
|
117
118
|
end
|
118
119
|
should "transfer" do
|
119
120
|
@call.transfer to: "+15552223333"
|
120
|
-
assert_requested :post, format_action_url(@
|
121
|
+
assert_requested :post, format_action_url(@call_control_id, "transfer")
|
121
122
|
end
|
122
123
|
should "start transcription" do
|
123
124
|
@call.transcription_start
|
124
|
-
assert_requested :post, format_action_url(@
|
125
|
+
assert_requested :post, format_action_url(@call_control_id, "transcription_start")
|
125
126
|
end
|
126
127
|
should "end transcription" do
|
127
128
|
@call.transcription_stop
|
128
|
-
assert_requested :post, format_action_url(@
|
129
|
+
assert_requested :post, format_action_url(@call_control_id, "transcription_stop")
|
129
130
|
end
|
130
131
|
should "pause recording" do
|
131
132
|
@call.record_pause
|
132
|
-
assert_requested :post, format_action_url(@
|
133
|
+
assert_requested :post, format_action_url(@call_control_id, "record_pause")
|
133
134
|
end
|
134
135
|
should "resume recording" do
|
135
136
|
@call.record_resume
|
136
|
-
assert_requested :post, format_action_url(@
|
137
|
+
assert_requested :post, format_action_url(@call_control_id, "record_resume")
|
137
138
|
end
|
138
139
|
should "gather stop" do
|
139
140
|
@call.gather_stop
|
140
|
-
assert_requested :post, format_action_url(@
|
141
|
+
assert_requested :post, format_action_url(@call_control_id, "gather_stop")
|
141
142
|
end
|
142
143
|
should "refer" do
|
143
144
|
@call.refer sip_address: "sip:username@sip.non-telnyx-address.com"
|
144
|
-
assert_requested :post, format_action_url(@
|
145
|
+
assert_requested :post, format_action_url(@call_control_id, "refer")
|
145
146
|
end
|
146
147
|
should "enqueue" do
|
147
148
|
@call.enqueue call_control_id: SecureRandom.base64(20)
|
148
|
-
assert_requested :post, format_action_url(@
|
149
|
+
assert_requested :post, format_action_url(@call_control_id, "enqueue")
|
149
150
|
end
|
150
151
|
should "leave_queue" do
|
151
152
|
@call.leave_queue call_control_id: SecureRandom.base64(20)
|
152
|
-
assert_requested :post, format_action_url(@
|
153
|
+
assert_requested :post, format_action_url(@call_control_id, "leave_queue")
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
@@ -157,8 +158,8 @@ module Telnyx
|
|
157
158
|
Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222", cause: "test"
|
158
159
|
end
|
159
160
|
|
160
|
-
def format_action_url(
|
161
|
-
"#{Telnyx.api_base}/v2/calls/#{
|
161
|
+
def format_action_url(call_control_id, action)
|
162
|
+
"#{Telnyx.api_base}/v2/calls/#{call_control_id}/actions/#{action}"
|
162
163
|
end
|
163
164
|
end
|
164
165
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CallEventTest < Test::Unit::TestCase
|
7
|
+
should "be listable" do
|
8
|
+
call_events = CallEvent.list
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/call_events"
|
10
|
+
assert call_events.is_a?(ListObject)
|
11
|
+
assert call_events[:data].is_a?(Array)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CallRecordingTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@id = "d25f43b3-aea3-6a5d-7a1b-d83e5c100cce"
|
9
|
+
@call_recording = CallRecording.retrieve @id
|
10
|
+
end
|
11
|
+
should "retrieve recording" do
|
12
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/recordings/#{@id}")
|
13
|
+
assert_kind_of Telnyx::CallRecording, @call_recording
|
14
|
+
end
|
15
|
+
|
16
|
+
should "list recordings" do
|
17
|
+
recording = CallRecording.list
|
18
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/recordings")
|
19
|
+
assert_kind_of Telnyx::ListObject, recording
|
20
|
+
end
|
21
|
+
|
22
|
+
should "delete recording" do
|
23
|
+
id = @call_recording.id.gsub(/\s+/, "+").freeze
|
24
|
+
@call_recording.delete
|
25
|
+
assert_requested(:delete, "#{Telnyx.api_base}/v2/recordings/#{id}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CallTest < Test::Unit::TestCase
|
7
|
+
should "gether" do
|
8
|
+
call = Call.retrieve("13")
|
9
|
+
id = call.call_control_id.gsub(/\s+/, "+").freeze
|
10
|
+
call.gather
|
11
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/calls/#{id}/actions/gather"
|
12
|
+
assert_kind_of Call, call
|
13
|
+
end
|
14
|
+
should "streaming_stop" do
|
15
|
+
call = Call.retrieve("13")
|
16
|
+
id = call.call_control_id.gsub(/\s+/, "+").freeze
|
17
|
+
call.streaming_stop
|
18
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/calls/#{id}/actions/streaming_stop"
|
19
|
+
assert_kind_of Call, call
|
20
|
+
end
|
21
|
+
should "streaming_start" do
|
22
|
+
call = Call.retrieve("13")
|
23
|
+
id = call.call_control_id.gsub(/\s+/, "+").freeze
|
24
|
+
call.streaming_start
|
25
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/calls/#{id}/actions/streaming_start"
|
26
|
+
assert_kind_of Call, call
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CampaignTest < Test::Unit::TestCase
|
7
|
+
should "retrieve campaign" do
|
8
|
+
omit "ID req mismatch"
|
9
|
+
campaign = Campaign.retrieve("id")
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/campaign/id"
|
11
|
+
assert_kind_of Campaign, campaign
|
12
|
+
end
|
13
|
+
|
14
|
+
should "accept_sharing campaign" do
|
15
|
+
omit "ID req mismatch"
|
16
|
+
campaign = Campaign.retrieve("id")
|
17
|
+
id = campaign.campaignId.gsub(/\s+/, "+").freeze
|
18
|
+
campaign.accept_sharing
|
19
|
+
|
20
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/campaign/acceptSharing/#{id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
should "get asr_attributes" do
|
24
|
+
omit "ID req mismatch"
|
25
|
+
campaign = Campaign.retrieve("id")
|
26
|
+
id = campaign.campaignId.gsub(/\s+/, "+").freeze
|
27
|
+
campaign.osr_attributes
|
28
|
+
|
29
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/campaign/#{id}/osr/attributes"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CdrUsageReportTest < Test::Unit::TestCase
|
7
|
+
should "list of sync cdr usage reports" do
|
8
|
+
omit "ID req mismatch"
|
9
|
+
cdr_usage_report = CdrUsageReport.sync
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/reports/cdr_usage_reports/sync"
|
11
|
+
|
12
|
+
assert_kind_of ListObject, cdr_usage_report
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class ChannelZoneTest < Test::Unit::TestCase
|
7
|
+
should "list channel zones" do
|
8
|
+
channel_zones = ChannelZone.list
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/channel_zones"
|
10
|
+
assert_kind_of ListObject, channel_zones
|
11
|
+
assert_kind_of TelnyxObject, channel_zones.first
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|