bandwidth-sdk 18.1.4 → 18.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -24
- data/README.md +2 -0
- data/bandwidth.yml +65 -4
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1167 -384
- data/coverage/index.html +15779 -7307
- data/custom_templates/configuration.mustache +6 -2
- data/custom_templates/gem.mustache +1 -0
- data/docs/AnswerCallback.md +1 -1
- data/docs/BridgeCompleteCallback.md +1 -1
- data/docs/BridgeTargetCompleteCallback.md +1 -1
- data/docs/ConferenceCompletedCallback.md +1 -1
- data/docs/ConferenceCreatedCallback.md +1 -1
- data/docs/ConferenceMemberExitCallback.md +1 -1
- data/docs/ConferenceMemberJoinCallback.md +1 -1
- data/docs/ConferenceRecordingAvailableCallback.md +1 -1
- data/docs/ConferenceRedirectCallback.md +1 -1
- data/docs/DisconnectCallback.md +1 -1
- data/docs/DtmfCallback.md +1 -1
- data/docs/GatherCallback.md +1 -1
- data/docs/InitiateCallback.md +1 -1
- data/docs/MachineDetectionCompleteCallback.md +1 -1
- data/docs/MediaApi.md +6 -6
- data/docs/RbmActionBase.md +1 -1
- data/docs/RbmSuggestionResponse.md +1 -1
- data/docs/RecordingAvailableCallback.md +1 -1
- data/docs/RecordingCompleteCallback.md +1 -1
- data/docs/RedirectCallback.md +1 -1
- data/docs/ReferCallStatusEnum.md +15 -0
- data/docs/ReferCompleteCallback.md +46 -0
- data/docs/TranscriptionAvailableCallback.md +1 -1
- data/docs/TransferAnswerCallback.md +1 -1
- data/docs/TransferCompleteCallback.md +1 -1
- data/docs/TransferDisconnectCallback.md +1 -1
- data/lib/bandwidth-sdk/api/media_api.rb +6 -6
- data/lib/bandwidth-sdk/configuration.rb +6 -2
- data/lib/bandwidth-sdk/models/answer_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/bxml/verbs/connect.rb +23 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/endpoint.rb +11 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/forward.rb +2 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +22 -14
- data/lib/bandwidth-sdk/models/bxml/verbs/record.rb +2 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/refer.rb +24 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/sip_uri.rb +3 -1
- data/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb +2 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +2 -2
- data/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb +2 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +1 -0
- data/lib/bandwidth-sdk/models/conference_completed_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/conference_created_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/disconnect_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/dtmf_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/gather_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/initiate_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/recording_available_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/recording_complete_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/redirect_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/refer_call_status_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/refer_complete_callback.rb +309 -0
- data/lib/bandwidth-sdk/models/transcription_available_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +1 -1
- data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +1 -1
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/lib/bandwidth-sdk.rb +5 -0
- data/spec/smoke/media_api_spec.rb +2 -2
- data/spec/smoke/messages_api_spec.rb +2 -2
- data/spec/unit/api/calls_api_spec.rb +1 -2
- data/spec/unit/api/conferences_api_spec.rb +1 -2
- data/spec/unit/api/endpoints_api_spec.rb +1 -2
- data/spec/unit/api/media_api_spec.rb +1 -2
- data/spec/unit/api/messages_api_spec.rb +1 -2
- data/spec/unit/api/mfa_api_spec.rb +1 -2
- data/spec/unit/api/multi_channel_api_spec.rb +1 -2
- data/spec/unit/api/phone_number_lookup_api_spec.rb +1 -2
- data/spec/unit/api/recordings_api_spec.rb +1 -2
- data/spec/unit/api/statistics_api_spec.rb +1 -2
- data/spec/unit/api/toll_free_verification_api_spec.rb +1 -2
- data/spec/unit/api/transcriptions_api_spec.rb +1 -2
- data/spec/unit/models/bxml/verbs/connect_spec.rb +62 -0
- data/spec/unit/models/bxml/verbs/endpoint_spec.rb +16 -0
- data/spec/unit/models/bxml/verbs/forward_spec.rb +6 -2
- data/spec/unit/models/bxml/verbs/gather_spec.rb +23 -7
- data/spec/unit/models/bxml/verbs/record_spec.rb +8 -4
- data/spec/unit/models/bxml/verbs/refer_spec.rb +54 -0
- data/spec/unit/models/bxml/verbs/start_recording_spec.rb +8 -4
- data/spec/unit/models/bxml/verbs/start_stream_spec.rb +5 -5
- data/spec/unit/models/bxml/verbs/start_transcription_spec.rb +11 -7
- data/spec/unit/models/bxml/verbs/transfer_spec.rb +7 -5
- data/spec/unit/models/refer_call_status_enum_spec.rb +31 -0
- data/spec/unit/models/refer_complete_callback_spec.rb +123 -0
- metadata +19 -2
|
@@ -4,6 +4,8 @@ describe 'Bandwidth::Bxml::Forward' do
|
|
|
4
4
|
{
|
|
5
5
|
to: '+19195551234',
|
|
6
6
|
from: '+19195554321',
|
|
7
|
+
privacy: true,
|
|
8
|
+
caller_display_name: 'Restricted',
|
|
7
9
|
call_timeout: 5,
|
|
8
10
|
diversion_treatment: 'propagate',
|
|
9
11
|
diversion_reason: 'user-busy',
|
|
@@ -15,6 +17,8 @@ describe 'Bandwidth::Bxml::Forward' do
|
|
|
15
17
|
{
|
|
16
18
|
to: '+19195554321',
|
|
17
19
|
from: '+19195551234',
|
|
20
|
+
privacy: false,
|
|
21
|
+
caller_display_name: 'new_display_name',
|
|
18
22
|
call_timeout: 10,
|
|
19
23
|
diversion_treatment: 'stack',
|
|
20
24
|
diversion_reason: 'no-answer',
|
|
@@ -31,13 +35,13 @@ describe 'Bandwidth::Bxml::Forward' do
|
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
it 'tests the to_bxml method of the Forward instance' do
|
|
34
|
-
expected = "\n<Forward to=\"+19195551234\" from=\"+19195554321\" callTimeout=\"5\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\" uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\"/>\n"
|
|
38
|
+
expected = "\n<Forward to=\"+19195551234\" from=\"+19195554321\" privacy=\"true\" callerDisplayName=\"Restricted\" callTimeout=\"5\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\" uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\"/>\n"
|
|
35
39
|
expect(instance.to_bxml).to eq(expected)
|
|
36
40
|
end
|
|
37
41
|
|
|
38
42
|
it 'tests the set_attributes method of the Forward instance' do
|
|
39
43
|
instance.set_attributes(new_attributes)
|
|
40
|
-
expected = "\n<Forward to=\"+19195554321\" from=\"+19195551234\" callTimeout=\"10\" diversionTreatment=\"stack\" diversionReason=\"no-answer\" uui=\"4fa28015d8ede84bd1a493d6f3c0be5845960b74;encoding=base64,fdsa;encoding=jwt\"/>\n"
|
|
44
|
+
expected = "\n<Forward to=\"+19195554321\" from=\"+19195551234\" privacy=\"false\" callerDisplayName=\"new_display_name\" callTimeout=\"10\" diversionTreatment=\"stack\" diversionReason=\"no-answer\" uui=\"4fa28015d8ede84bd1a493d6f3c0be5845960b74;encoding=base64,fdsa;encoding=jwt\"/>\n"
|
|
41
45
|
expect(instance.to_bxml).to eq(expected)
|
|
42
46
|
end
|
|
43
47
|
end
|
|
@@ -15,7 +15,15 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
|
15
15
|
max_digits: 5,
|
|
16
16
|
inter_digit_timeout: 5,
|
|
17
17
|
first_digit_timeout: 5,
|
|
18
|
-
repeat_count: 5
|
|
18
|
+
repeat_count: 5,
|
|
19
|
+
input: 'dtmf',
|
|
20
|
+
hints: 'initial_hints',
|
|
21
|
+
language: 'en-US',
|
|
22
|
+
partial_result_callback: 'https://initial.com',
|
|
23
|
+
partial_result_callback_method: 'POST',
|
|
24
|
+
profanity_filter: true,
|
|
25
|
+
speech_model: 'default',
|
|
26
|
+
speech_timeout: 5
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
|
|
@@ -34,7 +42,15 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
|
34
42
|
max_digits: 10,
|
|
35
43
|
inter_digit_timeout: 10,
|
|
36
44
|
first_digit_timeout: 10,
|
|
37
|
-
repeat_count: 10
|
|
45
|
+
repeat_count: 10,
|
|
46
|
+
input: 'speech',
|
|
47
|
+
hints: 'new_hints',
|
|
48
|
+
language: 'es-US',
|
|
49
|
+
partial_result_callback: 'https://new.com',
|
|
50
|
+
partial_result_callback_method: 'GET',
|
|
51
|
+
profanity_filter: false,
|
|
52
|
+
speech_model: 'phone_call',
|
|
53
|
+
speech_timeout: 10
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
56
|
|
|
@@ -51,13 +67,13 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
|
51
67
|
end
|
|
52
68
|
|
|
53
69
|
it 'tests the to_bxml method of the Gather instance' do
|
|
54
|
-
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\"/>\n"
|
|
70
|
+
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\" input=\"dtmf\" hints=\"initial_hints\" language=\"en-US\" partialResultCallback=\"https://initial.com\" partialResultCallbackMethod=\"POST\" profanityFilter=\"true\" speechModel=\"default\" speechTimeout=\"5\"/>\n"
|
|
55
71
|
expect(instance.to_bxml).to eq(expected)
|
|
56
72
|
end
|
|
57
73
|
|
|
58
74
|
it 'tests the set_attributes method of the Gather instance' do
|
|
59
75
|
instance.set_attributes(new_attributes)
|
|
60
|
-
expected = "\n<Gather gatherUrl=\"https://new.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://new.com\" gatherFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"10\" maxDigits=\"10\" interDigitTimeout=\"10\" firstDigitTimeout=\"10\" repeatCount=\"10\"/>\n"
|
|
76
|
+
expected = "\n<Gather gatherUrl=\"https://new.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://new.com\" gatherFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"10\" maxDigits=\"10\" interDigitTimeout=\"10\" firstDigitTimeout=\"10\" repeatCount=\"10\" input=\"speech\" hints=\"new_hints\" language=\"es-US\" partialResultCallback=\"https://new.com\" partialResultCallbackMethod=\"GET\" profanityFilter=\"false\" speechModel=\"phone_call\" speechTimeout=\"10\"/>\n"
|
|
61
77
|
expect(instance.to_bxml).to eq(expected)
|
|
62
78
|
end
|
|
63
79
|
end
|
|
@@ -69,16 +85,16 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
|
69
85
|
end
|
|
70
86
|
|
|
71
87
|
it 'tests the to_bxml method of the nested Gather instance' do
|
|
72
|
-
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
|
|
88
|
+
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\" input=\"dtmf\" hints=\"initial_hints\" language=\"en-US\" partialResultCallback=\"https://initial.com\" partialResultCallbackMethod=\"POST\" profanityFilter=\"true\" speechModel=\"default\" speechTimeout=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
|
|
73
89
|
expect(instance_nested.to_bxml).to eq(expected)
|
|
74
90
|
end
|
|
75
91
|
|
|
76
92
|
it 'tests the add_verb method of the nested Gather instance' do
|
|
77
|
-
expected_single = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n</Gather>\n"
|
|
93
|
+
expected_single = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\" input=\"dtmf\" hints=\"initial_hints\" language=\"en-US\" partialResultCallback=\"https://initial.com\" partialResultCallbackMethod=\"POST\" profanityFilter=\"true\" speechModel=\"default\" speechTimeout=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n</Gather>\n"
|
|
78
94
|
instance_nested.add_audio_verbs(speak_sentence)
|
|
79
95
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
|
80
96
|
|
|
81
|
-
expected_multiple = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
|
|
97
|
+
expected_multiple = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\" input=\"dtmf\" hints=\"initial_hints\" language=\"en-US\" partialResultCallback=\"https://initial.com\" partialResultCallbackMethod=\"POST\" profanityFilter=\"true\" speechModel=\"default\" speechTimeout=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
|
|
82
98
|
instance_nested.add_audio_verbs([speak_sentence, play_audio])
|
|
83
99
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
|
84
100
|
end
|
|
@@ -9,6 +9,7 @@ describe 'Bandwidth::Bxml::Record' do
|
|
|
9
9
|
recording_available_url: 'https://initial.com',
|
|
10
10
|
recording_available_method: 'POST',
|
|
11
11
|
transcribe: true,
|
|
12
|
+
detect_language: true,
|
|
12
13
|
transcription_available_url: 'https://initial.com',
|
|
13
14
|
transcription_available_method: 'POST',
|
|
14
15
|
username: 'initial_username',
|
|
@@ -19,7 +20,8 @@ describe 'Bandwidth::Bxml::Record' do
|
|
|
19
20
|
terminating_digits: '5',
|
|
20
21
|
max_duration: 5,
|
|
21
22
|
silence_timeout: 5,
|
|
22
|
-
file_format: 'wav'
|
|
23
|
+
file_format: 'wav',
|
|
24
|
+
recording_name: 'initial_recording_name'
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -32,6 +34,7 @@ describe 'Bandwidth::Bxml::Record' do
|
|
|
32
34
|
recording_available_url: 'https://new.com',
|
|
33
35
|
recording_available_method: 'GET',
|
|
34
36
|
transcribe: true,
|
|
37
|
+
detect_language: false,
|
|
35
38
|
transcription_available_url: 'https://new.com',
|
|
36
39
|
transcription_available_method: 'GET',
|
|
37
40
|
username: 'new_username',
|
|
@@ -42,7 +45,8 @@ describe 'Bandwidth::Bxml::Record' do
|
|
|
42
45
|
terminating_digits: '0',
|
|
43
46
|
max_duration: 10,
|
|
44
47
|
silence_timeout: 10,
|
|
45
|
-
file_format: 'mp3'
|
|
48
|
+
file_format: 'mp3',
|
|
49
|
+
recording_name: 'new_recording_name'
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -55,13 +59,13 @@ describe 'Bandwidth::Bxml::Record' do
|
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
it 'tests the to_bxml method of the Record instance' do
|
|
58
|
-
expected = "\n<Record recordCompleteUrl=\"https://initial.com\" recordCompleteMethod=\"POST\" recordCompleteFallbackUrl=\"https://initial.com\" recordCompleteFallbackMethod=\"POST\" recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDuration=\"5\" silenceTimeout=\"5\" fileFormat=\"wav\"/>\n"
|
|
62
|
+
expected = "\n<Record recordCompleteUrl=\"https://initial.com\" recordCompleteMethod=\"POST\" recordCompleteFallbackUrl=\"https://initial.com\" recordCompleteFallbackMethod=\"POST\" recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" detectLanguage=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDuration=\"5\" silenceTimeout=\"5\" fileFormat=\"wav\" recordingName=\"initial_recording_name\"/>\n"
|
|
59
63
|
expect(instance.to_bxml).to eq(expected)
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
it 'tests the set_attributes method of the Record instance' do
|
|
63
67
|
instance.set_attributes(new_attributes)
|
|
64
|
-
expected = "\n<Record recordCompleteUrl=\"https://new.com\" recordCompleteMethod=\"GET\" recordCompleteFallbackUrl=\"https://new.com\" recordCompleteFallbackMethod=\"GET\" recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"true\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"0\" maxDuration=\"10\" silenceTimeout=\"10\" fileFormat=\"mp3\"/>\n"
|
|
68
|
+
expected = "\n<Record recordCompleteUrl=\"https://new.com\" recordCompleteMethod=\"GET\" recordCompleteFallbackUrl=\"https://new.com\" recordCompleteFallbackMethod=\"GET\" recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"true\" detectLanguage=\"false\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"0\" maxDuration=\"10\" silenceTimeout=\"10\" fileFormat=\"mp3\" recordingName=\"new_recording_name\"/>\n"
|
|
65
69
|
expect(instance.to_bxml).to eq(expected)
|
|
66
70
|
end
|
|
67
71
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Unit tests for Bandwidth::Bxml::Refer
|
|
2
|
+
describe 'Bandwidth::Bxml::Refer' do
|
|
3
|
+
let(:initial_attributes) {
|
|
4
|
+
{
|
|
5
|
+
refer_complete_url: 'https://initial.com',
|
|
6
|
+
refer_complete_method: 'POST',
|
|
7
|
+
tag: 'initial_tag'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let(:new_attributes) {
|
|
12
|
+
{
|
|
13
|
+
refer_complete_url: 'https://new.com',
|
|
14
|
+
refer_complete_method: 'GET',
|
|
15
|
+
tag: 'new_tag'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let(:sip_uri) { Bandwidth::Bxml::SipUri.new('sip:alice@atlanta.example.com') }
|
|
20
|
+
|
|
21
|
+
let(:instance) { Bandwidth::Bxml::Refer.new([], initial_attributes) }
|
|
22
|
+
let(:instance_nested) { Bandwidth::Bxml::Refer.new(sip_uri, initial_attributes) }
|
|
23
|
+
|
|
24
|
+
describe 'test an instance of Refer' do
|
|
25
|
+
it 'validates instance of Refer' do
|
|
26
|
+
expect(instance).to be_instance_of(Bandwidth::Bxml::Refer)
|
|
27
|
+
expect(instance).to be_a(Bandwidth::Bxml::Verb)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'tests the set_attributes method of the Refer instance' do
|
|
31
|
+
instance.set_attributes(new_attributes)
|
|
32
|
+
expected = "\n<Refer referCompleteUrl=\"https://new.com\" referCompleteMethod=\"GET\" tag=\"new_tag\"/>\n"
|
|
33
|
+
expect(instance.to_bxml).to eq(expected)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'tests the set_sip_uri method of the Refer instance' do
|
|
37
|
+
instance.set_sip_uri(sip_uri)
|
|
38
|
+
expected = "\n<Refer referCompleteUrl=\"https://initial.com\" referCompleteMethod=\"POST\" tag=\"initial_tag\">\n <SipUri>sip:alice@atlanta.example.com</SipUri>\n</Refer>\n"
|
|
39
|
+
expect(instance.to_bxml).to eq(expected)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'test an instance of Refer with a nested SipUri' do
|
|
44
|
+
it 'validates instance of Refer' do
|
|
45
|
+
expect(instance_nested).to be_instance_of(Bandwidth::Bxml::Refer)
|
|
46
|
+
expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'tests the to_bxml method of the nested Refer instance' do
|
|
50
|
+
expected = "\n<Refer referCompleteUrl=\"https://initial.com\" referCompleteMethod=\"POST\" tag=\"initial_tag\">\n <SipUri>sip:alice@atlanta.example.com</SipUri>\n</Refer>\n"
|
|
51
|
+
expect(instance_nested.to_bxml).to eq(expected)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -5,13 +5,15 @@ describe 'Bandwidth::Bxml::StartRecording' do
|
|
|
5
5
|
recording_available_url: 'https://initial.com',
|
|
6
6
|
recording_available_method: 'POST',
|
|
7
7
|
transcribe: true,
|
|
8
|
+
detect_language: true,
|
|
8
9
|
transcription_available_url: 'https://initial.com',
|
|
9
10
|
transcription_available_method: 'POST',
|
|
10
11
|
username: 'initial_username',
|
|
11
12
|
password: 'initial_password',
|
|
12
13
|
tag: 'initial_tag',
|
|
13
14
|
file_format: 'wav',
|
|
14
|
-
multi_channel: true
|
|
15
|
+
multi_channel: true,
|
|
16
|
+
recording_name: 'initial_recording_name'
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -20,13 +22,15 @@ describe 'Bandwidth::Bxml::StartRecording' do
|
|
|
20
22
|
recording_available_url: 'https://new.com',
|
|
21
23
|
recording_available_method: 'GET',
|
|
22
24
|
transcribe: false,
|
|
25
|
+
detect_language: false,
|
|
23
26
|
transcription_available_url: 'https://new.com',
|
|
24
27
|
transcription_available_method: 'GET',
|
|
25
28
|
username: 'new_username',
|
|
26
29
|
password: 'new_password',
|
|
27
30
|
tag: 'new_tag',
|
|
28
31
|
file_format: 'mp3',
|
|
29
|
-
multi_channel: false
|
|
32
|
+
multi_channel: false,
|
|
33
|
+
recording_name: 'new_recording_name'
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
|
|
@@ -39,13 +43,13 @@ describe 'Bandwidth::Bxml::StartRecording' do
|
|
|
39
43
|
end
|
|
40
44
|
|
|
41
45
|
it 'tests the to_bxml method of the StartRecording instance' do
|
|
42
|
-
expected = "\n<StartRecording recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" tag=\"initial_tag\" fileFormat=\"wav\" multiChannel=\"true\"/>\n"
|
|
46
|
+
expected = "\n<StartRecording recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" detectLanguage=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" tag=\"initial_tag\" fileFormat=\"wav\" multiChannel=\"true\" recordingName=\"initial_recording_name\"/>\n"
|
|
43
47
|
expect(instance.to_bxml).to eq(expected)
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
it 'tests the set_attributes method of the StartRecording instance' do
|
|
47
51
|
instance.set_attributes(new_attributes)
|
|
48
|
-
expected = "\n<StartRecording recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"false\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" tag=\"new_tag\" fileFormat=\"mp3\" multiChannel=\"false\"/>\n"
|
|
52
|
+
expected = "\n<StartRecording recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"false\" detectLanguage=\"false\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" tag=\"new_tag\" fileFormat=\"mp3\" multiChannel=\"false\" recordingName=\"new_recording_name\"/>\n"
|
|
49
53
|
expect(instance.to_bxml).to eq(expected)
|
|
50
54
|
end
|
|
51
55
|
end
|
|
@@ -43,13 +43,13 @@ describe 'Bandwidth::Bxml::StartStream' do
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'tests the to_bxml method of the StartStream instance' do
|
|
46
|
-
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\"
|
|
46
|
+
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destinationUsername=\"initial_destination_username\" destinationPassword=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\"/>\n"
|
|
47
47
|
expect(instance.to_bxml).to eq(expected)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it 'tests the set_attributes method of the StartStream instance' do
|
|
51
51
|
instance.set_attributes(new_attributes)
|
|
52
|
-
expected = "\n<StartStream name=\"new_name\" mode=\"bidirectional\" tracks=\"outbound\" destination=\"https://new.com\"
|
|
52
|
+
expected = "\n<StartStream name=\"new_name\" mode=\"bidirectional\" tracks=\"outbound\" destination=\"https://new.com\" destinationUsername=\"new_destination_username\" destinationPassword=\"new_destination_password\" streamEventUrl=\"https://new.com\" streamEventMethod=\"GET\" username=\"new_username\" password=\"new_password\"/>\n"
|
|
53
53
|
expect(instance.to_bxml).to eq(expected)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
@@ -61,16 +61,16 @@ describe 'Bandwidth::Bxml::StartStream' do
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
it 'tests the to_bxml method of the nested StartStream instance' do
|
|
64
|
-
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\"
|
|
64
|
+
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destinationUsername=\"initial_destination_username\" destinationPassword=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n</StartStream>\n"
|
|
65
65
|
expect(instance_nested.to_bxml).to eq(expected)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it 'tests the add_stream_param method of the nested StartStream instance' do
|
|
69
|
-
expected_single = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\"
|
|
69
|
+
expected_single = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destinationUsername=\"initial_destination_username\" destinationPassword=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
|
|
70
70
|
instance_nested.add_stream_params(stream_param_2)
|
|
71
71
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
|
72
72
|
|
|
73
|
-
expected_multiple = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\"
|
|
73
|
+
expected_multiple = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destinationUsername=\"initial_destination_username\" destinationPassword=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
|
|
74
74
|
instance_nested.add_stream_params([stream_param_2, stream_param_2])
|
|
75
75
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
|
76
76
|
end
|
|
@@ -9,7 +9,9 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
|
9
9
|
username: 'initial_username',
|
|
10
10
|
password: 'initial_password',
|
|
11
11
|
destination: 'https://initial.com',
|
|
12
|
-
stabilized: true
|
|
12
|
+
stabilized: true,
|
|
13
|
+
detect_language: false,
|
|
14
|
+
preferred_languages: 'en-US'
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -22,7 +24,9 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
|
22
24
|
username: 'new_username',
|
|
23
25
|
password: 'new_password',
|
|
24
26
|
destination: 'https://new.com',
|
|
25
|
-
stabilized: false
|
|
27
|
+
stabilized: false,
|
|
28
|
+
detect_language: true,
|
|
29
|
+
preferred_languages: 'es-US'
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -39,13 +43,13 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
|
39
43
|
end
|
|
40
44
|
|
|
41
45
|
it 'tests the to_bxml method of the StartTranscription instance' do
|
|
42
|
-
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\"/>\n"
|
|
46
|
+
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\" detectLanguage=\"false\" preferredLanguages=\"en-US\"/>\n"
|
|
43
47
|
expect(instance.to_bxml).to eq(expected)
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
it 'tests the set_attributes method of the StartTranscription instance' do
|
|
47
51
|
instance.set_attributes(new_attributes)
|
|
48
|
-
expected = "\n<StartTranscription name=\"new_name\" tracks=\"outbound\" transcriptionEventUrl=\"https://new.com\" transcriptionEventMethod=\"GET\" username=\"new_username\" password=\"new_password\" destination=\"https://new.com\" stabilized=\"false\"/>\n"
|
|
52
|
+
expected = "\n<StartTranscription name=\"new_name\" tracks=\"outbound\" transcriptionEventUrl=\"https://new.com\" transcriptionEventMethod=\"GET\" username=\"new_username\" password=\"new_password\" destination=\"https://new.com\" stabilized=\"false\" detectLanguage=\"true\" preferredLanguages=\"es-US\"/>\n"
|
|
49
53
|
expect(instance.to_bxml).to eq(expected)
|
|
50
54
|
end
|
|
51
55
|
end
|
|
@@ -57,16 +61,16 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
|
57
61
|
end
|
|
58
62
|
|
|
59
63
|
it 'tests the to_bxml method of the nested StartTranscription instance' do
|
|
60
|
-
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n</StartTranscription>\n"
|
|
64
|
+
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\" detectLanguage=\"false\" preferredLanguages=\"en-US\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n</StartTranscription>\n"
|
|
61
65
|
expect(instance_nested.to_bxml).to eq(expected)
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
it 'tests the add_custom_param method of the nested StartTranscription instance' do
|
|
65
|
-
expected_single = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
|
69
|
+
expected_single = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\" detectLanguage=\"false\" preferredLanguages=\"en-US\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
|
66
70
|
instance_nested.add_custom_params(custom_param_2)
|
|
67
71
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
|
68
72
|
|
|
69
|
-
expected_multiple = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
|
73
|
+
expected_multiple = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\" detectLanguage=\"false\" preferredLanguages=\"en-US\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
|
70
74
|
instance_nested.add_custom_params([custom_param_2, custom_param_2])
|
|
71
75
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
|
72
76
|
end
|
|
@@ -3,6 +3,7 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
|
3
3
|
let(:initial_attributes) {
|
|
4
4
|
{
|
|
5
5
|
transfer_caller_id: '+19195551234',
|
|
6
|
+
privacy: true,
|
|
6
7
|
transfer_caller_display_name: 'initial_caller',
|
|
7
8
|
call_timeout: 5,
|
|
8
9
|
transfer_complete_url: 'https://initial.com',
|
|
@@ -22,6 +23,7 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
|
22
23
|
let(:new_attributes) {
|
|
23
24
|
{
|
|
24
25
|
transfer_caller_id: '+19195554321',
|
|
26
|
+
privacy: false,
|
|
25
27
|
transfer_caller_display_name: 'new_caller',
|
|
26
28
|
call_timeout: 10,
|
|
27
29
|
transfer_complete_url: 'https://new.com',
|
|
@@ -51,13 +53,13 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
it 'tests the to_bxml method of the Transfer instance' do
|
|
54
|
-
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\"/>\n"
|
|
56
|
+
expected = "\n<Transfer transferCallerId=\"+19195551234\" privacy=\"true\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\"/>\n"
|
|
55
57
|
expect(instance.to_bxml).to eq(expected)
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
it 'tests the set_attributes method of the Transfer instance' do
|
|
59
61
|
instance.set_attributes(new_attributes)
|
|
60
|
-
expected = "\n<Transfer transferCallerId=\"+19195554321\" transferCallerDisplayName=\"new_caller\" callTimeout=\"10\" transferCompleteUrl=\"https://new.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://new.com\" transferCompleteFallbackMethod=\"POST\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" diversionTreatment=\"stack\" diversionReason=\"no-answer\"/>\n"
|
|
62
|
+
expected = "\n<Transfer transferCallerId=\"+19195554321\" privacy=\"false\" transferCallerDisplayName=\"new_caller\" callTimeout=\"10\" transferCompleteUrl=\"https://new.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://new.com\" transferCompleteFallbackMethod=\"POST\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" diversionTreatment=\"stack\" diversionReason=\"no-answer\"/>\n"
|
|
61
63
|
expect(instance.to_bxml).to eq(expected)
|
|
62
64
|
end
|
|
63
65
|
end
|
|
@@ -69,16 +71,16 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
it 'tests the to_bxml method of the nested Transfer instance' do
|
|
72
|
-
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
|
74
|
+
expected = "\n<Transfer transferCallerId=\"+19195551234\" privacy=\"true\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
|
73
75
|
expect(instance_nested.to_bxml).to eq(expected)
|
|
74
76
|
end
|
|
75
77
|
|
|
76
78
|
it 'tests the add_verb method of the nested Transfer instance' do
|
|
77
|
-
expected_single = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n</Transfer>\n"
|
|
79
|
+
expected_single = "\n<Transfer transferCallerId=\"+19195551234\" privacy=\"true\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n</Transfer>\n"
|
|
78
80
|
instance_nested.add_transfer_recipients(sip_uri)
|
|
79
81
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
|
80
82
|
|
|
81
|
-
expected_multiple = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
|
83
|
+
expected_multiple = "\n<Transfer transferCallerId=\"+19195551234\" privacy=\"true\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
|
82
84
|
instance_nested.add_transfer_recipients([sip_uri, phone_number])
|
|
83
85
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
|
84
86
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Unit tests for Bandwidth::ReferCallStatusEnum
|
|
2
|
+
describe Bandwidth::ReferCallStatusEnum do
|
|
3
|
+
describe 'constants' do
|
|
4
|
+
it 'defines SUCCESS' do
|
|
5
|
+
expect(Bandwidth::ReferCallStatusEnum::SUCCESS).to eq('success')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'defines FAILURE' do
|
|
9
|
+
expect(Bandwidth::ReferCallStatusEnum::FAILURE).to eq('failure')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '.all_vars' do
|
|
14
|
+
it 'returns every valid enum value' do
|
|
15
|
+
expect(Bandwidth::ReferCallStatusEnum.all_vars).to eq(['success', 'failure'])
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe '.build_from_hash' do
|
|
20
|
+
it 'returns the value when it matches a valid enum value' do
|
|
21
|
+
expect(Bandwidth::ReferCallStatusEnum.build_from_hash('success')).to eq('success')
|
|
22
|
+
expect(Bandwidth::ReferCallStatusEnum.build_from_hash('failure')).to eq('failure')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'raises an error for an invalid enum value' do
|
|
26
|
+
expect {
|
|
27
|
+
Bandwidth::ReferCallStatusEnum.build_from_hash('invalid')
|
|
28
|
+
}.to raise_error(RuntimeError)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Unit tests for Bandwidth::ReferCompleteCallback
|
|
2
|
+
describe Bandwidth::ReferCompleteCallback do
|
|
3
|
+
let(:refer_complete_callback_default) { Bandwidth::ReferCompleteCallback.new }
|
|
4
|
+
let(:refer_complete_callback_values) { Bandwidth::ReferCompleteCallback.new({
|
|
5
|
+
event_type: 'referComplete',
|
|
6
|
+
event_time: '2022-06-16T13:15:07.160Z',
|
|
7
|
+
account_id: '9900000',
|
|
8
|
+
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
|
|
9
|
+
from: '+19195554321',
|
|
10
|
+
to: '+19195551234',
|
|
11
|
+
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
|
|
12
|
+
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
13
|
+
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
14
|
+
start_time: '2022-06-16T13:15:07.160Z',
|
|
15
|
+
answer_time: '2022-06-16T13:15:18.126Z',
|
|
16
|
+
tag: 'custom tag',
|
|
17
|
+
refer_call_status: Bandwidth::ReferCallStatusEnum::SUCCESS,
|
|
18
|
+
refer_sip_response_code: 202,
|
|
19
|
+
notify_sip_response_code: 200
|
|
20
|
+
}) }
|
|
21
|
+
|
|
22
|
+
describe '#initialize' do
|
|
23
|
+
it 'causes an ArgumentError by passing an Array to the initialize method' do
|
|
24
|
+
expect {
|
|
25
|
+
Bandwidth::ReferCompleteCallback.new([])
|
|
26
|
+
}.to raise_error(ArgumentError)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
|
|
30
|
+
expect {
|
|
31
|
+
Bandwidth::ReferCompleteCallback.new({ invalid: true })
|
|
32
|
+
}.to raise_error(ArgumentError)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe '#acceptable_attributes' do
|
|
37
|
+
it 'expects acceptable JSON attributes to be those in the attribute map' do
|
|
38
|
+
expect(Bandwidth::ReferCompleteCallback.acceptable_attributes).to eq(Bandwidth::ReferCompleteCallback.attribute_map.values)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#openapi_nullable' do
|
|
43
|
+
it 'expects nullable attributes to be the set of nullable fields' do
|
|
44
|
+
expect(Bandwidth::ReferCompleteCallback.openapi_nullable).to eq(Set.new([
|
|
45
|
+
:'answer_time',
|
|
46
|
+
:'tag'
|
|
47
|
+
]))
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe '#build_from_hash' do
|
|
52
|
+
it 'validates instance of ReferCompleteCallback created by the build_from_hash method' do
|
|
53
|
+
refer_complete_callback_from_hash = Bandwidth::ReferCompleteCallback.build_from_hash({
|
|
54
|
+
eventType: 'referComplete',
|
|
55
|
+
eventTime: '2022-06-16T13:15:07.160Z',
|
|
56
|
+
accountId: '9900000',
|
|
57
|
+
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
|
|
58
|
+
from: '+19195554321',
|
|
59
|
+
to: '+19195551234',
|
|
60
|
+
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
|
|
61
|
+
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
62
|
+
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
63
|
+
startTime: '2022-06-16T13:15:07.160Z',
|
|
64
|
+
answerTime: '2022-06-16T13:15:18.126Z',
|
|
65
|
+
tag: 'custom tag',
|
|
66
|
+
referCallStatus: Bandwidth::ReferCallStatusEnum::SUCCESS,
|
|
67
|
+
referSipResponseCode: 202,
|
|
68
|
+
notifySipResponseCode: 200
|
|
69
|
+
})
|
|
70
|
+
expect(refer_complete_callback_from_hash).to be_instance_of(Bandwidth::ReferCompleteCallback)
|
|
71
|
+
expect(refer_complete_callback_from_hash.event_type).to eq('referComplete')
|
|
72
|
+
expect(refer_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
|
|
73
|
+
expect(refer_complete_callback_from_hash.account_id).to eq('9900000')
|
|
74
|
+
expect(refer_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
|
|
75
|
+
expect(refer_complete_callback_from_hash.from).to eq('+19195554321')
|
|
76
|
+
expect(refer_complete_callback_from_hash.to).to eq('+19195551234')
|
|
77
|
+
expect(refer_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
|
|
78
|
+
expect(refer_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
|
|
79
|
+
expect(refer_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
|
|
80
|
+
expect(refer_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
|
|
81
|
+
expect(refer_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
|
|
82
|
+
expect(refer_complete_callback_from_hash.tag).to eq('custom tag')
|
|
83
|
+
expect(refer_complete_callback_from_hash.refer_call_status).to eq(Bandwidth::ReferCallStatusEnum::SUCCESS)
|
|
84
|
+
expect(refer_complete_callback_from_hash.refer_sip_response_code).to eq(202)
|
|
85
|
+
expect(refer_complete_callback_from_hash.notify_sip_response_code).to eq(200)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe '#to_s' do
|
|
90
|
+
it 'returns a string representation of the object' do
|
|
91
|
+
expect(refer_complete_callback_values.to_s).to eq({ :eventType => 'referComplete', :eventTime => '2022-06-16T13:15:07.160Z', :accountId => '9900000', :applicationId => '04e88489-df02-4e34-a0ee-27a91849555f', :from => '+19195554321', :to => '+19195551234', :direction => 'outbound', :callId => 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', :callUrl => 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', :startTime => '2022-06-16T13:15:07.160Z', :answerTime => '2022-06-16T13:15:18.126Z', :tag => 'custom tag', :referCallStatus => 'success', :referSipResponseCode => 202, :notifySipResponseCode => 200 }.to_s)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe '#eq? #==' do
|
|
96
|
+
it 'returns true/false when comparing objects' do
|
|
97
|
+
expect(refer_complete_callback_default.eql?(Bandwidth::ReferCompleteCallback.new)).to be true
|
|
98
|
+
expect(refer_complete_callback_default.eql?(refer_complete_callback_values)).to be false
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe '#to_body #to_hash' do
|
|
103
|
+
it 'returns a hash representation of the object' do
|
|
104
|
+
expect(refer_complete_callback_values.to_body).to eq({
|
|
105
|
+
eventType: 'referComplete',
|
|
106
|
+
eventTime: '2022-06-16T13:15:07.160Z',
|
|
107
|
+
accountId: '9900000',
|
|
108
|
+
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
|
|
109
|
+
from: '+19195554321',
|
|
110
|
+
to: '+19195551234',
|
|
111
|
+
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
|
|
112
|
+
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
113
|
+
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
|
|
114
|
+
startTime: '2022-06-16T13:15:07.160Z',
|
|
115
|
+
answerTime: '2022-06-16T13:15:18.126Z',
|
|
116
|
+
tag: 'custom tag',
|
|
117
|
+
referCallStatus: Bandwidth::ReferCallStatusEnum::SUCCESS,
|
|
118
|
+
referSipResponseCode: 202,
|
|
119
|
+
notifySipResponseCode: 200
|
|
120
|
+
})
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|