Skip to content

Commit

Permalink
Refactoring NCCO Action to have get only property for action type
Browse files Browse the repository at this point in the history
Removal of NccoConverter
Tests that use NCCO refactored
  • Loading branch information
matt-lethargic committed May 17, 2022
1 parent 70fdc16 commit 2e56d85
Show file tree
Hide file tree
Showing 37 changed files with 323 additions and 322 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Changes in version 6.x

* Enum values are now caplitalised in alignment with accepted coding practices
* All classes in the Nexmo namespace that were marked as deprecated in 5.x are now removed
*
* Ncco now inherits from List, it no longer has the `Actions` property, to add an action use `ncco.Add(action);`

## Targeted frameworks

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{
"action": "input",
"dtmf": {
"timeOut": 3,
"maxDigits": 1,
Expand All @@ -18,7 +19,6 @@
],
"startTimeout": 5,
"maxDuration": 30
},
"action": "input"
}
}
]
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"action": "input",
"dtmf": {
},
"speech": {
"uuid": [
"aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
]
},
"action": "input"
}
}
]
4 changes: 4 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestAppEndpoint-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"user": "steve",
"type": "app"
}
26 changes: 26 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestConnect-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"action": "connect",
"endpoint": [
{
"number": "447700900001",
"dtmfAnswer": "2p02p",
"onAnswer": {
"url": "https://example.com/answer",
"ringbackTone": "http://example.com/ringbackTone.wav"
},
"type": "phone"
}
],
"from": "447700900000",
"eventType": "synchronous",
"timeout": "60",
"limit": "7200",
"machineDetection": "continue",
"eventUrl": [
"https://exampe.com/webhooks/events"
],
"eventMethod": "POST",
"ringbackTone": "http://example.com/ringbackTone.wav"
}
]
18 changes: 18 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestConversation-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"action": "conversation",
"name": "vonage-conference-standard",
"musicOnHoldUrl": [
"https://example.com/music.mp3"
],
"startOnEnter": "true",
"endOnExit": "false",
"record": "true",
"canSpeak": [
"6a4d6af0-55a6-4667-be90-8614e4c8e83c"
],
"canHear": [
"6a4d6af0-55a6-4667-be90-8614e4c8e83c"
]
}
]
12 changes: 12 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestNotify-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"action": "notify",
"payload": {
"Bar": "foo"
},
"eventUrl": [
"https://example.com/webhooks/events"
],
"eventMethod": "POST"
}
]
17 changes: 17 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestRecord-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"action": "record",
"format": $format$,
"split": "conversation",
"channels": 2,
"endOnSilence": "3",
"endOnKey": "#",
"timeOut": "60",
"beepStart": "true",
"eventUrl": [
"https://example.com/record",
"https://test.com/record"
],
"eventMethod": "POST"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"action": "record"
}
]
7 changes: 7 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestSipEndpoint-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"uri": "sip:rebekka@sip.example.com",
"headers": {
"Bar": "foo"
},
"type": "sip"
}
11 changes: 11 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestStream-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"action": "stream",
"streamUrl": [
"https://acme.com/streams/music.mp3"
],
"level": "0",
"bargeIn": "true",
"loop": "2"
}
]
12 changes: 12 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestTalk-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"action": "talk",
"text": "Hello World",
"bargeIn": "true",
"loop": "2",
"level": "0",
"voiceName": "kimberly",
"language": "en-US",
"style": 0
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"action": "talk",
"text": "Hello World"
}
]
4 changes: 4 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestVbcEndpoint-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extension": "4567",
"type": "vbc"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"uri": "wss://example.com/ws",
"content-type": "audio/l16;rate=16000",
"headers": {
"Bar": "foo"
},
"type": "websocket"
}
4 changes: 2 additions & 2 deletions Vonage.Test.Unit/Data/VoiceTests/CreateCall.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"ncco": [
{
"text": "Hello World",
"action": "talk"
"action": "talk",
"text": "Hello World"
}
],
"answer_url": [
Expand Down
4 changes: 2 additions & 2 deletions Vonage.Test.Unit/Data/VoiceTests/CreateCallAsync.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"ncco": [
{
"text": "Hello World",
"action": "talk"
"action": "talk",
"text": "Hello World"
}
],
"answer_url": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"ncco": [
{
"text": "Hello World",
"action": "talk"
"action": "talk",
"text": "Hello World"
}
],
"answer_url": [
Expand Down
4 changes: 2 additions & 2 deletions Vonage.Test.Unit/MultiInputTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void TestSerializeNccoAllProperties()

//act
var ncco = new Ncco(inputAction);
var actual = ncco.ToString();
var actual = JsonConvert.SerializeObject(ncco, Serialization.VonageSerialization.SerializerSettings);

//assert
Assert.Equal(expected, actual);
Expand All @@ -54,7 +54,7 @@ public void TestSerializeNccoAllPropertiesEmpty()

//act
var ncco = new Ncco(inputAction);
var actual = ncco.ToString();
var actual = JsonConvert.SerializeObject(ncco, Serialization.VonageSerialization.SerializerSettings);

//assert
Assert.Equal(expected, actual);
Expand Down
Loading

0 comments on commit 2e56d85

Please # to comment.