Skip to content

Commit

Permalink
Fixed get optimization profile endpoint
Browse files Browse the repository at this point in the history
Adjust OptimizationProfileEntities and OptimizationWithProfile examples
Adjust OptimizationProfileManagerV5Tests
  • Loading branch information
Dmitry Koval authored and Dmitry Koval committed Aug 7, 2024
1 parent ab8d6fc commit 9332023
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static class R4MEInfrastructureSettingsV5

#region Optimization Profiles
public const string OptimizationProfiles = MainHost + "/optimization-profiles";
public const string OptimizationProfilesList = OptimizationProfiles + "/list";
public const string OptimizationProfilesList = OptimizationProfiles + "/data-list";
public const string OptimizationProfilesSaveEntities = OptimizationProfiles + "/save-entities";
public const string OptimizationProfilesDeleteEntities = OptimizationProfiles + "/delete-entities";
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OptimizationProfilesResponse GetOptimizationProfiles(out ResultResponse r
{
var response = GetJsonObjectFromAPI<OptimizationProfilesResponse>(new GenericParameters(),
R4MEInfrastructureSettingsV5.OptimizationProfilesList,
HttpMethodType.Post, false, true,
HttpMethodType.Get, false, true,
out resultResponse);

return response;
Expand All @@ -36,7 +36,7 @@ public async Task<Tuple<OptimizationProfilesResponse, ResultResponse>> GetOptimi
{
var result = await GetJsonObjectFromAPIAsync<OptimizationProfilesResponse>(new GenericParameters(),
R4MEInfrastructureSettingsV5.OptimizationProfilesList,
HttpMethodType.Post,
HttpMethodType.Get,
null,
true,
false).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public void OptimizationProfileEntities()
{
var route4Me = new OptimizationProfileManagerV5(ActualApiKey);

var data = new JObject();
data["append_date_to_route_name"] = true;

var saveResult = route4Me.SaveEntities(
new OptimizationProfileSaveEntities()
{
Expand All @@ -24,7 +27,7 @@ public void OptimizationProfileEntities()
new()
{
Guid = "pav",
Data = JObject.Parse("{\"append_date_to_route_name\":true}")
Data = data
}
}
}
Expand All @@ -36,7 +39,7 @@ public void OptimizationProfileEntities()
{
Items = new OptimizationProfileDeleteEntitiesRequestItem[1]
{
new OptimizationProfileDeleteEntitiesRequestItem() { Id = saveResult.Items.First().Id }
new() { Id = saveResult.Items.First().Id }
}
}, out resultResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public void OptimizationWithProfile()
{
Addresses = addresses.ToArray(),

Parameters = parameters
Parameters = parameters,

OptimizationProfileId = optimizationProfile.Id
};

var route4Me = new Route4MeManager(ActualApiKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public void SaveEntitiesTest()
{
var route4Me = new OptimizationProfileManagerV5(CApiKey);

var data = new JObject();
data["append_date_to_route_name"] = true;

var result = route4Me.SaveEntities(
new OptimizationProfileSaveEntities()
{
Expand All @@ -39,7 +42,7 @@ public void SaveEntitiesTest()
new()
{
Guid = "pav",
Data = JObject.Parse("{\"append_date_to_route_name\":true}")
Data = data
}
}
}
Expand All @@ -54,6 +57,9 @@ public void DeleteEntitiesTest()
{
var route4Me = new OptimizationProfileManagerV5(CApiKey);

var data = new JObject();
data["append_date_to_route_name"] = true;

var saveResult = route4Me.SaveEntities(
new OptimizationProfileSaveEntities()
{
Expand All @@ -67,7 +73,7 @@ public void DeleteEntitiesTest()
new()
{
Guid = "pav",
Data = JObject.Parse("{\"append_date_to_route_name\":true}")
Data = data
}
}
}
Expand Down

0 comments on commit 9332023

Please sign in to comment.