Skip to content

Commit 3325162

Browse files
Merge pull request #15 from AdrianJSClark/2-league-get
Implement "league/get" Endpoint
2 parents 8060cff + a4bb33b commit 3325162

File tree

33 files changed

+501
-108
lines changed

33 files changed

+501
-108
lines changed

src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,36 @@ public async Task GetMemberRecentRacesSucceedsAsync()
315315
Assert.That(memberStats.TotalRateLimit, Is.EqualTo(100));
316316
Assert.That(memberStats.RateLimitReset, Is.EqualTo(new DateTimeOffset(2022, 2, 10, 0, 0, 0, TimeSpan.Zero)));
317317
}
318+
319+
[Test(TestOf = typeof(iRacingDataClient))]
320+
public async Task GetLeagueWithLicensesSucceedsAsync()
321+
{
322+
await MessageHandler.QueueResponsesAsync(nameof(GetLeagueWithLicensesSucceedsAsync)).ConfigureAwait(false);
323+
await sut.LoginAsync("test.user@example.com", "SuperSecretPassword", CancellationToken.None).ConfigureAwait(false);
324+
325+
var memberStats = await sut.GetLeagueAsync(123, true).ConfigureAwait(false);
326+
327+
Assert.That(memberStats, Is.Not.Null);
328+
Assert.That(memberStats!.Data, Is.Not.Null);
329+
330+
Assert.That(memberStats.RateLimitRemaining, Is.EqualTo(99));
331+
Assert.That(memberStats.TotalRateLimit, Is.EqualTo(100));
332+
Assert.That(memberStats.RateLimitReset, Is.EqualTo(new DateTimeOffset(2022, 2, 10, 0, 0, 0, TimeSpan.Zero)));
333+
}
334+
335+
[Test(TestOf = typeof(iRacingDataClient))]
336+
public async Task GetLeagueWithoutLicensesSucceedsAsync()
337+
{
338+
await MessageHandler.QueueResponsesAsync(nameof(GetLeagueWithoutLicensesSucceedsAsync)).ConfigureAwait(false);
339+
await sut.LoginAsync("test.user@example.com", "SuperSecretPassword", CancellationToken.None).ConfigureAwait(false);
340+
341+
var memberStats = await sut.GetLeagueAsync(123, false).ConfigureAwait(false);
342+
343+
Assert.That(memberStats, Is.Not.Null);
344+
Assert.That(memberStats!.Data, Is.Not.Null);
345+
346+
Assert.That(memberStats.RateLimitRemaining, Is.EqualTo(99));
347+
Assert.That(memberStats.TotalRateLimit, Is.EqualTo(100));
348+
Assert.That(memberStats.RateLimitReset, Is.EqualTo(new DateTimeOffset(2022, 2, 10, 0, 0, 0, TimeSpan.Zero)));
349+
}
318350
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"headers": {},
3+
"content": {
4+
"authcode": "51687dfd-1d8e-4faa-bf72-52cb36e4f762",
5+
"autoLoginSeries": null,
6+
"autoLoginToken": null,
7+
"custId": 123456,
8+
"email": "test.user@example.com",
9+
"ssoCookieDomain": ".iracing.com",
10+
"ssoCookieName": "irsso_membersv2",
11+
"ssoCookiePath": "/",
12+
"ssoCookieValue": "3883fc6a-890c-4c75-981c-84f2f9ebfb41"
13+
}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"headers": {
3+
"x-ratelimit-remaining": "99",
4+
"x-ratelimit-limit": "100",
5+
"x-ratelimit-reset": "1644451200"
6+
},
7+
"content": {
8+
"link": "https://scorpio-assets.s3.amazonaws.com/production/data-server/cache/data-services/league/get/e0a56003-c609-4a0e-a1d2-8fc4dcab92a6?AWSAccessKeyId=AKIAUO6OO4A3357USLO7&Expires=1642767750&Signature=XpwNF2L921Ry%2Frr%2FbATcfi2TyHY%3D"
9+
}
10+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"headers": {},
3+
"content": {
4+
"league_id": 8234,
5+
"owner_id": 341554,
6+
"league_name": "Adrian's Test League",
7+
"created": "2022-03-05T12:43:53Z",
8+
"hidden": false,
9+
"message": "https://iracing.adrianclark.dev",
10+
"about": "Adrian's league for testing things.",
11+
"url": "https://iracing.adrianclark.dev",
12+
"recruiting": false,
13+
"private_wall": false,
14+
"private_roster": false,
15+
"private_schedule": false,
16+
"private_results": false,
17+
"roster_count": 1,
18+
"owner": {
19+
"cust_id": 341554,
20+
"display_name": "Adrian Clark",
21+
"helmet": {
22+
"pattern": 50,
23+
"color1": "981F24",
24+
"color2": "000000",
25+
"color3": "ED2129",
26+
"face_type": 0,
27+
"helmet_type": 0
28+
},
29+
"car_number": null,
30+
"nick_name": null
31+
},
32+
"image": {
33+
"small_logo": null,
34+
"large_logo": null
35+
},
36+
"tags": {
37+
"categorized": [
38+
{
39+
"category_id": 1,
40+
"name": "Culture",
41+
"limit": 1,
42+
"tags": [
43+
{
44+
"tag_id": 5,
45+
"tag_name": "Professional"
46+
}
47+
]
48+
},
49+
{
50+
"category_id": 2,
51+
"name": "Type of Racing",
52+
"limit": null,
53+
"tags": [
54+
{
55+
"tag_id": 8,
56+
"tag_name": "Road"
57+
},
58+
{
59+
"tag_id": 10,
60+
"tag_name": "Grand-Prix"
61+
}
62+
]
63+
},
64+
{
65+
"category_id": 3,
66+
"name": "Car Setup",
67+
"limit": null,
68+
"tags": [
69+
{
70+
"tag_id": 12,
71+
"tag_name": "Open-Setup"
72+
}
73+
]
74+
}
75+
],
76+
"not_categorized": []
77+
},
78+
"roster": [
79+
{
80+
"cust_id": 341554,
81+
"display_name": "Adrian Clark",
82+
"helmet": {
83+
"pattern": 50,
84+
"color1": "981F24",
85+
"color2": "000000",
86+
"color3": "ED2129",
87+
"face_type": 0,
88+
"helmet_type": 0
89+
},
90+
"owner": true,
91+
"admin": true,
92+
"league_mail_opt_out": false,
93+
"league_pm_opt_out": false,
94+
"league_member_since": "2022-03-05T12:43:53Z",
95+
"car_number": null,
96+
"nick_name": null
97+
}
98+
]
99+
}
100+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"headers": {},
3+
"content": {
4+
"authcode": "51687dfd-1d8e-4faa-bf72-52cb36e4f762",
5+
"autoLoginSeries": null,
6+
"autoLoginToken": null,
7+
"custId": 123456,
8+
"email": "test.user@example.com",
9+
"ssoCookieDomain": ".iracing.com",
10+
"ssoCookieName": "irsso_membersv2",
11+
"ssoCookiePath": "/",
12+
"ssoCookieValue": "3883fc6a-890c-4c75-981c-84f2f9ebfb41"
13+
}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"headers": {
3+
"x-ratelimit-remaining": "99",
4+
"x-ratelimit-limit": "100",
5+
"x-ratelimit-reset": "1644451200"
6+
},
7+
"content": {
8+
"link": "https://scorpio-assets.s3.amazonaws.com/production/data-server/cache/data-services/stats/member_recent_races/e0a56003-c609-4a0e-a1d2-8fc4dcab92a6?AWSAccessKeyId=AKIAUO6OO4A3357USLO7&Expires=1642767750&Signature=XpwNF2L921Ry%2Frr%2FbATcfi2TyHY%3D"
9+
}
10+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"headers": {},
3+
"content": {
4+
"league_id": 8234,
5+
"owner_id": 341554,
6+
"league_name": "Adrian's Test League",
7+
"created": "2022-03-05T12:43:53Z",
8+
"hidden": false,
9+
"message": "https://iracing.adrianclark.dev",
10+
"about": "Adrian's league for testing things.",
11+
"url": "https://iracing.adrianclark.dev",
12+
"recruiting": false,
13+
"private_wall": false,
14+
"private_roster": false,
15+
"private_schedule": false,
16+
"private_results": false,
17+
"roster_count": 1,
18+
"owner": {
19+
"cust_id": 341554,
20+
"display_name": "Adrian Clark",
21+
"helmet": {
22+
"pattern": 50,
23+
"color1": "981F24",
24+
"color2": "000000",
25+
"color3": "ED2129",
26+
"face_type": 0,
27+
"helmet_type": 0
28+
},
29+
"car_number": null,
30+
"nick_name": null
31+
},
32+
"image": {
33+
"small_logo": null,
34+
"large_logo": null
35+
},
36+
"tags": {
37+
"categorized": [
38+
{
39+
"category_id": 1,
40+
"name": "Culture",
41+
"limit": 1,
42+
"tags": [
43+
{
44+
"tag_id": 5,
45+
"tag_name": "Professional"
46+
}
47+
]
48+
},
49+
{
50+
"category_id": 2,
51+
"name": "Type of Racing",
52+
"limit": null,
53+
"tags": [
54+
{
55+
"tag_id": 8,
56+
"tag_name": "Road"
57+
},
58+
{
59+
"tag_id": 10,
60+
"tag_name": "Grand-Prix"
61+
}
62+
]
63+
},
64+
{
65+
"category_id": 3,
66+
"name": "Car Setup",
67+
"limit": null,
68+
"tags": [
69+
{
70+
"tag_id": 12,
71+
"tag_name": "Open-Setup"
72+
}
73+
]
74+
}
75+
],
76+
"not_categorized": []
77+
},
78+
"roster": [
79+
{
80+
"cust_id": 341554,
81+
"display_name": "Adrian Clark",
82+
"helmet": {
83+
"pattern": 50,
84+
"color1": "981F24",
85+
"color2": "000000",
86+
"color3": "ED2129",
87+
"face_type": 0,
88+
"helmet_type": 0
89+
},
90+
"owner": true,
91+
"admin": true,
92+
"league_mail_opt_out": false,
93+
"league_pm_opt_out": false,
94+
"league_member_since": "2022-03-05T12:43:53Z",
95+
"car_number": null,
96+
"nick_name": null
97+
}
98+
]
99+
}
100+
}

