Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CallfireApiClient.nuspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><package>
<metadata>
<id>CallfireApiClient</id>
<version>1.1.17</version>
<version>1.1.18</version>
<title>CallFire API v2 client</title>
<authors>
Vladimir Mikhailov
Expand All @@ -15,6 +15,9 @@
<description>C# client library for integration with Callfire REST API v2 services</description>
<releaseNotes>Callfire API client Changelog
=============================
Version 1.1.18 - May 29 2017
- upgraded dependencies

Version 1.1.17 - May 4 2017
- removed subscriptions api (not supported from v2 api client)
- fixed findWebhooks api to use enums instead strings
Expand Down Expand Up @@ -107,7 +110,6 @@ Version 1.0.0 - Dec 29 2015
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.dll" target="lib"/>
<file src="src/CallfireApiClient/bin/Release/callfire-api-client.dll.config" target="lib"/>
<file src="src/CallfireApiClient/bin/Release/callfire-api-client.xml" target="lib"/>
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.pdb" target="lib"/>
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.dll.mdb" target="lib"/>
</files>
</package>
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Callfire API client Changelog
=============================
Version 1.1.18 - May 29 2017
- upgraded dependencies

Version 1.1.17 - May 4 2017
- removed subscriptions api (not supported from v2 api client)
- fixed findWebhooks api to use enums instead strings
Expand Down
174 changes: 91 additions & 83 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import groovy.xml.XmlUtil
import groovy.xml.StreamingMarkupBuilder

plugins {
id 'com.ullink.msbuild' version '2.14'
id 'com.ullink.nuget' version '2.12'
id 'com.ullink.nunit' version '1.4'
id 'com.ullink.opencover' version '1.2'
id 'net.researchgate.release' version '2.3.4'
id 'com.github.jlouns.cpe' version '0.4.1'
id 'com.ullink.msbuild' version '2.16'
id 'com.ullink.nuget' version '2.15'
id 'com.ullink.nunit' version '1.10'
id 'com.ullink.opencover' version '1.7'
id 'net.researchgate.release' version '2.6.0'
id 'com.github.jlouns.cpe' version '0.5.0'
id "co.riiid.gradle" version "0.4.2"
}

Expand Down Expand Up @@ -50,41 +50,43 @@ nunit {
}
nunit.dependsOn msbuild

