Skip to content

Commit

Permalink
feat(client)
Browse files Browse the repository at this point in the history
add method for just converting inventory string to list format
  • Loading branch information
igeligel committed May 27, 2017
1 parent 88b921b commit a93a5e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/skadisteam.inventory/Factories/SkadiInventoryFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ internal static SkadiItemInventory CreateNew(
Rwgrsn = rootInventory.Rwgrsn,
Items = new List<Models.SkadiItemInventory.SkadiItem>()
};
if (rootInventory.Assets == null)
{
return skadiItemInventory;
}
foreach (var rootInventoryAsset in rootInventory.Assets)
{
var descriptionForItem =
Expand Down
11 changes: 11 additions & 0 deletions src/skadisteam.inventory/SkadiInventoryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ public static Models.SkadiItemInventory.SkadiItemInventory LoadInventoryItems(
return skadiInventory;
}

public static Models.SkadiItemInventory.SkadiItemInventory
ConvertInventoryItems(string inventoryResponse)
{
var inventory =
JsonConvert
.DeserializeObject<Models.Json.LoadItemInventory.
RootInventory>(inventoryResponse);
var skadiInventory = SkadiInventoryFactory.CreateNew(inventory);
return skadiInventory;
}

/// <summary>
/// Method to request the inventory of a private accessible inventory.
/// </summary>
Expand Down

0 comments on commit a93a5e0

Please sign in to comment.