Skip to content

Commit

Permalink
Merge pull request #274 from Vonage/devx-6173
Browse files Browse the repository at this point in the history
Refactoring NCCO Action to have get only property for action type
  • Loading branch information
matt-lethargic authored May 23, 2022
2 parents 4633892 + f151ea4 commit 90cce0a
Show file tree
Hide file tree
Showing 44 changed files with 447 additions and 363 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
14 changes: 7 additions & 7 deletions Vonage.Test.Unit/ConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public void SmsConversion(bool passCreds)
var expectedContent = "message-id=00A0B0C0&delivered=true&timestamp=2020-01-01+12%3A00%3A00&api_key=testkey&api_secret=testSecret&";
var expectedResponse = "";
Setup(expectedUri, expectedResponse, expectedContent);
var request = new Conversions.ConversionRequest { Delivered = "true", MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var creds = Request.Credentials.FromApiKeyAndSecret(ApiKey, ApiSecret);
var client = new VonageClient(creds);
var request = new Conversions.ConversionRequest { Delivered = true, MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var credentials = Request.Credentials.FromApiKeyAndSecret(ApiKey, ApiSecret);
var client = new VonageClient(credentials);
bool response;
if (passCreds)
{
response = client.ConversionClient.SmsConversion(request, creds);
response = client.ConversionClient.SmsConversion(request, credentials);
}
else
{
Expand All @@ -42,7 +42,7 @@ public void VoiceConversion(bool passCreds)
var expectedContent = "message-id=00A0B0C0&delivered=true&timestamp=2020-01-01+12%3A00%3A00&api_key=testkey&api_secret=testSecret&";
var expectedResponse = "";
Setup(expectedUri, expectedResponse, expectedContent);
var request = new Conversions.ConversionRequest { Delivered = "true", MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var request = new Conversions.ConversionRequest { Delivered = true, MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var creds = Request.Credentials.FromApiKeyAndSecret(ApiKey, ApiSecret);
var client = new VonageClient(creds);
bool response;
Expand All @@ -66,7 +66,7 @@ public async void SmsConversionAsync(bool passCreds)
var expectedContent = "message-id=00A0B0C0&delivered=true&timestamp=2020-01-01+12%3A00%3A00&api_key=testkey&api_secret=testSecret&";
var expectedResponse = "";
Setup(expectedUri, expectedResponse, expectedContent);
var request = new Conversions.ConversionRequest { Delivered = "true", MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var request = new Conversions.ConversionRequest { Delivered = true, MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var creds = Request.Credentials.FromApiKeyAndSecret(ApiKey, ApiSecret);
var client = new VonageClient(creds);
bool response;
Expand All @@ -90,7 +90,7 @@ public async void VoiceConversionAsync(bool passCreds)
var expectedContent = "message-id=00A0B0C0&delivered=true&timestamp=2020-01-01+12%3A00%3A00&api_key=testkey&api_secret=testSecret&";
var expectedResponse = "";
Setup(expectedUri, expectedResponse, expectedContent);
var request = new Conversions.ConversionRequest { Delivered = "true", MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var request = new Conversions.ConversionRequest { Delivered = true, MessageId = "00A0B0C0", TimeStamp = "2020-01-01 12:00:00" };
var creds = Request.Credentials.FromApiKeyAndSecret(ApiKey, ApiSecret);
var client = new VonageClient(creds);
bool response;
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"
}
]
15 changes: 15 additions & 0 deletions Vonage.Test.Unit/Data/NccoTests/TestConversation-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"action": "conversation",
"name": "vonage-conference-standard",
"musicOnHoldUrl": [
"https://example.com/music.mp3"
],
"canSpeak": [
"6a4d6af0-55a6-4667-be90-8614e4c8e83c"
],
"canHear": [
"6a4d6af0-55a6-4667-be90-8614e4c8e83c"
]
}
]
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": "true",
"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
Loading

0 comments on commit 90cce0a

Please sign in to comment.