Skip to content

Commit

Permalink
Expiration in minutes can be passed in when creating a hold token
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Aug 31, 2018
1 parent 530323b commit 8f159fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions SeatsioDotNet.Test/HoldTokens/CreateHoldTokenTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
7 changes: 7 additions & 0 deletions SeatsioDotNet/HoldTokens/HoldTokens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public HoldToken Create()
return AssertOk(_restClient.Execute<HoldToken>(restRequest));
}

public HoldToken Create(int expiresInMinutes)
{
var restRequest = new RestRequest("/hold-tokens", Method.POST)
.AddJsonBody(new {expiresInMinutes});
return AssertOk(_restClient.Execute<HoldToken>(restRequest));
}

public HoldToken ExpiresInMinutes(string token, int expiresInMinutes)
{
var restRequest = new RestRequest("/hold-tokens/{token}", Method.POST)
Expand Down
2 changes: 1 addition & 1 deletion SeatsioDotNet/SeatsioDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<Version>36</Version>
<Version>37</Version>
<Authors>mroloux;bverbeken</Authors>
<Title>Official Seats.io .NET API client</Title>
<Description>Official Seats.io .NET API client</Description>
Expand Down

0 comments on commit 8f159fa

Please sign in to comment.