From 8f159fa0d2e5cc4b900d3918bfc746fe8e8b8512 Mon Sep 17 00:00:00 2001 From: mroloux Date: Fri, 31 Aug 2018 12:04:15 +0200 Subject: [PATCH] Expiration in minutes can be passed in when creating a hold token --- SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs | 9 +++++++++ SeatsioDotNet/HoldTokens/HoldTokens.cs | 7 +++++++ SeatsioDotNet/SeatsioDotNet.csproj | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs b/SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs index 35245fb..ca58b17 100644 --- a/SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs +++ b/SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs @@ -12,6 +12,15 @@ public void Test() Assert.NotNull(holdToken.Token); CustomAssert.CloseTo(DateTime.Now.AddMinutes(15), holdToken.ExpiresAt); + } + + [Fact] + public void ExpiresInMinutes() + { + var holdToken = Client.HoldTokens.Create(5); + + Assert.NotNull(holdToken.Token); + CustomAssert.CloseTo(DateTime.Now.AddMinutes(5), holdToken.ExpiresAt); } } } \ No newline at end of file diff --git a/SeatsioDotNet/HoldTokens/HoldTokens.cs b/SeatsioDotNet/HoldTokens/HoldTokens.cs index 3ac6a7f..f835bfb 100644 --- a/SeatsioDotNet/HoldTokens/HoldTokens.cs +++ b/SeatsioDotNet/HoldTokens/HoldTokens.cs @@ -18,6 +18,13 @@ public HoldToken Create() return AssertOk(_restClient.Execute(restRequest)); } + public HoldToken Create(int expiresInMinutes) + { + var restRequest = new RestRequest("/hold-tokens", Method.POST) + .AddJsonBody(new {expiresInMinutes}); + return AssertOk(_restClient.Execute(restRequest)); + } + public HoldToken ExpiresInMinutes(string token, int expiresInMinutes) { var restRequest = new RestRequest("/hold-tokens/{token}", Method.POST) diff --git a/SeatsioDotNet/SeatsioDotNet.csproj b/SeatsioDotNet/SeatsioDotNet.csproj index 854ebd5..0360aca 100644 --- a/SeatsioDotNet/SeatsioDotNet.csproj +++ b/SeatsioDotNet/SeatsioDotNet.csproj @@ -2,7 +2,7 @@ Library true - 36 + 37 mroloux;bverbeken Official Seats.io .NET API client Official Seats.io .NET API client