telnyx 0.1.0 → 2.6.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 +9 -0
- data/.github/workflows/ruby.yml +39 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +6 -36
- data/.rubocop_todo.yml +300 -0
- data/.travis.yml.bak +48 -0
- data/Gemfile +6 -6
- data/README.md +2 -1
- data/VERSION +1 -1
- data/bin/telnyx-console +5 -0
- data/examples/2 factor authentication/Gemfile +7 -0
- data/examples/2 factor authentication/main.rb +67 -0
- data/examples/2 factor authentication/readme.md +5 -0
- data/examples/fax/Gemfile +7 -0
- data/examples/fax/config.yaml +4 -0
- data/examples/fax/fax.rb +42 -0
- data/examples/fax/options.rb +41 -0
- data/examples/fax/readme.md +18 -0
- data/lib/telnyx.rb +6 -1
- data/lib/telnyx/api_operations/save.rb +1 -1
- data/lib/telnyx/api_resource.rb +14 -3
- data/lib/telnyx/call.rb +3 -1
- data/lib/telnyx/conference.rb +17 -1
- data/lib/telnyx/fax.rb +13 -0
- data/lib/telnyx/fax_application.rb +12 -0
- data/lib/telnyx/messaging_phone_number.rb +9 -0
- data/lib/telnyx/number_lookup.rb +7 -0
- data/lib/telnyx/phone_number.rb +9 -1
- data/lib/telnyx/phone_number_regulatory_requirement.rb +1 -0
- data/lib/telnyx/sim_card.rb +12 -1
- data/lib/telnyx/telnyx_client.rb +16 -25
- data/lib/telnyx/util.rb +12 -6
- data/lib/telnyx/verification.rb +27 -0
- data/lib/telnyx/verify_profile.rb +11 -0
- data/lib/telnyx/version.rb +1 -1
- data/telnyx.gemspec +2 -2
- data/test/telnyx/call_control_test.rb +54 -30
- data/test/telnyx/conference_test.rb +57 -20
- data/test/telnyx/credential_connection_test.rb +5 -1
- data/test/telnyx/fax_application_test.rb +32 -0
- data/test/telnyx/fax_test.rb +32 -0
- data/test/telnyx/fqdn_connection_test.rb +1 -1
- data/test/telnyx/fqdn_test.rb +1 -1
- data/test/telnyx/messaging_phone_number_test.rb +8 -4
- data/test/telnyx/messaging_profile_test.rb +1 -1
- data/test/telnyx/number_lookup_test.rb +18 -0
- data/test/telnyx/phone_number_regulatory_requirement_test.rb +1 -1
- data/test/telnyx/phone_number_test.rb +14 -21
- data/test/telnyx/sim_card_test.rb +6 -6
- data/test/telnyx/telnyx_object_test.rb +5 -5
- data/test/telnyx/verification_test.rb +22 -0
- data/test/telnyx/verify_profile_test.rb +31 -0
- data/test/test_helper.rb +1 -1
- metadata +55 -12
- data/.travis.yml +0 -51
data/lib/telnyx/phone_number.rb
CHANGED
@@ -13,7 +13,7 @@ module Telnyx
|
|
13
13
|
instance_methods: { list: "voice" }
|
14
14
|
nested_resource_class_methods "messaging",
|
15
15
|
path: ["messaging"],
|
16
|
-
operations: %i[update list],
|
16
|
+
operations: %i[update list retrieve],
|
17
17
|
instance_methods: { list: "messaging" }
|
18
18
|
nested_resource_class_methods "inbound_channel",
|
19
19
|
path: ["inbound_channels"],
|
@@ -35,6 +35,14 @@ module Telnyx
|
|
35
35
|
self.class.list_inbound_channels(nil).channels
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.list_voice
|
39
|
+
list_voices nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.messaging
|
43
|
+
list_messagings(nil)
|
44
|
+
end
|
45
|
+
|
38
46
|
OBJECT_NAME = "phone_number".freeze
|
39
47
|
end
|
40
48
|
end
|
data/lib/telnyx/sim_card.rb
CHANGED
@@ -6,7 +6,7 @@ module Telnyx
|
|
6
6
|
extend APIOperations::NestedResource
|
7
7
|
extend APIOperations::List
|
8
8
|
|
9
|
-
ACTIONS = %w[
|
9
|
+
ACTIONS = %w[enable disable].freeze
|
10
10
|
ACTIONS.each do |action|
|
11
11
|
nested_resource_class_methods action,
|
12
12
|
path: %W[actions #{action}],
|
@@ -20,5 +20,16 @@ module Telnyx
|
|
20
20
|
end
|
21
21
|
|
22
22
|
OBJECT_NAME = "sim_card".freeze
|
23
|
+
|
24
|
+
# depreciated api
|
25
|
+
def activate
|
26
|
+
warn "[DEPRECATION] SimCard#activate is deprecated, use enable instead."
|
27
|
+
enable
|
28
|
+
end
|
29
|
+
|
30
|
+
def deactivate
|
31
|
+
warn "[DEPRECATION] SimCard#deactivate is deprecated, use enable instead."
|
32
|
+
disable
|
33
|
+
end
|
23
34
|
end
|
24
35
|
end
|
data/lib/telnyx/telnyx_client.rb
CHANGED
@@ -240,7 +240,7 @@ module Telnyx
|
|
240
240
|
end
|
241
241
|
|
242
242
|
case e
|
243
|
-
when Faraday::
|
243
|
+
when Faraday::Error
|
244
244
|
if e.response
|
245
245
|
handle_error_response(e.response, error_context)
|
246
246
|
else
|
@@ -310,30 +310,21 @@ module Telnyx
|
|
310
310
|
json_body: resp.data,
|
311
311
|
}
|
312
312
|
|
313
|
-
case resp.http_status
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
when 429
|
329
|
-
RateLimitError.new(error_list, opts)
|
330
|
-
when 500
|
331
|
-
APIError.new(error_list, opts)
|
332
|
-
when 503
|
333
|
-
ServiceUnavailableError.new(error_list, opts)
|
334
|
-
else
|
335
|
-
APIError.new(error_list, opts)
|
336
|
-
end
|
313
|
+
err_class = case resp.http_status
|
314
|
+
when 400 then InvalidRequestError
|
315
|
+
when 401 then AuthenticationError
|
316
|
+
when 403 then PermissionError
|
317
|
+
when 404 then ResourceNotFoundError
|
318
|
+
when 405 then MethodNotSupportedError
|
319
|
+
when 408 then TimeoutError
|
320
|
+
when 422 then InvalidParametersError
|
321
|
+
when 429 then RateLimitError
|
322
|
+
when 500 then APIError
|
323
|
+
when 503 then ServiceUnavailableError
|
324
|
+
else APIError
|
325
|
+
end
|
326
|
+
|
327
|
+
err_class.new(error_list, **opts)
|
337
328
|
end
|
338
329
|
|
339
330
|
def handle_network_error(e, context, num_retries, api_base = nil)
|
data/lib/telnyx/util.rb
CHANGED
@@ -48,27 +48,33 @@ module Telnyx
|
|
48
48
|
Conferences::OBJECT_NAME => Conferences,
|
49
49
|
Connection::OBJECT_NAME => Connection,
|
50
50
|
CredentialConnection::OBJECT_NAME => CredentialConnection,
|
51
|
-
|
51
|
+
Fax::OBJECT_NAME => Fax,
|
52
|
+
FaxApplication::OBJECT_NAME => FaxApplication,
|
52
53
|
FQDN::OBJECT_NAME => FQDN,
|
54
|
+
FQDNConnection::OBJECT_NAME => FQDNConnection,
|
53
55
|
IP::OBJECT_NAME => IP,
|
54
56
|
IPConnection::OBJECT_NAME => IPConnection,
|
55
57
|
Message::OBJECT_NAME => Message,
|
56
58
|
MessagingPhoneNumber::OBJECT_NAME => MessagingPhoneNumber,
|
59
|
+
"messaging_settings" => MessagingPhoneNumber,
|
57
60
|
MessagingProfile::OBJECT_NAME => MessagingProfile,
|
61
|
+
NumberLookup::OBJECT_NAME => NumberLookup,
|
58
62
|
NumberOrder::OBJECT_NAME => NumberOrder,
|
59
63
|
NumberOrderDocument::OBJECT_NAME => NumberOrderDocument,
|
60
|
-
"phone_number_reservation" => NumberReservation,
|
61
64
|
NumberReservation::OBJECT_NAME => NumberReservation,
|
65
|
+
OutboundVoiceProfile::OBJECT_NAME => OutboundVoiceProfile,
|
62
66
|
PhoneNumber::OBJECT_NAME => PhoneNumber,
|
67
|
+
"phone_number_reservation" => NumberReservation,
|
63
68
|
PhoneNumberRegulatoryRequirement::OBJECT_NAME => PhoneNumberRegulatoryRequirement,
|
64
69
|
"phone_number_regulatory_group" => PhoneNumberRegulatoryRequirement,
|
65
70
|
Portout::OBJECT_NAME => Portout,
|
71
|
+
VerifyProfile::OBJECT_NAME => VerifyProfile,
|
66
72
|
PublicKey::OBJECT_NAME => PublicKey,
|
67
|
-
WirelessDetailRecordsReport::OBJECT_NAME => WirelessDetailRecordsReport,
|
68
|
-
# 'phone_number_regulatory_group' => RegulatoryRequirement,
|
69
73
|
RegulatoryRequirement::OBJECT_NAME => RegulatoryRequirement,
|
70
74
|
SimCard::OBJECT_NAME => SimCard,
|
71
|
-
|
75
|
+
Verification::OBJECT_NAME => Verification,
|
76
|
+
"verification" => Verification::Response,
|
77
|
+
WirelessDetailRecordsReport::OBJECT_NAME => WirelessDetailRecordsReport,
|
72
78
|
}
|
73
79
|
end
|
74
80
|
|
@@ -86,7 +92,7 @@ module Telnyx
|
|
86
92
|
#
|
87
93
|
# ==== Attributes
|
88
94
|
#
|
89
|
-
# * +
|
95
|
+
# * +Data+ - Hash of fields and values to be converted into a TelnyxObject.
|
90
96
|
# * +opts+ - Options for +TelnyxObject+ like an API key that will be reused
|
91
97
|
# on subsequent API calls.
|
92
98
|
def self.convert_to_telnyx_object(data, opts = {})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telnyx
|
4
|
+
class Verification < APIResource
|
5
|
+
# Type for verification responses
|
6
|
+
class Response < TelnyxObject; end
|
7
|
+
|
8
|
+
extend APIOperations::Create
|
9
|
+
extend APIOperations::NestedResource
|
10
|
+
|
11
|
+
nested_resource_class_methods "by_telephone",
|
12
|
+
path: "by_tn",
|
13
|
+
operations: [:retrieve],
|
14
|
+
instance_methods: {
|
15
|
+
retrieve: "by_telephone",
|
16
|
+
}
|
17
|
+
|
18
|
+
def self.submit_code(phone_number: nil, code: nil)
|
19
|
+
url = "#{resource_url}/by_phone_number/#{CGI.escape phone_number}/actions/verify"
|
20
|
+
resp, _opts = request(:post, url, code: code)
|
21
|
+
Response.construct_from resp.data[:data]
|
22
|
+
end
|
23
|
+
|
24
|
+
OBJECT_NAME = "verify_verification".freeze
|
25
|
+
RESOURCE_PATH = "verifications".freeze
|
26
|
+
end
|
27
|
+
end
|
data/lib/telnyx/version.rb
CHANGED
data/telnyx.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
"source_code_uri" => "https://github.com/team-telnyx/telnyx-ruby",
|
23
23
|
}
|
24
24
|
|
25
|
-
s.add_dependency("faraday", "
|
26
|
-
s.add_dependency("net-http-persistent", "
|
25
|
+
s.add_dependency("faraday", ">= 0.13", "< 2.0", "!= 0.16.0", "!= 0.16.1", "!= 0.16.2", "!= 0.17.1")
|
26
|
+
s.add_dependency("net-http-persistent", ">= 3.0", "< 5.0")
|
27
27
|
s.add_dependency("ed25519", "~> 1")
|
28
28
|
|
29
29
|
s.files = `git ls-files`.split("\n")
|
@@ -66,95 +66,119 @@ module Telnyx
|
|
66
66
|
should "send all commands" do
|
67
67
|
@call = Call.new
|
68
68
|
@call.id = "1234"
|
69
|
-
@call.reject
|
70
|
-
assert_requested :post,
|
69
|
+
@call.reject cause: "CALL_REJECTED"
|
70
|
+
assert_requested :post, format_action_url(@call, "reject")
|
71
71
|
@call.answer
|
72
|
-
assert_requested :post,
|
72
|
+
assert_requested :post, format_action_url(@call, "answer")
|
73
73
|
@call.hangup
|
74
|
-
assert_requested :post,
|
74
|
+
assert_requested :post, format_action_url(@call, "hangup")
|
75
75
|
@call.bridge call_control_id: SecureRandom.base64(20)
|
76
|
-
assert_requested :post,
|
76
|
+
assert_requested :post, format_action_url(@call, "bridge")
|
77
77
|
@call.speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
78
|
-
assert_requested :post,
|
78
|
+
assert_requested :post, format_action_url(@call, "speak")
|
79
79
|
@call.fork_start call_control_id: SecureRandom.base64(20)
|
80
|
-
assert_requested :post,
|
80
|
+
assert_requested :post, format_action_url(@call, "fork_start")
|
81
81
|
@call.fork_stop
|
82
|
-
assert_requested :post,
|
82
|
+
assert_requested :post, format_action_url(@call, "fork_stop")
|
83
83
|
@call.gather_using_audio audio_url: "https://audio.example.com"
|
84
|
-
assert_requested :post,
|
84
|
+
assert_requested :post, format_action_url(@call, "gather_using_audio")
|
85
85
|
@call.gather_using_speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
86
|
-
assert_requested :post,
|
86
|
+
assert_requested :post, format_action_url(@call, "gather_using_speak")
|
87
87
|
@call.playback_start audio_url: "https://audio.example.com"
|
88
|
-
assert_requested :post,
|
88
|
+
assert_requested :post, format_action_url(@call, "playback_start")
|
89
89
|
@call.playback_stop
|
90
|
-
assert_requested :post,
|
90
|
+
assert_requested :post, format_action_url(@call, "playback_stop")
|
91
91
|
@call.send_dtmf digits: "1www2WABCDw9"
|
92
|
-
assert_requested :post,
|
92
|
+
assert_requested :post, format_action_url(@call, "send_dtmf")
|
93
93
|
@call.transfer to: "+15552223333"
|
94
|
-
assert_requested :post,
|
94
|
+
assert_requested :post, format_action_url(@call, "transfer")
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
context "commands" do
|
99
99
|
should "reject" do
|
100
|
-
@call.reject
|
101
|
-
assert_requested :post,
|
100
|
+
@call.reject cause: "CALL_REJECTED"
|
101
|
+
assert_requested :post, format_action_url(@call, "reject")
|
102
102
|
end
|
103
103
|
should "answer" do
|
104
104
|
@call.answer
|
105
|
-
assert_requested :post,
|
105
|
+
assert_requested :post, format_action_url(@call, "answer")
|
106
106
|
end
|
107
107
|
should "hangup" do
|
108
108
|
@call.hangup
|
109
|
-
assert_requested :post,
|
109
|
+
assert_requested :post, format_action_url(@call, "hangup")
|
110
110
|
end
|
111
111
|
should "bridge" do
|
112
112
|
@call.bridge call_control_id: SecureRandom.base64(20)
|
113
|
-
assert_requested :post,
|
113
|
+
assert_requested :post, format_action_url(@call, "bridge")
|
114
114
|
end
|
115
115
|
should "speak" do
|
116
116
|
@call.speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
117
|
-
assert_requested :post,
|
117
|
+
assert_requested :post, format_action_url(@call, "speak")
|
118
118
|
end
|
119
119
|
should "start fork" do
|
120
120
|
@call.fork_start call_control_id: SecureRandom.base64(20)
|
121
|
-
assert_requested :post,
|
121
|
+
assert_requested :post, format_action_url(@call, "fork_start")
|
122
122
|
end
|
123
123
|
should "stop fork" do
|
124
124
|
@call.fork_stop
|
125
|
-
assert_requested :post,
|
125
|
+
assert_requested :post, format_action_url(@call, "fork_stop")
|
126
126
|
end
|
127
127
|
should "gather using audio" do
|
128
128
|
@call.gather_using_audio audio_url: "https://audio.example.com"
|
129
|
-
assert_requested :post,
|
129
|
+
assert_requested :post, format_action_url(@call, "gather_using_audio")
|
130
130
|
end
|
131
131
|
should "gather using speak" do
|
132
132
|
@call.gather_using_speak language: "en-US", voice: "female", payload: "Telnyx call control test"
|
133
|
-
assert_requested :post,
|
133
|
+
assert_requested :post, format_action_url(@call, "gather_using_speak")
|
134
134
|
end
|
135
135
|
should "playback start" do
|
136
136
|
@call.playback_start audio_url: "https://audio.example.com"
|
137
|
-
assert_requested :post,
|
137
|
+
assert_requested :post, format_action_url(@call, "playback_start")
|
138
138
|
end
|
139
139
|
should "playback stop" do
|
140
140
|
@call.playback_stop
|
141
|
-
assert_requested :post,
|
141
|
+
assert_requested :post, format_action_url(@call, "playback_stop")
|
142
142
|
end
|
143
143
|
should "send dtmf" do
|
144
144
|
@call.send_dtmf digits: "1www2WABCDw9"
|
145
|
-
assert_requested :post,
|
145
|
+
assert_requested :post, format_action_url(@call, "send_dtmf")
|
146
146
|
end
|
147
147
|
should "transfer" do
|
148
148
|
@call.transfer to: "+15552223333"
|
149
|
-
assert_requested :post,
|
149
|
+
assert_requested :post, format_action_url(@call, "transfer")
|
150
|
+
end
|
151
|
+
should "start transcription" do
|
152
|
+
@call.transcription_start
|
153
|
+
assert_requested :post, format_action_url(@call, "transcription_start")
|
154
|
+
end
|
155
|
+
should "end transcription" do
|
156
|
+
@call.transcription_stop
|
157
|
+
assert_requested :post, format_action_url(@call, "transcription_stop")
|
158
|
+
end
|
159
|
+
should "pause recording" do
|
160
|
+
@call.record_pause
|
161
|
+
assert_requested :post, format_action_url(@call, "record_pause")
|
162
|
+
end
|
163
|
+
should "resume recording" do
|
164
|
+
@call.record_resume
|
165
|
+
assert_requested :post, format_action_url(@call, "record_resume")
|
166
|
+
end
|
167
|
+
should "gather stop" do
|
168
|
+
@call.gather_stop
|
169
|
+
assert_requested :post, format_action_url(@call, "gather_stop")
|
170
|
+
end
|
171
|
+
should "refer" do
|
172
|
+
@call.refer sip_address: "sip:username@sip.non-telnyx-address.com"
|
173
|
+
assert_requested :post, format_action_url(@call, "refer")
|
150
174
|
end
|
151
175
|
end
|
152
176
|
|
153
177
|
def create_call
|
154
|
-
Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222"
|
178
|
+
Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222", cause: "test"
|
155
179
|
end
|
156
180
|
|
157
|
-
def
|
181
|
+
def format_action_url(call, action)
|
158
182
|
"#{Telnyx.api_base}/v2/calls/#{call.call_control_id}/actions/#{action}"
|
159
183
|
end
|
160
184
|
end
|
@@ -5,14 +5,19 @@ require_relative "../test_helper"
|
|
5
5
|
module Telnyx
|
6
6
|
class ConferenceTest < Test::Unit::TestCase
|
7
7
|
setup do
|
8
|
-
@
|
9
|
-
@conference = Conference.create call_control_id: @call.id, name: "conference!"
|
8
|
+
@conference = Conference.create call_control_id: "foobar", name: "conference!"
|
10
9
|
end
|
11
10
|
should "create conference" do
|
12
11
|
assert_requested :post, "#{Telnyx.api_base}/v2/conferences"
|
13
12
|
assert_kind_of Conference, @conference
|
14
13
|
end
|
15
14
|
|
15
|
+
should "retrieve conference" do
|
16
|
+
conference = Conference.retrieve "foobar"
|
17
|
+
assert_kind_of Conference, conference
|
18
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/conferences/foobar"
|
19
|
+
end
|
20
|
+
|
16
21
|
should "list conferences" do
|
17
22
|
conferences = Conference.list
|
18
23
|
|
@@ -21,47 +26,79 @@ module Telnyx
|
|
21
26
|
assert_kind_of Conference, conferences.first
|
22
27
|
end
|
23
28
|
|
29
|
+
should "list participants" do
|
30
|
+
participants = @conference.participants
|
31
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/conferences/#{@conference.id}/participants"
|
32
|
+
assert_kind_of ListObject, participants
|
33
|
+
end
|
34
|
+
|
24
35
|
should "have nested command instance methods" do
|
25
36
|
assert defined? @conference.join
|
26
37
|
assert defined? @conference.mute
|
27
38
|
assert defined? @conference.unmute
|
28
39
|
assert defined? @conference.unhold
|
40
|
+
assert defined? @conference.play
|
41
|
+
assert defined? @conference.start_recording
|
42
|
+
assert defined? @conference.stop_recording
|
43
|
+
assert defined? @conference.speak
|
44
|
+
assert defined? @conference.dial_participant
|
45
|
+
assert defined? @conference.update
|
29
46
|
end
|
30
47
|
|
31
48
|
context "commands" do
|
32
49
|
should "join" do
|
33
|
-
|
34
|
-
|
35
|
-
@conference.join
|
36
|
-
assert_requested stub
|
50
|
+
@conference.join call_control_id: "foo_bar_baz"
|
51
|
+
assert_requested :post, action_url(@conference, "join")
|
37
52
|
end
|
38
53
|
|
39
54
|
should "mute" do
|
40
|
-
stub = stub_request(:post, format_url(@conference, "mute"))
|
41
|
-
.to_return(body: JSON.generate(result: "ok"))
|
42
55
|
@conference.mute
|
43
|
-
assert_requested
|
56
|
+
assert_requested :post, action_url(@conference, "mute")
|
44
57
|
end
|
45
58
|
|
46
59
|
should "unmute" do
|
47
|
-
stub = stub_request(:post, format_url(@conference, "unmute"))
|
48
|
-
.to_return(body: JSON.generate(result: "ok"))
|
49
60
|
@conference.unmute
|
50
|
-
assert_requested
|
61
|
+
assert_requested :post, action_url(@conference, "unmute")
|
51
62
|
end
|
52
63
|
|
53
64
|
should "hold" do
|
54
|
-
stub = stub_request(:post, format_url(@conference, "hold"))
|
55
|
-
.to_return(body: JSON.generate(result: "ok"))
|
56
65
|
@conference.hold
|
57
|
-
assert_requested
|
66
|
+
assert_requested :post, action_url(@conference, "hold")
|
58
67
|
end
|
59
68
|
|
60
69
|
should "unhold" do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
70
|
+
@conference.unhold call_control_ids: %w[foo bar baz]
|
71
|
+
assert_requested :post, action_url(@conference, "unhold")
|
72
|
+
end
|
73
|
+
|
74
|
+
should "play" do
|
75
|
+
@conference.play audio_url: "https://example.com/audio.mp3"
|
76
|
+
assert_requested :post, action_url(@conference, "play")
|
77
|
+
end
|
78
|
+
|
79
|
+
should "start recording" do
|
80
|
+
@conference.start_recording channels: "dual", format: "mp3"
|
81
|
+
assert_requested :post, action_url(@conference, "record_start")
|
82
|
+
end
|
83
|
+
|
84
|
+
should "stop recording" do
|
85
|
+
@conference.stop_recording
|
86
|
+
assert_requested :post, action_url(@conference, "record_stop")
|
87
|
+
end
|
88
|
+
|
89
|
+
should "speak" do
|
90
|
+
@conference.speak language: "en-US", payload: "test speech", voice: "female"
|
91
|
+
assert_requested :post, action_url(@conference, "speak")
|
92
|
+
end
|
93
|
+
|
94
|
+
should "dial participant" do
|
95
|
+
@conference.dial_participant call_control_id: "foo", to: "+12223334444", from: "+12223335555"
|
96
|
+
assert_requested :post, action_url(@conference, "dial_participant")
|
97
|
+
end
|
98
|
+
|
99
|
+
should "update" do
|
100
|
+
@conference.update call_control_id: "foo"
|
101
|
+
assert_requested :post, action_url(@conference, "update")
|
65
102
|
end
|
66
103
|
end
|
67
104
|
|
@@ -69,7 +106,7 @@ module Telnyx
|
|
69
106
|
Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222"
|
70
107
|
end
|
71
108
|
|
72
|
-
def
|
109
|
+
def action_url(conf, action)
|
73
110
|
"#{Telnyx.api_base}/v2/conferences/#{conf.id}/actions/#{action}"
|
74
111
|
end
|
75
112
|
end
|