src/Aydsko.iRacingData/Stats/WinnerHelmet.cs renamed to src/Aydsko.iRacingData/Common/Helmet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
using System.Text.Json.Serialization;
55

6-
namespace Aydsko.iRacingData.Stats;
6+
namespace Aydsko.iRacingData.Common;
77

8-
public class WinnerHelmet
8+
public class Helmet
99
{
1010
[JsonPropertyName("pattern")]
1111
public int Pattern { get; set; }

src/Aydsko.iRacingData/Member/Suit.cs renamed to src/Aydsko.iRacingData/Common/Suit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using System.Text.Json.Serialization;
55

6-
namespace Aydsko.iRacingData.Member;
6+
namespace Aydsko.iRacingData.Common;
77

88
public class Suit
99
{
@@ -16,5 +16,5 @@ public class Suit
1616
[JsonPropertyName("color3")]
1717
public string Color3 { get; set; } = default!;
1818
[JsonPropertyName("body_type")]
19-
public int BodyType { get; set; }
19+
public int? BodyType { get; set; }
2020
}

src/Aydsko.iRacingData/Series/Track.cs renamed to src/Aydsko.iRacingData/Common/Track.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using System.Text.Json.Serialization;
55

6-
namespace Aydsko.iRacingData.Series;
6+
namespace Aydsko.iRacingData.Common;
77

88
public class Track
99
{

0 commit comments

Comments
 (0)