diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index 6f1840c3..9e1b1646 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -228,7 +228,9 @@ require 'bandwidth-sdk/models/bxml/nestable_verb' require 'bandwidth-sdk/models/bxml/verbs/bridge' require 'bandwidth-sdk/models/bxml/verbs/conference' +require 'bandwidth-sdk/models/bxml/verbs/connect' require 'bandwidth-sdk/models/bxml/verbs/custom_param' +require 'bandwidth-sdk/models/bxml/verbs/endpoint' require 'bandwidth-sdk/models/bxml/verbs/forward' require 'bandwidth-sdk/models/bxml/verbs/gather' require 'bandwidth-sdk/models/bxml/verbs/hangup' diff --git a/lib/bandwidth-sdk/models/bxml/verbs/connect.rb b/lib/bandwidth-sdk/models/bxml/verbs/connect.rb new file mode 100644 index 00000000..52e658cb --- /dev/null +++ b/lib/bandwidth-sdk/models/bxml/verbs/connect.rb @@ -0,0 +1,23 @@ +module Bandwidth + module Bxml + class Connect < Bandwidth::Bxml::NestableVerb + # Initializer + # @param endpoints [Verb] or [Array] XML element children. Defaults to an empty array. Valid nested connect verbs are: Endpoint. + # @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash. + def initialize(endpoints = [], attributes = {}) + super('Connect', nil, endpoints, attributes) + + @attribute_map = { + event_callback_url: 'eventCallbackUrl', # Optional [String]: URL to send events to during the connection lifecycle. May be a relative URL. Defaults to None. + event_fallback_url: 'eventFallbackUrl', # Optional [String]: Fallback URL used by Bandwidth when delivery to event_callback_url fails. May be a relative URL. + } + end + + # Add endpoint or endpoints to the nested verbs array + # @param endpoints [Endpoint] or [Array] Verb or verbs to add to the array. + def add_endpoints(endpoints) + @nested_verbs.push(*endpoints) + end + end + end +end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/endpoint.rb b/lib/bandwidth-sdk/models/bxml/verbs/endpoint.rb new file mode 100644 index 00000000..1b1401d8 --- /dev/null +++ b/lib/bandwidth-sdk/models/bxml/verbs/endpoint.rb @@ -0,0 +1,11 @@ +module Bandwidth + module Bxml + class Endpoint < Bandwidth::Bxml::Verb + # Initializer + # @param endpoint_id [String] The ID of the endpoint to connect to. + def initialize(endpoint_id) + super('Endpoint', endpoint_id, {}) + end + end + end +end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/forward.rb b/lib/bandwidth-sdk/models/bxml/verbs/forward.rb index 5f63110f..ae1e805f 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/forward.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/forward.rb @@ -9,6 +9,8 @@ def initialize(attributes = {}) @attribute_map = { to: 'to', # [String]: The phone number destination of the call. from: 'from', # Optional [String]: The phone number that the recipient will receive the call from. + privacy: 'privacy', # Optional [Boolean]: Hide the calling number. The caller_display_name field can be used to customize the displayed name. + caller_display_name: 'callerDisplayName', # Optional [String]: The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If privacy is true, only the following values are valid: Restricted, Anonymous, Private, or Unavailable. call_timeout: 'callTimeout', # Optional [Number]: The number of seconds to wait before timing out the call. diversion_treatment: 'diversionTreatment', # Optional [String]: Can be any of the following: - none: No diversion headers are sent on the outbound leg of the transferred call. - propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. - stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. If diversionTreatment is not specified, no diversion header will be included for the transfer even if one came with the inbound call. Defaults to None. diversion_reason: 'diversionReason', # Optional [String]: Can be any of the following values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. This parameter is considered only when diversionTreatment is set to stack. Defaults to None. diff --git a/lib/bandwidth-sdk/models/bxml/verbs/gather.rb b/lib/bandwidth-sdk/models/bxml/verbs/gather.rb index c156a407..3e8d0581 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/gather.rb @@ -8,20 +8,28 @@ def initialize(audio_verbs = [], attributes = {}) super('Gather', nil, audio_verbs, attributes) @attribute_map = { - gather_url: 'gatherUrl', # Optional [String]: URL to send Gather event to and request new BXML. May be a relative URL. - gather_method: 'gatherMethod', # Optional [String]: The HTTP method to use for the request to gather_url. GET or POST. Default value is POST. - gather_fallback_url: 'gatherFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Gather event callback delivery in case gather_url fails to respond. - gather_fallback_method: 'gatherFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Gather event callback to gather_fallback_url. GET or POST. Default value is POST. - username: 'username', # Optional [String]: The username to send in the HTTP request to gather_url. - password: 'password', # Optional [String]: The password to send in the HTTP request to gather_url. - fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to gather_fallback_url. - fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to gather_fallback_url. - tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. - terminating_digits: 'terminatingDigits', # Optional [String]: When any of these digits are pressed, it will terminate the Gather. Default value is "", which disables this feature. - max_digits: 'maxDigits', # Optional [Number]: Max number of digits to collect. Default value is 50. Range: decimal values between 1 - 50. - inter_digit_timeout: 'interDigitTimeout', # Optional [Number]: Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60. - first_digit_timeout: 'firstDigitTimeout', # Optional [Number]: Time (in seconds) to pause after any audio from nested or verb is played (in seconds) before terminating the Gather. Default value is 5. Range: decimal values between 0 - 60. - repeat_count: 'repeatCount', # Optional [Number]: The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. The delay between repetitions will be equal to first_digit_timeout. Default value is 1. repeatCount * number of verbs must not be greater than 20. + gather_url: 'gatherUrl', # Optional [String]: URL to send Gather event to and request new BXML. May be a relative URL. + gather_method: 'gatherMethod', # Optional [String]: The HTTP method to use for the request to gather_url. GET or POST. Default value is POST. + gather_fallback_url: 'gatherFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Gather event callback delivery in case gather_url fails to respond. + gather_fallback_method: 'gatherFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Gather event callback to gather_fallback_url. GET or POST. Default value is POST. + username: 'username', # Optional [String]: The username to send in the HTTP request to gather_url. + password: 'password', # Optional [String]: The password to send in the HTTP request to gather_url. + fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to gather_fallback_url. + fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to gather_fallback_url. + tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. + terminating_digits: 'terminatingDigits', # Optional [String]: When any of these digits are pressed, it will terminate the Gather. Default value is "", which disables this feature. + max_digits: 'maxDigits', # Optional [Number]: Max number of digits to collect. Default value is 50. Range: decimal values between 1 - 50. + inter_digit_timeout: 'interDigitTimeout', # Optional [Number]: Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60. + first_digit_timeout: 'firstDigitTimeout', # Optional [Number]: Time (in seconds) to pause after any audio from nested or verb is played (in seconds) before terminating the Gather. Default value is 5. Range: decimal values between 0 - 60. + repeat_count: 'repeatCount', # Optional [Number]: The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. The delay between repetitions will be equal to first_digit_timeout. Default value is 1. repeatCount * number of verbs must not be greater than 20. + input: 'input', # Optional [String]: Specifies the input mode for the Gather verb. Accepted values are dtmf, speech, or dtmf_speech. Default value is dtmf. + hints: 'hints', # Optional [String]: Words or phrases that help improve speech recognition, useful for phrases with many words. Possible and effective only if input is speech or dtmf_speech. + language: 'language', # Optional [String]: Language code for speech recognition. See the BXML documentation for the list of supported locales. Possible and effective only if input is speech or dtmf_speech. + partial_result_callback: 'partialResultCallback', # Optional [String]: URL to send Partial Result event to. May be a relative URL. Possible and effective only if input is speech or dtmf_speech. + partial_result_callback_method: 'partialResultCallbackMethod', # Optional [String]: The HTTP method to use for the request to partial_result_callback. GET or POST. Default value is POST. + profanity_filter: 'profanityFilter', # Optional [Boolean]: Enables or disables filtering of profane words. Default value is true. Possible and effective only if input is speech or dtmf_speech. + speech_model: 'speechModel', # Optional [String]: Specifies the speech recognition model to use: default, numbers_and_commands, phone_call, experimental_conversations, experimental_utterances, googlev2_long, googlev2_short, googlev2_telephony, or googlev2_telephony_short. + speech_timeout: 'speechTimeout', # Optional [Number]: Time (in seconds) to wait for speech input before timing out. Accepted values are any positive integer. Default value is 5. } end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/record.rb b/lib/bandwidth-sdk/models/bxml/verbs/record.rb index c3bbb728..1a77acc7 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/record.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/record.rb @@ -14,6 +14,7 @@ def initialize(attributes = {}) recording_available_url: 'recordingAvailableUrl', # Optional [String]: URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. recording_available_method: 'recordingAvailableMethod', # Optional [String]: The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. Defaults to None. transcribe: 'transcribe', # Optional [Boolean]: A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + detect_language: 'detectLanguage', # Optional [Boolean]: A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. Ignored if transcribe is not set to true. Default is false. transcription_available_url: 'transcriptionAvailableUrl', # Optional [String]: URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. transcription_available_method: 'transcriptionAvailableMethod', # Optional [String]: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. username: 'username', # Optional [String]: The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. @@ -25,6 +26,7 @@ def initialize(attributes = {}) max_duration: 'maxDuration', # Optional [Number]: Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. silence_timeout: 'silenceTimeout', # Optional [Number]: Length of silence after which to end the recording (in seconds). Max is equivalent to the maximum maxDuration value. Default value is 0, which means no timeout. Defaults to None. file_format: 'fileFormat', # Optional [String]: The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. + recording_name: 'recordingName', # Optional [String]: A name to identify this recording. It will be returned in the Recording Available or Conference Recording Available event if specified. } end end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb b/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb index 0db4f0c0..457c6ebf 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb @@ -10,6 +10,7 @@ def initialize(attributes = {}) recording_available_url: 'recordingAvailableUrl', # Optional [String]: URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. recording_available_method: 'recordingAvailableMethod', # Optional [String]: The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. transcribe: 'transcribe', # Optional [Boolean]: A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + detect_language: 'detectLanguage', # Optional [Boolean]: A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. Ignored if transcribe is not set to true. Default is false. transcription_available_url: 'transcriptionAvailableUrl', # Optional [String]: URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. transcription_available_method: 'transcriptionAvailableMethod', # Optional [String]: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. username: 'username', # Optional [String]: The username to send in the HTTP request to recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. @@ -17,6 +18,7 @@ def initialize(attributes = {}) tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. file_format: 'fileFormat', # Optional [String]: The audio format that the recording will be saved as: mp3 or wav. Default value is wav. multi_channel: 'multiChannel', # Optional [Boolean]: A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false. + recording_name: 'recordingName', # Optional [String]: A name to identify this recording. It will be returned in the Recording Available or Conference Recording Available event if specified. } end end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb b/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb index c12017b5..de10b0ec 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb @@ -12,8 +12,8 @@ def initialize(stream_params = [], attributes = {}) mode: 'mode', # Optional [String]: The mode to use for the stream. unidirectional or bidirectional. Specifies whether the audio being streamed over the WebSocket is bidirectional (the service can both read and write audio over the WebSocket) or unidirectional (one-way, read-only). Default is unidirectional. tracks: 'tracks', # Optional [String]: The part of the call to send a stream from. inbound, outbound or both. Default is inbound. destination: 'destination', # Optional [String]: A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL as base64-encoded PCMU/G711 audio. - destination_username: 'destination_username', # Optional [String]: The username to send in the `Authorization` header of the initial websocket connection to the `destination` URL. - destination_password: 'destination_password', # Optional [String]: The password to send in the `Authorization` header of the initial websocket connection to the `destination` URL. + destination_username: 'destinationUsername', # Optional [String]: The username to send in the `Authorization` header of the initial websocket connection to the `destination` URL. + destination_password: 'destinationPassword', # Optional [String]: The password to send in the `Authorization` header of the initial websocket connection to the `destination` URL. stream_event_url: 'streamEventUrl', # Optional [String]: URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. stream_event_method: 'streamEventMethod', # Optional [String]: The HTTP method to use for the request to streamEventUrl. GET or POST. Default value is POST. username: 'username', # Optional [String]: The username to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). diff --git a/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb b/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb index b6e5627c..a2a1af18 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb @@ -16,6 +16,8 @@ def initialize(custom_params = [], attributes = {}) password: 'password', # Optional [String]: The password to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https). destination: 'destination', # Optional [String]: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format. stabilized: 'stabilized', # Optional [Boolean]: Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. + detect_language: 'detectLanguage', # Optional [Boolean]: A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. See the BXML documentation for the list of supported locales. Default is false. + preferred_languages: 'preferredLanguages', # Optional [String]: A comma-separated list of language locales in which the transcription should be performed. Requires detect_language to be false. See the BXML documentation for the list of supported locales. Defaults to en-US. } end diff --git a/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb b/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb index 41b91c0d..419968d2 100644 --- a/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +++ b/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb @@ -9,6 +9,7 @@ def initialize(transfer_to = [], attributes = {}) @attribute_map = { transfer_caller_id: 'transferCallerId', # Optional [String]: The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555) or be one of the following strings Restricted, Anonymous, Private, or Unavailable. Leave as default to pass along the number of the remote party. Defaults to None. + privacy: 'privacy', # Optional [Boolean]: Hide the calling number. The transfer_caller_display_name field can be used to customize the displayed name. transfer_caller_display_name: 'transferCallerDisplayName', # Optional [String]: The caller display name to use when the call is transferred. May not exceed 256 characters nor contain control characters such as new lines. Defaults to None. call_timeout: 'callTimeout', # Optional [Number]: The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Range: decimal values between 1 - 300. Default value is 30 seconds. Defaults to None. transfer_complete_url: 'transferCompleteUrl', # Optional [String]: URL to send the Transfer Complete event to and request new BXML. Optional but recommended. See below for further details. May be a relative URL. Defaults to None. diff --git a/spec/unit/models/bxml/verbs/connect_spec.rb b/spec/unit/models/bxml/verbs/connect_spec.rb new file mode 100644 index 00000000..3e7481a8 --- /dev/null +++ b/spec/unit/models/bxml/verbs/connect_spec.rb @@ -0,0 +1,62 @@ +# Unit tests for Bandwidth::Bxml::Connect +describe 'Bandwidth::Bxml::Connect' do + let(:initial_attributes) { + { + event_callback_url: 'https://initial.com', + event_fallback_url: 'https://initial.com' + } + } + + let(:new_attributes) { + { + event_callback_url: 'https://new.com', + event_fallback_url: 'https://new.com' + } + } + + let(:endpoint_1) { Bandwidth::Bxml::Endpoint.new('endpoint_id_1') } + let(:endpoint_2) { Bandwidth::Bxml::Endpoint.new('endpoint_id_2') } + + let(:instance) { Bandwidth::Bxml::Connect.new([], initial_attributes) } + let(:instance_nested) { Bandwidth::Bxml::Connect.new(endpoint_1, initial_attributes) } + + describe 'test an instance of Connect' do + it 'validates instance of Connect' do + expect(instance).to be_instance_of(Bandwidth::Bxml::Connect) + expect(instance).to be_a(Bandwidth::Bxml::Verb) + end + + it 'tests the to_bxml method of the Connect instance' do + expected = "\n\n" + expect(instance.to_bxml).to eq(expected) + end + + it 'tests the set_attributes method of the Connect instance' do + instance.set_attributes(new_attributes) + expected = "\n\n" + expect(instance.to_bxml).to eq(expected) + end + end + + describe 'test an instance of Connect with nested verbs' do + it 'validates instance of Connect' do + expect(instance_nested).to be_instance_of(Bandwidth::Bxml::Connect) + expect(instance_nested).to be_a(Bandwidth::Bxml::Verb) + end + + it 'tests the to_bxml method of the nested Connect instance' do + expected = "\n\n endpoint_id_1\n\n" + expect(instance_nested.to_bxml).to eq(expected) + end + + it 'tests the add_endpoints method of the nested Connect instance' do + expected_single = "\n\n endpoint_id_1\n endpoint_id_2\n\n" + instance_nested.add_endpoints(endpoint_2) + expect(instance_nested.to_bxml).to eq(expected_single) + + expected_multiple = "\n\n endpoint_id_1\n endpoint_id_2\n endpoint_id_2\n endpoint_id_1\n\n" + instance_nested.add_endpoints([endpoint_2, endpoint_1]) + expect(instance_nested.to_bxml).to eq(expected_multiple) + end + end +end diff --git a/spec/unit/models/bxml/verbs/endpoint_spec.rb b/spec/unit/models/bxml/verbs/endpoint_spec.rb new file mode 100644 index 00000000..bdeadad3 --- /dev/null +++ b/spec/unit/models/bxml/verbs/endpoint_spec.rb @@ -0,0 +1,16 @@ +# Unit tests for Bandwidth::Bxml::Endpoint +describe 'Bandwidth::Bxml::Endpoint' do + let(:instance) { Bandwidth::Bxml::Endpoint.new('test_endpoint_id') } + + describe 'test an instance of Endpoint' do + it 'validates instance of Endpoint' do + expect(instance).to be_instance_of(Bandwidth::Bxml::Endpoint) + expect(instance).to be_a(Bandwidth::Bxml::Verb) + end + + it 'tests the to_bxml method of the Endpoint instance' do + expected = "\ntest_endpoint_id\n" + expect(instance.to_bxml).to eq(expected) + end + end +end diff --git a/spec/unit/models/bxml/verbs/forward_spec.rb b/spec/unit/models/bxml/verbs/forward_spec.rb index d0bb3e78..7f93840f 100644 --- a/spec/unit/models/bxml/verbs/forward_spec.rb +++ b/spec/unit/models/bxml/verbs/forward_spec.rb @@ -4,6 +4,8 @@ { to: '+19195551234', from: '+19195554321', + privacy: true, + caller_display_name: 'Restricted', call_timeout: 5, diversion_treatment: 'propagate', diversion_reason: 'user-busy', @@ -15,6 +17,8 @@ { to: '+19195554321', from: '+19195551234', + privacy: false, + caller_display_name: 'new_display_name', call_timeout: 10, diversion_treatment: 'stack', diversion_reason: 'no-answer', @@ -31,13 +35,13 @@ end it 'tests the to_bxml method of the Forward instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the Forward instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end diff --git a/spec/unit/models/bxml/verbs/gather_spec.rb b/spec/unit/models/bxml/verbs/gather_spec.rb index 23ffc87e..9e1f056b 100644 --- a/spec/unit/models/bxml/verbs/gather_spec.rb +++ b/spec/unit/models/bxml/verbs/gather_spec.rb @@ -15,7 +15,15 @@ max_digits: 5, inter_digit_timeout: 5, first_digit_timeout: 5, - repeat_count: 5 + repeat_count: 5, + input: 'dtmf', + hints: 'initial_hints', + language: 'en-US', + partial_result_callback: 'https://initial.com', + partial_result_callback_method: 'POST', + profanity_filter: true, + speech_model: 'default', + speech_timeout: 5 } } @@ -34,7 +42,15 @@ max_digits: 10, inter_digit_timeout: 10, first_digit_timeout: 10, - repeat_count: 10 + repeat_count: 10, + input: 'speech', + hints: 'new_hints', + language: 'es-US', + partial_result_callback: 'https://new.com', + partial_result_callback_method: 'GET', + profanity_filter: false, + speech_model: 'phone_call', + speech_timeout: 10 } } @@ -51,13 +67,13 @@ end it 'tests the to_bxml method of the Gather instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the Gather instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end @@ -69,16 +85,16 @@ end it 'tests the to_bxml method of the nested Gather instance' do - expected = "\n\n https://audio.url/audio1.wav\n\n" + expected = "\n\n https://audio.url/audio1.wav\n\n" expect(instance_nested.to_bxml).to eq(expected) end it 'tests the add_verb method of the nested Gather instance' do - expected_single = "\n\n https://audio.url/audio1.wav\n Holaruby speak sentence SSML test\n\n" + expected_single = "\n\n https://audio.url/audio1.wav\n Holaruby speak sentence SSML test\n\n" instance_nested.add_audio_verbs(speak_sentence) expect(instance_nested.to_bxml).to eq(expected_single) - expected_multiple = "\n\n https://audio.url/audio1.wav\n Holaruby speak sentence SSML test\n Holaruby speak sentence SSML test\n https://audio.url/audio1.wav\n\n" + expected_multiple = "\n\n https://audio.url/audio1.wav\n Holaruby speak sentence SSML test\n Holaruby speak sentence SSML test\n https://audio.url/audio1.wav\n\n" instance_nested.add_audio_verbs([speak_sentence, play_audio]) expect(instance_nested.to_bxml).to eq(expected_multiple) end diff --git a/spec/unit/models/bxml/verbs/record_spec.rb b/spec/unit/models/bxml/verbs/record_spec.rb index d125b2ea..a557c8ea 100644 --- a/spec/unit/models/bxml/verbs/record_spec.rb +++ b/spec/unit/models/bxml/verbs/record_spec.rb @@ -9,6 +9,7 @@ recording_available_url: 'https://initial.com', recording_available_method: 'POST', transcribe: true, + detect_language: true, transcription_available_url: 'https://initial.com', transcription_available_method: 'POST', username: 'initial_username', @@ -19,7 +20,8 @@ terminating_digits: '5', max_duration: 5, silence_timeout: 5, - file_format: 'wav' + file_format: 'wav', + recording_name: 'initial_recording_name' } } @@ -32,6 +34,7 @@ recording_available_url: 'https://new.com', recording_available_method: 'GET', transcribe: true, + detect_language: false, transcription_available_url: 'https://new.com', transcription_available_method: 'GET', username: 'new_username', @@ -42,7 +45,8 @@ terminating_digits: '0', max_duration: 10, silence_timeout: 10, - file_format: 'mp3' + file_format: 'mp3', + recording_name: 'new_recording_name' } } @@ -55,13 +59,13 @@ end it 'tests the to_bxml method of the Record instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the Record instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end diff --git a/spec/unit/models/bxml/verbs/start_recording_spec.rb b/spec/unit/models/bxml/verbs/start_recording_spec.rb index d3bb5131..42f9c10b 100644 --- a/spec/unit/models/bxml/verbs/start_recording_spec.rb +++ b/spec/unit/models/bxml/verbs/start_recording_spec.rb @@ -5,13 +5,15 @@ recording_available_url: 'https://initial.com', recording_available_method: 'POST', transcribe: true, + detect_language: true, transcription_available_url: 'https://initial.com', transcription_available_method: 'POST', username: 'initial_username', password: 'initial_password', tag: 'initial_tag', file_format: 'wav', - multi_channel: true + multi_channel: true, + recording_name: 'initial_recording_name' } } @@ -20,13 +22,15 @@ recording_available_url: 'https://new.com', recording_available_method: 'GET', transcribe: false, + detect_language: false, transcription_available_url: 'https://new.com', transcription_available_method: 'GET', username: 'new_username', password: 'new_password', tag: 'new_tag', file_format: 'mp3', - multi_channel: false + multi_channel: false, + recording_name: 'new_recording_name' } } @@ -39,13 +43,13 @@ end it 'tests the to_bxml method of the StartRecording instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the StartRecording instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end diff --git a/spec/unit/models/bxml/verbs/start_stream_spec.rb b/spec/unit/models/bxml/verbs/start_stream_spec.rb index 58991788..c8faf443 100644 --- a/spec/unit/models/bxml/verbs/start_stream_spec.rb +++ b/spec/unit/models/bxml/verbs/start_stream_spec.rb @@ -43,13 +43,13 @@ end it 'tests the to_bxml method of the StartStream instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the StartStream instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end @@ -61,16 +61,16 @@ end it 'tests the to_bxml method of the nested StartStream instance' do - expected = "\n\n \n\n" + expected = "\n\n \n\n" expect(instance_nested.to_bxml).to eq(expected) end it 'tests the add_stream_param method of the nested StartStream instance' do - expected_single = "\n\n \n \n\n" + expected_single = "\n\n \n \n\n" instance_nested.add_stream_params(stream_param_2) expect(instance_nested.to_bxml).to eq(expected_single) - expected_multiple = "\n\n \n \n \n \n\n" + expected_multiple = "\n\n \n \n \n \n\n" instance_nested.add_stream_params([stream_param_2, stream_param_2]) expect(instance_nested.to_bxml).to eq(expected_multiple) end diff --git a/spec/unit/models/bxml/verbs/start_transcription_spec.rb b/spec/unit/models/bxml/verbs/start_transcription_spec.rb index 74245e41..4fd5ee46 100644 --- a/spec/unit/models/bxml/verbs/start_transcription_spec.rb +++ b/spec/unit/models/bxml/verbs/start_transcription_spec.rb @@ -9,7 +9,9 @@ username: 'initial_username', password: 'initial_password', destination: 'https://initial.com', - stabilized: true + stabilized: true, + detect_language: false, + preferred_languages: 'en-US' } } @@ -22,7 +24,9 @@ username: 'new_username', password: 'new_password', destination: 'https://new.com', - stabilized: false + stabilized: false, + detect_language: true, + preferred_languages: 'es-US' } } @@ -39,13 +43,13 @@ end it 'tests the to_bxml method of the StartTranscription instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the StartTranscription instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end @@ -57,16 +61,16 @@ end it 'tests the to_bxml method of the nested StartTranscription instance' do - expected = "\n\n \n\n" + expected = "\n\n \n\n" expect(instance_nested.to_bxml).to eq(expected) end it 'tests the add_custom_param method of the nested StartTranscription instance' do - expected_single = "\n\n \n \n\n" + expected_single = "\n\n \n \n\n" instance_nested.add_custom_params(custom_param_2) expect(instance_nested.to_bxml).to eq(expected_single) - expected_multiple = "\n\n \n \n \n \n\n" + expected_multiple = "\n\n \n \n \n \n\n" instance_nested.add_custom_params([custom_param_2, custom_param_2]) expect(instance_nested.to_bxml).to eq(expected_multiple) end diff --git a/spec/unit/models/bxml/verbs/transfer_spec.rb b/spec/unit/models/bxml/verbs/transfer_spec.rb index ce2ab32d..69832f2d 100644 --- a/spec/unit/models/bxml/verbs/transfer_spec.rb +++ b/spec/unit/models/bxml/verbs/transfer_spec.rb @@ -3,6 +3,7 @@ let(:initial_attributes) { { transfer_caller_id: '+19195551234', + privacy: true, transfer_caller_display_name: 'initial_caller', call_timeout: 5, transfer_complete_url: 'https://initial.com', @@ -22,6 +23,7 @@ let(:new_attributes) { { transfer_caller_id: '+19195554321', + privacy: false, transfer_caller_display_name: 'new_caller', call_timeout: 10, transfer_complete_url: 'https://new.com', @@ -51,13 +53,13 @@ end it 'tests the to_bxml method of the Transfer instance' do - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end it 'tests the set_attributes method of the Transfer instance' do instance.set_attributes(new_attributes) - expected = "\n\n" + expected = "\n\n" expect(instance.to_bxml).to eq(expected) end end @@ -69,16 +71,16 @@ end it 'tests the to_bxml method of the nested Transfer instance' do - expected = "\n\n +19195551234\n\n" + expected = "\n\n +19195551234\n\n" expect(instance_nested.to_bxml).to eq(expected) end it 'tests the add_verb method of the nested Transfer instance' do - expected_single = "\n\n +19195551234\n sip:1-999-123-4567@voip-provider.example.net\n\n" + expected_single = "\n\n +19195551234\n sip:1-999-123-4567@voip-provider.example.net\n\n" instance_nested.add_transfer_recipients(sip_uri) expect(instance_nested.to_bxml).to eq(expected_single) - expected_multiple = "\n\n +19195551234\n sip:1-999-123-4567@voip-provider.example.net\n sip:1-999-123-4567@voip-provider.example.net\n +19195551234\n\n" + expected_multiple = "\n\n +19195551234\n sip:1-999-123-4567@voip-provider.example.net\n sip:1-999-123-4567@voip-provider.example.net\n +19195551234\n\n" instance_nested.add_transfer_recipients([sip_uri, phone_number]) expect(instance_nested.to_bxml).to eq(expected_multiple) end