Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bandwidth/bxml

Package Overview
Dependencies
Maintainers
15
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bandwidth/bxml - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

34

lib/verbs/gather.js

@@ -24,4 +24,3 @@ /**

this.firstDigitTimeout = null;
this.speakSentence = null;
this.playAudio = null;
this.audioProducers = [];
this.repeatCount = null;

@@ -117,3 +116,12 @@ }

setSpeakSentence(speakSentence) {
this.speakSentence = speakSentence;
if(!Array.isArray(this.audioProducers)) this.audioProducers = [];
if(Array.isArray(speakSentence)){
speakSentence.forEach ( (verb) => {
this.audioProducers.push(verb);
})
} else {
this.audioProducers.push(speakSentence);
}
}

@@ -127,3 +135,11 @@

setPlayAudio(playAudio) {
this.playAudio = playAudio;
if(!Array.isArray(this.audioProducers)) this.audioProducers = [];
if(Array.isArray(playAudio)){
playAudio.forEach ( (verb) => {
this.audioProducers.push(verb);
})
} else {
this.audioProducers.push(playAudio);
}
}

@@ -187,9 +203,9 @@

if (this.speakSentence !== null) {
this.speakSentence.addXml(ele);
if (Array.isArray(this.audioProducers)) {
this.audioProducers.forEach( (verb) => {
verb.addXml(ele);
})
}
if (this.playAudio !== null) {
this.playAudio.addXml(ele);
}

@@ -196,0 +212,0 @@ return xmlDocument;

{
"name": "@bandwidth/bxml",
"version": "2.5.0",
"version": "2.6.0",
"description": "Generator for Bandwidth's BXML",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,2 +15,3 @@ # NodeJS Bandwidth BXML

| 2.5.0 | Updated Pause (changed code comment to floats instead of ints), SendDtmf (added toneInterval and toneDuration attributes), and Record (added silenceTimeout attribute) verbs |
| 2.6.0 | Multiple nested verbs with Gather verb |

@@ -180,2 +181,35 @@ ## Installing

### Gather Response with multiple nested verbs
```js
var playAudio = new BandwidthBxml.Verbs.PlayAudio();
playAudio.setUrl("https:###test.com");
playAudio.setUsername("user");
playAudio.setPassword("pass");
var speakSentence = new BandwidthBxml.Verbs.SpeakSentence();
speakSentence.setSentence("test");
speakSentence.setVoice("susan");
speakSentence.setGender("female");
speakSentence.setLocale("en_US");
var gather = new BandwidthBxml.Verbs.Gather();
gather.setGatherUrl("https:###test.com");
gather.setGatherMethod("GET");
gather.setUsername("user");
gather.setPassword("pass");
gather.setTag("tag");
gather.setTerminatingDigits("123");
gather.setMaxDigits(3);
gather.setInterDigitTimeout(4);
gather.setFirstDigitTimeout(5);
gather.setPlayAudio(playAudio);
gather.setSpeakSentence(speakSentence);
var response = new BandwidthBxml.Response();
response.addVerb(gather);
console.log(response.toBxml());
```
### Gather Response with no nested verbs

@@ -182,0 +216,0 @@

@@ -13,2 +13,57 @@ /**

//Tests for nested Gather
describe("Nested Gather", () => {
describe("set with Array", () => {
it("Should nest all verbs under the Gather", () => {
var expectedString = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><SpeakSentence>test1</SpeakSentence><PlayAudio>https://example.com</PlayAudio><SpeakSentence>test2</SpeakSentence></Gather></Response>';
var speak1 = new BxmlBuilder.Verbs.SpeakSentence();
speak1.setSentence('test1');
var playAudio = new BxmlBuilder.Verbs.PlayAudio();
playAudio.setUrl('https://example.com');
var speak2 = new BxmlBuilder.Verbs.SpeakSentence();
speak2.setSentence('test2')
var arr = [speak1, playAudio, speak2];
var gather = new BxmlBuilder.Verbs.Gather();
gather.setSpeakSentence(arr);
var response = new BxmlBuilder.Response();
response.addVerb(gather);
assert.equal(response.toBxml(), expectedString);
});
});
describe("set with Array and Single value", () => {
it("Should nest all verbs under the Gather", () => {
var expectedString = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><SpeakSentence>test1</SpeakSentence><PlayAudio>https://example.com</PlayAudio><SpeakSentence>test2</SpeakSentence></Gather></Response>';
var speak1 = new BxmlBuilder.Verbs.SpeakSentence();
speak1.setSentence('test1');
var playAudio = new BxmlBuilder.Verbs.PlayAudio();
playAudio.setUrl('https://example.com');
var speak2 = new BxmlBuilder.Verbs.SpeakSentence();
speak2.setSentence('test2')
var arr = [speak1, playAudio];
var gather = new BxmlBuilder.Verbs.Gather();
gather.setSpeakSentence(arr);
gather.setPlayAudio(speak2);
var response = new BxmlBuilder.Response();
response.addVerb(gather);
assert.equal(response.toBxml(), expectedString);
});
});
});
//Tests for Response

@@ -15,0 +70,0 @@ describe("Response", function() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc