Skip to content

Commit

Permalink
Merge pull request #70 from kendaleiv/master
Browse files Browse the repository at this point in the history
Fix GetMultipleTickets(Async) throwing 400 Bad Request for single ticket id
  • Loading branch information
eneifert committed Apr 24, 2014
2 parents ac7bc0e + 3951b00 commit b59d299
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions Tests/TicketTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,33 @@ public void CanGetMultipleTickets()
Assert.AreEqual(tickets.Count, ids.Count);
}

[Test]
public async Task CanGetMultipleTicketsAsync()
{
var ids = new List<long>() { Settings.SampleTicketId, Settings.SampleTicketId2 };
var tickets = await api.Tickets.GetMultipleTicketsAsync(ids);
Assert.NotNull(tickets);
Assert.AreEqual(tickets.Count, ids.Count);
}

[Test]
public void CanGetMultipleTicketsSingleTicket()
{
var ids = new List<long>() { Settings.SampleTicketId };
var tickets = api.Tickets.GetMultipleTickets(ids);
Assert.NotNull(tickets);
Assert.AreEqual(tickets.Count, ids.Count);
}

[Test]
public async Task CanGetMultipleTicketsAsyncSingleTicket()
{
var ids = new List<long>() { Settings.SampleTicketId };
var tickets = await api.Tickets.GetMultipleTicketsAsync(ids);
Assert.NotNull(tickets);
Assert.AreEqual(tickets.Count, ids.Count);
}

[Test]
public void CorrectErrorMessagesAreThrown()
{
Expand Down
4 changes: 2 additions & 2 deletions ZendeskApi_v2/Requests/Tickets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public GroupCommentResponse GetTicketComments(long ticketId)

public GroupTicketResponse GetMultipleTickets(List<long> ids)
{
return GenericGet<GroupTicketResponse>(string.Format("{0}/show_many?ids={1}.json", _tickets, ids.ToCsv()));
return GenericGet<GroupTicketResponse>(string.Format("{0}/show_many.json?ids={1}", _tickets, ids.ToCsv()));
}

public IndividualTicketResponse CreateTicket(Ticket ticket)
Expand Down Expand Up @@ -326,7 +326,7 @@ public async Task<GroupCommentResponse> GetTicketCommentsAsync(long ticketId)

public async Task<GroupTicketResponse> GetMultipleTicketsAsync(List<long> ids)
{
return await GenericGetAsync<GroupTicketResponse>(string.Format("{0}/show_many?ids={1}.json", _tickets, ids.ToCsv()));
return await GenericGetAsync<GroupTicketResponse>(string.Format("{0}/show_many.json?ids={1}", _tickets, ids.ToCsv()));
}

public async Task<IndividualTicketResponse> CreateTicketAsync(Ticket ticket)
Expand Down

0 comments on commit b59d299

Please sign in to comment.