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
5 changes: 4 additions & 1 deletion 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.14</version>
<version>1.1.15</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.15 - Jan 27 2017
- added dnc apis

Version 1.1.14 - Jan 17 2017
- added possibility to use client without config file

Expand Down
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.15 - Jan 27 2017
- added dnc apis

Version 1.1.14 - Jan 17 2017
- added possibility to use client without config file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public void FindCalls()
{
var request = new FindCallsRequest
{
States = { StateType.FINISHED, StateType.READY },
IntervalBegin = DateTime.UtcNow.AddMonths(-2),
IntervalBegin = DateTime.UtcNow.AddMonths(-10),
IntervalEnd = DateTime.UtcNow,
Limit = 1
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void TestFind()
};
Page<CampaignSound> campaignSounds = Client.CampaignSoundsApi.Find(request);

Assert.AreEqual(4, campaignSounds.TotalCount);
Assert.True(campaignSounds.TotalCount >= 3);
Assert.AreEqual(3, campaignSounds.Items.Count);

foreach (var item in campaignSounds.Items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ public void CrudOperations()

Assert.True(textAutoReplies.TotalCount > 0);
Assert.AreEqual(textAutoReplies.Items.Count, textAutoReplies.TotalCount);
var savedTextAutoReply = textAutoReplies.Items[textAutoReplies.Items.Count - 1];
Assert.AreEqual(resourceId.Id, savedTextAutoReply.Id);
Assert.AreEqual(textAutoReply.Number, savedTextAutoReply.Number);
Assert.AreEqual(textAutoReply.Message, savedTextAutoReply.Message);
Assert.AreEqual(textAutoReply.Match, savedTextAutoReply.Match);

savedTextAutoReply = Client.TextAutoRepliesApi.Get(resourceId.Id, "number,message");
var savedTextAutoReply = Client.TextAutoRepliesApi.Get(resourceId.Id, "number,message");
Console.WriteLine(savedTextAutoReply);

Assert.IsNull(savedTextAutoReply.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,39 @@ public class ContactsApiIntegrationTest : AbstractIntegrationTest
[Test]
public void Find()
{
var request = new FindContactsRequest
{
Number = new List<string> { "16506190257", "18778973473" },
Id = new List<long> { 1, 2 }
};
var request = new FindContactsRequest{};
var contacts = Client.ContactsApi.Find(request);
Console.WriteLine(String.Join(",", contacts));

Assert.AreEqual(1, contacts.Items.Count);
Assert.AreEqual("18088395900", contacts.Items[0].WorkPhone);
Assert.AreEqual(100, contacts.Items.Count);

string numberToFilter;
numberToFilter = null;

if (contacts.Items[0].HomePhone != null)
{
numberToFilter = contacts.Items[0].HomePhone;
}
else if (contacts.Items[0].WorkPhone != null)
{
numberToFilter = contacts.Items[0].WorkPhone;
}
else if (contacts.Items[0].MobilePhone != null)
{
numberToFilter = contacts.Items[0].MobilePhone;
}

if (numberToFilter != null)
{
request = new FindContactsRequest
{
Number = new List<string> { numberToFilter }
};
contacts = Client.ContactsApi.Find(request);
Assert.True(numberToFilter.Equals(contacts.Items[0].WorkPhone) ||
numberToFilter.Equals(contacts.Items[0].MobilePhone) ||
numberToFilter.Equals(contacts.Items[0].HomePhone));
}
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ namespace CallfireApiClient.IntegrationTests.Api.Contacts
[TestFixture]
public class DncApiIntegrationTest : AbstractIntegrationTest
{
//TODO vmalinovskiy: uncomment when dnc apis will be tested and available on docs site
/*

[Test]
public void FindDncs()
{
Expand Down Expand Up @@ -107,6 +106,6 @@ public void FindUniversalDncs()
Assert.NotNull(uDncs[0].OutboundCall);
Assert.NotNull(uDncs[0].OutboundText);
}
*/

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void GetNumberLease()

Assert.IsNotNull(lease.Region);
Assert.AreEqual(number, lease.PhoneNumber);
Assert.AreEqual(lease.Labels.Count, 2);
Assert.True(lease.Labels.Count > 0);
Assert.That(lease.Region.City, Is.StringContaining("LOS ANGELES"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void CrudOperations()
Fields = "items(id,callback,name,resource,events,singleUse)"
};
var page = api.Find(findRequest);
Assert.That(page.Items.Count > 1);
Assert.That(page.Items.Count > 0);
Assert.AreEqual("test_name1", page.Items[0].Name);
Assert.AreEqual("test_callback", page.Items[0].Callback);
Assert.AreEqual(ResourceType.TEXT_BROADCAST, page.Items[0].Resource);
Expand Down
5 changes: 2 additions & 3 deletions src/CallfireApiClient.Tests/Api/Contacts/DncApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ namespace CallfireApiClient.Tests.Api.Contacts
[TestFixture]
public class DncApiTest : AbstractApiTest
{
//TODO vmalinovskiy: uncomment when dnc apis will be tested and available on docs site
/*

[Test]
public void Find()
{
Expand Down Expand Up @@ -177,6 +176,6 @@ public void FindUniversalDncs()
Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("fromNumber") && p.Value.Equals("18442800143")));
Assert.That(restRequest.Value.Parameters, Has.Some.Matches<Parameter>(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS)));
}
*/

}
}
5 changes: 2 additions & 3 deletions src/CallfireApiClient/Api/Contacts/DncApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ namespace CallfireApiClient.Api.Contacts
{
public class DncApi
{
//TODO vmalinovskiy: uncomment when dnc apis will be tested and available on docs site
/*

private const string DNC_PATH = "/contacts/dncs";
private const string DNC_SOURCES_PATH = "/contacts/dncs/sources/{}";
private const string UNIVERSAL_DNC_PATH = "/contacts/dncs/universals/{}";
Expand Down Expand Up @@ -146,6 +145,6 @@ public void DeleteDncsFromSource(string source)
string path = DNC_SOURCES_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, source);
Client.Delete(path);
}
*/

}
}
16 changes: 8 additions & 8 deletions src/CallfireApiClient/Api/Contacts/Model/DoNotContact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ namespace CallfireApiClient.Api.Contacts.Model
{
public class DoNotContact : CallfireModel
{
public string Number { get; set; }
public bool? Call { get; set; }
public bool? Text { get; set; }
//public long? CampaignId { get; private set; }
//public string Source { get; set; }
//public DateTime? Created { get; private set; }
public string Number { get; private set; }
public bool? Call { get; private set; }
public bool? Text { get; private set; }
public long? CampaignId { get; private set; }
public string Source { get; private set; }
public DateTime? Created { get; private set; }

public override string ToString()
{
return string.Format("[DoNotContact: number={0}, call={1}, text={2}",
Number, Call, Text);
return string.Format("[DoNotContact: number={0}, call={1}, text={2}, campaignId={3}, source={4}, created={5}",
Number, Call, Text, CampaignId, Source, Created);
}
}
}
8 changes: 2 additions & 6 deletions src/CallfireApiClient/CallfireClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public void SetClientConfig(ClientConfig config)

public KeywordLeasesApi KeywordLeasesApi { get { return _KeywordLeasesApi.Value; } }

//TODO vmalinovskiy: uncomment when dnc apis will be tested and available on docs site
//public DncApi DncApi { get { return _DncApi.Value; } }
public DncApi DncApi { get { return _DncApi.Value; } }

public CallsApi CallsApi { get { return _CallsApi.Value; } }

Expand Down Expand Up @@ -99,10 +98,7 @@ public CallfireClient(string username, string password)
_WebhooksApi = new Lazy<WebhooksApi>(() => new WebhooksApi(RestApiClient));
_KeywordsApi = new Lazy<KeywordsApi>(() => new KeywordsApi(RestApiClient));
_KeywordLeasesApi = new Lazy<KeywordLeasesApi>(() => new KeywordLeasesApi(RestApiClient));

//TODO vmalinovskiy: uncomment when dnc apis will be tested and available on docs site
//_DncApi = new Lazy<DncApi>(() => new DncApi(RestApiClient));

_DncApi = new Lazy<DncApi>(() => new DncApi(RestApiClient));
_CallsApi = new Lazy<CallsApi>(() => new CallsApi(RestApiClient));
_TextsApi = new Lazy<TextsApi>(() => new TextsApi(RestApiClient));
_TextAutoRepliesApi = new Lazy<TextAutoRepliesApi>(() => new TextAutoRepliesApi(RestApiClient));
Expand Down
2 changes: 1 addition & 1 deletion src/CallfireApiClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.1.14.*")]
[assembly: AssemblyVersion("1.1.15.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down