task updateNuspecFile << {
def specFile = file('CallfireApiClient.nuspec')
def spec = new XmlSlurper().parse(specFile)

project.version = patchVersion(spec.metadata.version.text)
spec.metadata.version = project.version
spec.metadata.releaseNotes = file('Changelog.txt').text
// cleanup previous lib/ and src/ files since they depend on build configuration
spec.files.file.findAll { it.@target == 'lib' || it.@target == 'src' }.each { it.replaceNode {} }

def isWindowsOs = Os.isFamily(Os.FAMILY_WINDOWS)
def monoInstallation = "$System.env.MONO_HOME"
def pdbToMdbConverter
if (isWindowsOs) {
if (monoInstallation != 'null') {
pdbToMdbConverter = "$System.env.MONO_HOME" + "\\bin\\pdb2mdb.bat"
exec { commandLine = [pdbToMdbConverter, "$assemblyBinDebugDir/${archivesBaseName}.dll"] }
}
}
task updateNuspecFile {
doLast {
def specFile = file('CallfireApiClient.nuspec')
def spec = new XmlSlurper().parse(specFile)

spec.files.appendNode {
file(src: "src/**/*.cs", target: 'src') {}
file(src: "$assemblyBinDebugDir/${archivesBaseName}.dll", target: 'lib') {}
file(src: "$assemblyBinReleaseDir/${archivesBaseName}.dll.config", target: 'lib') {}
file(src: "$assemblyBinReleaseDir/${archivesBaseName}.xml", target: 'lib') {}
project.version = patchVersion(spec.metadata.version.text)
spec.metadata.version = project.version
spec.metadata.releaseNotes = file('Changelog.txt').text
// cleanup previous lib/ and src/ files since they depend on build configuration
spec.files.file.findAll { it.@target == 'lib' || it.@target == 'src' }.each { it.replaceNode {} }

def isWindowsOs = Os.isFamily(Os.FAMILY_WINDOWS)
def monoInstallation = "$System.env.MONO_HOME"
def pdbToMdbConverter
if (isWindowsOs) {
file(src: "$assemblyBinDebugDir/${archivesBaseName}.pdb", target: 'lib') {}
if (monoInstallation != 'null') {
pdbToMdbConverter = "$System.env.MONO_HOME" + "\\bin\\pdb2mdb.bat"
exec { commandLine = [pdbToMdbConverter, "$assemblyBinDebugDir/${archivesBaseName}.dll"] }
}
}

spec.files.appendNode {
file(src: "src/**/*.cs", target: 'src') {}
file(src: "$assemblyBinDebugDir/${archivesBaseName}.dll", target: 'lib') {}
file(src: "$assemblyBinReleaseDir/${archivesBaseName}.dll.config", target: 'lib') {}
file(src: "$assemblyBinReleaseDir/${archivesBaseName}.xml", target: 'lib') {}
if (isWindowsOs) {
file(src: "$assemblyBinDebugDir/${archivesBaseName}.pdb", target: 'lib') {}
}
file(src: "$assemblyBinDebugDir/${archivesBaseName}.dll.mdb", target: 'lib') {}
}
file(src: "$assemblyBinDebugDir/${archivesBaseName}.dll.mdb", target: 'lib') {}

def fw = new FileWriter('CallfireApiClient.nuspec')
XmlUtil.serialize(spec, fw)
// have to close manually because on windows file remains locked
fw.close()
}

def fw = new FileWriter('CallfireApiClient.nuspec')
XmlUtil.serialize(spec, fw)
// have to close manually because on windows file remains locked
fw.close()
}
updateNuspecFile.dependsOn msbuildDebug

Expand Down Expand Up @@ -122,34 +124,36 @@ nugetPack {
}
nugetPack.dependsOn zipBinaries

task prepareTestData () << {
def inFile = file('src/CallfireApiClient.IntegrationTests/App.config')
def xml = new XmlSlurper().parse(inFile)

def apiLogin
def apiPassword

try {
apiLogin = "${testApiUsername}"
apiPassword = "${testApiPassword}"
println([ msbuild.projects['CallfireApiClient.IntegrationTests'].properties.TargetPath ])
} catch(Exception ex) {
println("Api Username and/or Password are empty, you can't run integrationTests task, set them with -PtestApiUsername/-PtestApiPassword options")
apiLogin = "login"
apiPassword = "password"
}

if (apiLogin != 'null' && apiPassword != 'null') {
xml.appSettings.add.findAll { it.@key == 'testLogin' || it.@key == 'testPassword' }.each { it.replaceNode {} }
xml.appSettings.appendNode {
add(key: "testLogin", value: apiLogin) {}
add(key: "testPassword", value: apiPassword) {}
task prepareTestData {
doLast {
def inFile = file('src/CallfireApiClient.IntegrationTests/App.config')
def xml = new XmlSlurper().parse(inFile)

def apiLogin
def apiPassword

try {
apiLogin = "${testApiUsername}"
apiPassword = "${testApiPassword}"
println([ msbuild.projects['CallfireApiClient.IntegrationTests'].properties.TargetPath ])
} catch(Exception ex) {
println("Api Username and/or Password are empty, you can't run integrationTests task, set them with -PtestApiUsername/-PtestApiPassword options")
apiLogin = "login"
apiPassword = "password"
}

if (apiLogin != 'null' && apiPassword != 'null') {
xml.appSettings.add.findAll { it.@key == 'testLogin' || it.@key == 'testPassword' }.each { it.replaceNode {} }
xml.appSettings.appendNode {
add(key: "testLogin", value: apiLogin) {}
add(key: "testPassword", value: apiPassword) {}
}
}
def fw = new FileWriter('src/CallfireApiClient.IntegrationTests/App.config')
XmlUtil.serialize(xml, fw)
// have to close manually because on windows file remains locked
fw.close()
}
def fw = new FileWriter('src/CallfireApiClient.IntegrationTests/App.config')
XmlUtil.serialize(xml, fw)
// have to close manually because on windows file remains locked
fw.close()
}

task msbuildForIntegrationTests (type: com.ullink.Msbuild) {
Expand All @@ -164,29 +168,33 @@ task integrationTests (type: com.ullink.gradle.nunit.NUnit) {
}
integrationTests.dependsOn msbuildForIntegrationTests

task prepareReleaseData () << {
try {
println("${gitHubOwner}")
println("${gitHubToken}")
} catch(Exception ex) {
println("GitHub Owner and/or Token are empty, you can't run github release task, set them with -PgitHubOwner/-PgitHubToken options")
task prepareReleaseData {
doLast {
try {
println("${gitHubOwner}")
println("${gitHubToken}")
} catch(Exception ex) {
println("GitHub Owner and/or Token are empty, you can't run github release task, set them with -PgitHubOwner/-PgitHubToken options")
}
}
}
prepareReleaseData.dependsOn nugetPack

task configureCustomGitHubRelease () << {
github {
owner = "${gitHubOwner}"
repo = 'callfire-api-client-csharp'
token = "${gitHubToken}"
tagName = project.version
targetCommitish = 'master'
name = project.version
body = releaseDescription()
assets = [
'build/dist/CallfireApiClient-' + project.version + '.zip',
'build/dist/CallfireApiClient.' + project.version + '.nupkg'
]
task configureCustomGitHubRelease {
doLast {
github {
owner = "${gitHubOwner}"
repo = 'callfire-api-client-csharp'
token = "${gitHubToken}"
tagName = project.version
targetCommitish = 'master'
name = project.version
body = releaseDescription()
assets = [
'build/dist/CallfireApiClient-' + project.version + '.zip',
'build/dist/CallfireApiClient.' + project.version + '.nupkg'
]
}
}
}
configureCustomGitHubRelease.dependsOn prepareReleaseData
Expand All @@ -206,4 +214,4 @@ def releaseDescription() {
String secondVersionEntry = releaseNotes.find(~/Version.*/)
String currentReleaseChanges = releaseNotes.substring(0, (secondVersionEntry == null ? releaseNotes.size() - 1 : releaseNotes.indexOf(secondVersionEntry))).trim()
"$currentReleaseChanges"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void GetCallRecordings()

recs = Client.CallsApi.GetCallRecordings((long)rec.CallId, "items(callId)");
Assert.Null(recs[0].Id);
Assert.Null(recs[0].CallId);
Assert.NotNull(recs[0].CallId);
}

[Test]
Expand All @@ -131,7 +131,7 @@ public void GetCallRecordingByName()

recording = Client.CallsApi.GetCallRecordingByName((long)rec.CallId, rec.Name, "callId");
Assert.Null(recording.Id);
Assert.Null(recording.CallId);
Assert.NotNull(recording.CallId);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,34 @@ public void StartStopArchiveCampaign()
[Test]
public void GetBroadcastCalls()
{
var getCallsRequest = new GetByIdRequest { Id = 1 };
var broadcast = new CallBroadcast
{
Name = "call_broadcast",
AnsweringMachineConfig = AnsweringMachineConfig.AM_AND_LIVE,
Sounds = new CallBroadcastSounds
{
LiveSoundText = "Hello! This is a live answer text to speech recording",
LiveSoundTextVoice = Voice.MALE1,
MachineSoundText = "This is an answering machine text to speech recording",
MachineSoundTextVoice = Voice.MALE1
},
Recipients = new List<Recipient>
{
new Recipient { PhoneNumber = "12132041238" },
new Recipient { PhoneNumber = "14246525473" }
}
};
var id = Client.CallBroadcastsApi.Create(broadcast, false);

var getCallsRequest = new GetByIdRequest { Id = id.Id };
var calls = Client.CallBroadcastsApi.GetCalls(getCallsRequest);
System.Console.WriteLine(calls);
Assert.That(calls.Items, Is.Not.Empty);

long testBatchId = (long) calls.Items[0].BatchId;

getCallsRequest = new GetBroadcastCallsTextsRequest { Id = 1, BatchId = testBatchId };
calls = Client.CallBroadcastsApi.GetCalls(getCallsRequest);
var getCallsRequestNew = new GetBroadcastCallsTextsRequest { Id = id.Id, BatchId = testBatchId };
calls = Client.CallBroadcastsApi.GetCalls(getCallsRequestNew);
System.Console.WriteLine(calls);
Assert.AreEqual(calls.Items[0].BatchId, testBatchId);
}
Expand Down
6 changes: 3 additions & 3 deletions src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745">
<HintPath>..\..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="nunit.framework">
Expand All @@ -40,9 +43,6 @@
<Reference Include="RestSharp">
<HintPath>..\..\packages\RestSharp.105.2.3\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip">
<HintPath>..\..\packages\DotNetZip.1.9.7\lib\net20\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="System.Xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"intervalStart": 1000000000000,
"intervalEnd": 1000000000000,
"remainingPlanCredits": 0.0000,
"remainingPayAsYouGoCredits": 2015.0000,
"totalRemainingCredits": 2015.0000
"remainingPlanCredits": 0.0,
"remainingPayAsYouGoCredits": 2015.0,
"totalRemainingCredits": 2015.0
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"intervalEnd": 1000000000000,
"callsDurationMinutes": 100,
"textsSent": 2015,
"creditsUsed": 2015.000
"creditsUsed": 2015.0
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"totalOutboundCount": 3,
"remainingOutboundCount": 0,
"billedAmount": 0.0000,
"billedAmount": 0.0,
"callsAttempted": 3,
"callsPlaced": 3,
"callsDuration": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"totalOutboundCount": 6,
"remainingOutboundCount": 0,
"billedAmount": 0.0000,
"billedAmount": 0.0,
"sentCount": 0,
"unsentCount": 0,
"recievedCount": 0,
Expand Down
2 changes: 1 addition & 1 deletion src/CallfireApiClient.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.9.7" targetFramework="net40" />
<package id="DotNetZip" version="1.10.1" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net40" />
<package id="NUnit.Runners.Net4" version="2.6.4" targetFramework="net40" />
<package id="RestSharp" version="105.2.3" targetFramework="net40" />
Expand Down
6 changes: 3 additions & 3 deletions src/CallfireApiClient/CallfireApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
<DocumentationFile>bin\Release\callfire-api-client.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="RestSharp">
<HintPath>..\..\packages\RestSharp.105.2.3\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Api\Account\Model\CreditsUsage.cs" />
Expand Down
Loading