telnyx 2.9.0 → 3.0.0
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 +1 -1
- 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 +13 -0
- data/lib/telnyx/bulk_creation.rb +21 -0
- data/lib/telnyx/bulk_credential.rb +16 -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 +34 -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 +15 -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/phone_number.rb +6 -0
- data/lib/telnyx/phone_number_block_job.rb +14 -0
- data/lib/telnyx/phone_number_campaigns.rb +12 -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/telnyx/api_resource_test.rb +25 -21
- data/test/telnyx/available_phone_number_test.rb +6 -0
- data/test/telnyx/batch_mdr_report_test.rb +35 -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 +12 -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 +26 -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 +12 -0
- data/test/telnyx/telephony_credential_test.rb +35 -6
- data/test/telnyx/texml_application_test.rb +25 -0
- data/test/telnyx/verification_test.rb +4 -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 +235 -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
@@ -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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CommentTest < Test::Unit::TestCase
|
7
|
+
should "comment list retrieve" do
|
8
|
+
omit "ID req mismatch"
|
9
|
+
comments = Comment.list
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/comments"
|
11
|
+
assert_kind_of ListObject, comments
|
12
|
+
assert_kind_of Telnyx::TelnyxObject, comments.first
|
13
|
+
end
|
14
|
+
|
15
|
+
should "comments get by id" do
|
16
|
+
comment_id = "12ade33a-21c0-473b-b055-b3c836e1c292"
|
17
|
+
comment = Comment.retrieve(comment_id)
|
18
|
+
|
19
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/comments/#{comment_id}"
|
20
|
+
assert_kind_of Telnyx::TelnyxObject, comment
|
21
|
+
end
|
22
|
+
|
23
|
+
should "comments read" do
|
24
|
+
omit "ID req mismatch"
|
25
|
+
comment = Comment.retrieve("12ade33a-21c0-473b-b055-b3c836e1c292")
|
26
|
+
id = comment.id
|
27
|
+
comment.read(name: "new")
|
28
|
+
assert_requested :patch, "#{Telnyx.api_base}/v2/comments/#{id}/read"
|
29
|
+
assert_kind_of Telnyx::TelnyxObject, comment
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -6,6 +6,7 @@ module Telnyx
|
|
6
6
|
class ConferenceTest < Test::Unit::TestCase
|
7
7
|
setup do
|
8
8
|
@conference = Conference.create call_control_id: "foobar", name: "conference!"
|
9
|
+
@id = @conference.id.gsub(/\s+/, "+").freeze
|
9
10
|
end
|
10
11
|
should "create conference" do
|
11
12
|
assert_requested :post, "#{Telnyx.api_base}/v2/conferences"
|
@@ -28,7 +29,7 @@ module Telnyx
|
|
28
29
|
|
29
30
|
should "list participants" do
|
30
31
|
participants = @conference.participants
|
31
|
-
assert_requested :get, "#{Telnyx.api_base}/v2/conferences/#{@conference.id}/participants"
|
32
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/conferences/#{@conference.id.gsub(/\s+/, '+')}/participants"
|
32
33
|
assert_kind_of ListObject, participants
|
33
34
|
end
|
34
35
|
|
@@ -48,57 +49,67 @@ module Telnyx
|
|
48
49
|
context "commands" do
|
49
50
|
should "join" do
|
50
51
|
@conference.join call_control_id: "foo_bar_baz"
|
51
|
-
assert_requested :post, action_url(@
|
52
|
+
assert_requested :post, action_url(@id, "join")
|
52
53
|
end
|
53
54
|
|
54
55
|
should "mute" do
|
55
56
|
@conference.mute
|
56
|
-
assert_requested :post, action_url(@
|
57
|
+
assert_requested :post, action_url(@id, "mute")
|
57
58
|
end
|
58
59
|
|
59
60
|
should "unmute" do
|
60
61
|
@conference.unmute
|
61
|
-
assert_requested :post, action_url(@
|
62
|
+
assert_requested :post, action_url(@id, "unmute")
|
62
63
|
end
|
63
64
|
|
64
65
|
should "hold" do
|
65
66
|
@conference.hold
|
66
|
-
assert_requested :post, action_url(@
|
67
|
+
assert_requested :post, action_url(@id, "hold")
|
67
68
|
end
|
68
69
|
|
69
70
|
should "unhold" do
|
70
71
|
@conference.unhold call_control_ids: %w[foo bar baz]
|
71
|
-
assert_requested :post, action_url(@
|
72
|
+
assert_requested :post, action_url(@id, "unhold")
|
72
73
|
end
|
73
74
|
|
74
75
|
should "play" do
|
75
76
|
@conference.play audio_url: "https://example.com/audio.mp3"
|
76
|
-
assert_requested :post, action_url(@
|
77
|
+
assert_requested :post, action_url(@id, "play")
|
77
78
|
end
|
78
79
|
|
79
80
|
should "start recording" do
|
80
81
|
@conference.start_recording channels: "dual", format: "mp3"
|
81
|
-
assert_requested :post, action_url(@
|
82
|
+
assert_requested :post, action_url(@id, "record_start")
|
82
83
|
end
|
83
84
|
|
84
85
|
should "stop recording" do
|
85
86
|
@conference.stop_recording
|
86
|
-
assert_requested :post, action_url(@
|
87
|
+
assert_requested :post, action_url(@id, "record_stop")
|
87
88
|
end
|
88
89
|
|
89
90
|
should "speak" do
|
90
91
|
@conference.speak language: "en-US", payload: "test speech", voice: "female"
|
91
|
-
assert_requested :post, action_url(@
|
92
|
+
assert_requested :post, action_url(@id, "speak")
|
92
93
|
end
|
93
94
|
|
94
|
-
should "
|
95
|
-
@conference.
|
96
|
-
assert_requested :post, action_url(@
|
95
|
+
should "record_pause" do
|
96
|
+
@conference.record_pause
|
97
|
+
assert_requested :post, action_url(@id, "record_pause")
|
97
98
|
end
|
98
99
|
|
100
|
+
should "record_resume" do
|
101
|
+
@conference.record_resume
|
102
|
+
assert_requested :post, action_url(@id, "record_resume")
|
103
|
+
end
|
104
|
+
|
105
|
+
# should "dial participant" do
|
106
|
+
# @conference.dial_participant call_control_id: "foo", to: "+12223334444", from: "+12223335555"
|
107
|
+
# assert_requested :post, action_url(@id, "dial_participant")
|
108
|
+
# end
|
109
|
+
|
99
110
|
should "update" do
|
100
111
|
@conference.update call_control_id: "foo", supervisor_role: "barge"
|
101
|
-
assert_requested :post, action_url(@
|
112
|
+
assert_requested :post, action_url(@id, "update")
|
102
113
|
end
|
103
114
|
end
|
104
115
|
|
@@ -106,8 +117,8 @@ module Telnyx
|
|
106
117
|
Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222"
|
107
118
|
end
|
108
119
|
|
109
|
-
def action_url(
|
110
|
-
"#{Telnyx.api_base}/v2/conferences/#{
|
120
|
+
def action_url(id, action)
|
121
|
+
"#{Telnyx.api_base}/v2/conferences/#{id}/actions/#{action}"
|
111
122
|
end
|
112
123
|
end
|
113
124
|
end
|
@@ -11,7 +11,7 @@ module Telnyx
|
|
11
11
|
assert connections.first.is_a?(Connection) ||
|
12
12
|
connections.first.is_a?(IPConnection) ||
|
13
13
|
connections.first.is_a?(FQDNConnection) ||
|
14
|
-
connections.first.is_a?(
|
14
|
+
connections.first.is_a?(TelnyxObject),
|
15
15
|
"Unexpected type: #{connections.first.class}"
|
16
16
|
end
|
17
17
|
|
@@ -24,5 +24,12 @@ module Telnyx
|
|
24
24
|
connection.is_a?(CredentialConnection),
|
25
25
|
"Unexpected type: #{connection.class}"
|
26
26
|
end
|
27
|
+
|
28
|
+
should "retrieve active_calls" do
|
29
|
+
connection = Connection.retrieve("id")
|
30
|
+
id = connection.id.gsub(/\s+/, "+").freeze
|
31
|
+
connection.active_calls
|
32
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/connections/#{id}/active_calls"
|
33
|
+
end
|
27
34
|
end
|
28
35
|
end
|
@@ -8,7 +8,7 @@ module Telnyx
|
|
8
8
|
credential_connections = CredentialConnection.list
|
9
9
|
assert_requested :get, "#{Telnyx.api_base}/v2/credential_connections"
|
10
10
|
assert_kind_of ListObject, credential_connections
|
11
|
-
assert_kind_of
|
11
|
+
assert_kind_of TelnyxObject, credential_connections.first
|
12
12
|
end
|
13
13
|
|
14
14
|
should "create credential connection" do
|
@@ -28,17 +28,18 @@ module Telnyx
|
|
28
28
|
|
29
29
|
should "delete credential connection" do
|
30
30
|
credential_connection = CredentialConnection.retrieve("id")
|
31
|
-
|
31
|
+
id = credential_connection.id.gsub(/\s+/, "+").freeze
|
32
32
|
credential_connection.delete
|
33
|
-
assert_requested :delete, "#{Telnyx.api_base}/v2/credential_connections
|
33
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/credential_connections/#{id}"
|
34
34
|
end
|
35
35
|
|
36
36
|
should "update credential connection" do
|
37
37
|
credential_connection = CredentialConnection.retrieve("id")
|
38
38
|
|
39
39
|
credential_connection.active = false
|
40
|
+
id = credential_connection.id.gsub(/\s+/, "+").freeze
|
40
41
|
credential_connection.save
|
41
|
-
assert_requested :patch, "#{Telnyx.api_base}/v2/credential_connections
|
42
|
+
assert_requested :patch, "#{Telnyx.api_base}/v2/credential_connections/#{id}"
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CsvDownloadTest < Test::Unit::TestCase
|
7
|
+
should "list csv_downloads" do
|
8
|
+
csv_downloads = CsvDownload.list
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads"
|
10
|
+
assert_kind_of ListObject, csv_downloads
|
11
|
+
assert csv_downloads.first.is_a?(CsvDownload) ||
|
12
|
+
csv_downloads.first.is_a?(TelnyxObject),
|
13
|
+
"Unexpected type: #{csv_downloads.first.class}"
|
14
|
+
end
|
15
|
+
|
16
|
+
should "retrieve a csv_download" do
|
17
|
+
omit "ID req mismatch"
|
18
|
+
csv = CsvDownload.retrieve("quasi")
|
19
|
+
omit "ID req mismatch, 'keys"
|
20
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads/quasi"
|
21
|
+
assert csv.is_a?(CsvDownload) ||
|
22
|
+
csv.is_a?(IPCsvDownload) ||
|
23
|
+
csv.is_a?(CredentialCsvDownload),
|
24
|
+
"Unexpected type: #{csv.class}"
|
25
|
+
end
|
26
|
+
|
27
|
+
should "create a csv_download" do
|
28
|
+
omit "ID req mismatch"
|
29
|
+
CsvDownload.create
|
30
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class CustomStorageCredentialTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@connection_id = "d25f43b3-aea3-6a5d-7a1b-d83e5c100cce".freeze
|
9
|
+
end
|
10
|
+
|
11
|
+
should "retrieve Custom Storage Credential" do
|
12
|
+
custom = CustomStorageCredential.retrieve @connection_id
|
13
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/custom_storage_credentials/#{@connection_id}")
|
14
|
+
assert custom.is_a?(CustomStorageCredential)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class DetailRecordTest < Test::Unit::TestCase
|
7
|
+
should "be listable" do
|
8
|
+
omit "Internal req test"
|
9
|
+
detail_records = DetailRecord.list
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/detail_records"
|
11
|
+
assert detail_records.is_a?(ListObject)
|
12
|
+
assert detail_records[:data].is_a?(Array)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
|
5
|
+
module Telnyx
|
6
|
+
class DialogflowConnectionTest < Test::Unit::TestCase
|
7
|
+
setup do
|
8
|
+
@flow = DialogflowConnection.create(
|
9
|
+
connection_id: "Foo",
|
10
|
+
service_account:
|
11
|
+
{ type: "service_account",
|
12
|
+
project_id: "your-project-id",
|
13
|
+
private_key_id: "your-private-key",
|
14
|
+
private_key: "-----BEGIN PRIVATE KEY-----n-----END PRIVATE",
|
15
|
+
client_email: "example@example.com", "client_id": "your-client-id",
|
16
|
+
auth_uri: "http://example.com", "token_uri": "http://example.com",
|
17
|
+
auth_provider_x509_cert_url: "http://example.com",
|
18
|
+
client_x509_cert_url: "http://example.com" }
|
19
|
+
)
|
20
|
+
@con_id = @flow.connection_id.gsub(/\s+/, "+").freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
should "be creatable" do
|
24
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/dialogflow_connections/Foo"
|
25
|
+
end
|
26
|
+
|
27
|
+
should "be retrievable" do
|
28
|
+
DialogflowConnection.retrieve(@con_id)
|
29
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/dialogflow_connections/#{@con_id}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|