Skip to content

Commit

Permalink
Merge pull request #17 from guibranco/develop
Browse files Browse the repository at this point in the history
Fix naming
  • Loading branch information
guibranco authored Sep 21, 2020
2 parents b3b72d5 + aa601e0 commit 880357f
Show file tree
Hide file tree
Showing 30 changed files with 373 additions and 121 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

The [VTEX platform](https://www.nuget.org/packages/VTEX) SDK for .NET projects (both Core & Framework).

[![GitHub license](https://img.shields.io/github/license/guibranco/VTEX-SDK-dotnet)](https://github.com/guibranco/VTEX-SDK-dotnet)
[![Time tracker](https://wakatime.com/badge/github/guibranco/VTEX-SDK-dotnet.svg)](https://wakatime.com/badge/github/guibranco/VTEX-SDK-dotnet)

![VTEX logo](https://raw.githubusercontent.com/guibranco/VTEX-SDK-dotnet/master/logo.png)

## CI/CD

[![Build status](https://ci.appveyor.com/api/projects/status/kuso66xs0ljrcxfn?svg=true)](https://ci.appveyor.com/project/guibranco/vtex-sdk-dotnet)
[![VTEX NuGet Version](https://img.shields.io/nuget/v/VTEX.svg?style=flat)](https://www.nuget.org/packages/VTEX/)
[![VTEX NuGet Downloads](https://img.shields.io/nuget/dt/VTEX.svg?style=flat)](https://www.nuget.org/packages/VTEX/)
[![Github All Releases](https://img.shields.io/github/downloads/guibranco/VTEX-SDK-dotnet/total.svg?style=flat)](https://github.com/guibranco/VTEX-SDK-dotnet)
[![Last release](https://img.shields.io/github/release-date/guibranco/VTEX-SDK-dotnet.svg?style=flat)](https://github.com/guibranco/VTEX-SDK-dotnet)
[![time tracker](https://wakatime.com/badge/github/guibranco/VTEX-SDK-dotnet.svg)](https://wakatime.com/badge/github/guibranco/VTEX-SDK-dotnet)
| Branch | Build status | Last commit | Tests |
|--------|--------------|-------------|-------|
| Master | [![Build status](https://ci.appveyor.com/api/projects/status/kuso66xs0ljrcxfn/branch/master?svg=true)](https://ci.appveyor.com/project/guibranco/vtex-sdk-dotnet/branch/master) | [![GitHub last commit](https://img.shields.io/github/last-commit/guibranco/VTEX-SDK-dotnet/master)](https://github.com/guibranco/VTEX-SDK-dotnet) | ![AppVeyor tests (branch)](https://img.shields.io/appveyor/tests/guibranco/vtex-sdk-dotnet/master?compact_message) |
| Develop | [![Build status](https://ci.appveyor.com/api/projects/status/kuso66xs0ljrcxfn/branch/develop?svg=true)](https://ci.appveyor.com/project/guibranco/vtex-sdk-dotnet/branch/develop) | [![GitHub last commit](https://img.shields.io/github/last-commit/guibranco/vtex-sdk-dotnet/develop)](https://github.com/guibranco/VTEX-SDK-dotnet) | ![AppVeyor tests (branch)](https://img.shields.io/appveyor/tests/guibranco/vtex-sdk-dotnet/develop?compact_message) |

## Code Quality

Expand All @@ -35,17 +36,18 @@ The [VTEX platform](https://www.nuget.org/packages/VTEX) SDK for .NET projects (

## Installation

Download the latest zip file from the [Release pages](https://github.com/guibranco/VTEX/releases) or simple install from [NuGet](https://www.nuget.org/packages/VTEX) package manager

NuGet URL: [https://www.nuget.org/packages/VTEX](https://www.nuget.org/packages/VTEX)
### Github Releases

NuGet installation via *Package Manager Console*:
[![GitHub last release](https://img.shields.io/github/release-date/guibranco/VTEX-SDK-dotnet.svg?style=flat)](https://github.com/guibranco/VTEX-SDK-dotnet) [![Github All Releases](https://img.shields.io/github/downloads/guibranco/VTEX-SDK-dotnet/total.svg?style=flat)](https://github.com/guibranco/VTEX-SDK-dotnet)

```ps
Download the latest zip file from the [Release](https://github.com/GuiBranco/VTEX-SDK-dotnet/releases) page.

Install-Package VTEX
### Nuget package manager

```
| Package | Version | Downloads |
|------------------|:-------:|:-------:|
| **VTEX** | [![VTEX NuGet Version](https://img.shields.io/nuget/v/VTEX.svg?style=flat)](https://www.nuget.org/packages/VTEX/) | [![VTEX NuGet Downloads](https://img.shields.io/nuget/dt/VTEX.svg?style=flat)](https://www.nuget.org/packages/VTEX/) |
| **VTEX.Health** | [![VTEX Health NuGet Version](https://img.shields.io/nuget/v/VTEX.Health.svg?style=flat)](https://www.nuget.org/packages/VTEX.Health/) | [![VTEX Health NuGet Downloads](https://img.shields.io/nuget/dt/VTEX.Health.svg?style=flat)](https://www.nuget.org/packages/VTEX.Health/) |

---

Expand Down
4 changes: 2 additions & 2 deletions Src/VTEX.API/VTEX.API.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CrispyWaffle" Version="1.2.57" />
<PackageReference Include="CrispyWaffle" Version="2.5.10" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Src/VTEX.Core/VTEX.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CrispyWaffle" Version="1.2.57" />
<PackageReference Include="CrispyWaffle" Version="2.5.10" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions Src/VTEX.Health/PlatformStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public string StatusInternal
set
{
if (!string.IsNullOrWhiteSpace(value))
{
Status = EnumExtensions.GetEnumByInternalValueAttribute<ResultStatus>(value);
}
}
}

Expand Down
29 changes: 27 additions & 2 deletions Src/VTEX.Health/VTEX.Health.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<ProjectGuid>{931C39A1-583E-4264-AC7C-508C7B1FC15E}</ProjectGuid>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Guilherme Branco Stracini</Company>
<Authors>Guilherme Branco Stracini</Authors>
<Description>The VTEX platform (PaaS) (e-commerce) SDK. A .NET client to consume VTEX APIs for both Core and Framework projects</Description>
<Copyright>© 2020 Guilherme Branco Stracini. All rights reserved.</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://guibranco.github.io/VTEX-SDK-dotnet/</PackageProjectUrl>
<PackageIcon>packageLogo.png</PackageIcon>
<RepositoryUrl>https://github.com/guibranco/VTEX-SDK-dotnet</RepositoryUrl>
<RepositoryType>GIT</RepositoryType>
<PackageTags>vtex paas client sdk ecommerce e-commerce platform apis</PackageTags>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CrispyWaffle" Version="1.2.57" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.3" />
<PackageReference Include="CrispyWaffle" Version="2.5.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\..\packageLogo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions Src/VTEX.Health/VtexHealthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public class VtexHealthClient : IVtexHealthClient
public VtexHealthClient(ILoggerFactory loggerFactory, HttpClient httpClient)
{
if (loggerFactory == null)
{
throw new ArgumentNullException(nameof(loggerFactory));
}

_logger = loggerFactory.CreateLogger<VtexHealthClient>();
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
}
Expand All @@ -38,8 +41,8 @@ public VtexHealthClient(ILoggerFactory loggerFactory, HttpClient httpClient)
public async Task<IEnumerable<PlatformStatus>> GetPlatformStatuesAsync(CancellationToken cancellationToken)
{
_logger.LogDebug("Getting platform status");
var response = await _httpClient.GetAsync("/", cancellationToken);
var responseContent = await response.Content.ReadAsStringAsync();
var response = await _httpClient.GetAsync("/", cancellationToken).ConfigureAwait(false);
var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
_logger.LogDebug($"Platform status response: {response.StatusCode}");
return response.IsSuccessStatusCode ? JsonConvert.DeserializeObject<PlatformStatus[]>(responseContent) : default;
}
Expand Down
3 changes: 3 additions & 0 deletions Src/VTEX/GoodPractices/UnexpectedApiResponseException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ protected UnexpectedApiResponseException(SerializationInfo info, StreamingContex
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException(nameof(info));
}

info.AddValue("Request", Request);
info.AddValue("Response", Response);
info.AddValue("StatusCode", StatusCode);
Expand Down
10 changes: 5 additions & 5 deletions Src/VTEX/GoodPractices/UpdatePriceInfoSKUException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
/// <seealso cref="Exception" />

[Serializable]
public class UpdatePriceInfoSKUException : Exception
public class UpdatePriceInfoSkuException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdatePriceInfoSKUException"/> class.
/// Initializes a new instance of the <see cref="UpdatePriceInfoSkuException"/> class.
/// </summary>
/// <param name="skuId">The sku identifier.</param>
/// <param name="innerException">The inner exception.</param>
public UpdatePriceInfoSKUException(int skuId, Exception innerException)
public UpdatePriceInfoSkuException(int skuId, Exception innerException)
: base($"Unable to update the price of SKU {skuId} in VTEX platform", innerException)
{ }

/// <summary>
/// Initializes a new instance of the <see cref="UpdatePriceInfoSKUException"/> class.
/// Initializes a new instance of the <see cref="UpdatePriceInfoSkuException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
protected UpdatePriceInfoSKUException(SerializationInfo info, StreamingContext context) : base(info, context)
protected UpdatePriceInfoSkuException(SerializationInfo info, StreamingContext context) : base(info, context)
{ }
}
}
10 changes: 5 additions & 5 deletions Src/VTEX/GoodPractices/UpdateStockInfoSKUException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
/// <seealso cref="Exception" />

[Serializable]
public class UpdateStockInfoSKUException : Exception
public class UpdateStockInfoSkuException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdateStockInfoSKUException"/> class.
/// Initializes a new instance of the <see cref="UpdateStockInfoSkuException"/> class.
/// </summary>
/// <param name="skuId">The sku identifier.</param>
/// <param name="innerException">The inner exception.</param>
public UpdateStockInfoSKUException(int skuId, Exception innerException)
public UpdateStockInfoSkuException(int skuId, Exception innerException)
: base($"Unable to update the stock of SKU {skuId} in VTEX platform", innerException)
{ }

/// <summary>
/// Initializes a new instance of the <see cref="UpdateStockInfoSKUException"/> class.
/// Initializes a new instance of the <see cref="UpdateStockInfoSkuException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
protected UpdateStockInfoSKUException(SerializationInfo info, StreamingContext context) : base(info, context)
protected UpdateStockInfoSkuException(SerializationInfo info, StreamingContext context) : base(info, context)
{ }
}
}
31 changes: 31 additions & 0 deletions Src/VTEX/GoodPractices/UpdateStockInfoSkuException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace VTEX.GoodPractices
{
using System;
using System.Runtime.Serialization;

/// <summary>
/// Class UpdateStockInfoSKUException. This class cannot be inherited.
/// </summary>
/// <seealso cref="Exception" />

[Serializable]
public class UpdateStockInfoSkuException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdateStockInfoSkuException"/> class.
/// </summary>
/// <param name="skuId">The sku identifier.</param>
/// <param name="innerException">The inner exception.</param>
public UpdateStockInfoSkuException(int skuId, Exception innerException)
: base($"Unable to update the stock of SKU {skuId} in VTEX platform", innerException)
{ }

/// <summary>
/// Initializes a new instance of the <see cref="UpdateStockInfoSkuException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
protected UpdateStockInfoSkuException(SerializationInfo info, StreamingContext context) : base(info, context)
{ }
}
}
24 changes: 12 additions & 12 deletions Src/VTEX/PlatformConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,61 @@ internal static class PlatformConstants
/// <summary>
/// The rest oms feed
/// </summary>
public const string OMS_FEED = "oms/pvt/feed/orders/status/";
public const string OmsFeed = "oms/pvt/feed/orders/status/";

/// <summary>
/// The rest oms orders
/// </summary>
public const string OMS_ORDERS = "oms/pvt/orders";
public const string OmsOrders = "oms/pvt/orders";

/// <summary>
/// The rest oms invoices
/// </summary>
public const string OMS_INVOICES = "oms/pub/orders";
public const string OmsInvoices = "oms/pub/orders";

/// <summary>
/// The rest oms tracking
/// </summary>
public const string OMS_TRACKING = "oms/pvt/orders/{0}/invoice/{1}/tracking";
public const string OmsTracking = "oms/pvt/orders/{0}/invoice/{1}/tracking";

/// <summary>
/// The rest log warehouses
/// </summary>
public const string LOG_WAREHOUSES = "logistics/pvt/inventory/warehouseitembalances";
public const string LogWarehouses = "logistics/pvt/inventory/warehouseitembalances";

/// <summary>
/// The rest pci transactions
/// </summary>
public const string PCI_TRANSACTIONS = "pvt/transactions";
public const string PciTransactions = "pvt/transactions";

/// <summary>
/// The rest log reservations
/// </summary>
public const string LOG_RESERVATIONS = "logistics/pvt/inventory/reservations";
public const string LogReservations = "logistics/pvt/inventory/reservations";

/// <summary>
/// The rest log inventory
/// </summary>
public const string LOG_INVENTORY = "logistics/pvt/inventory/skus";
public const string LogInventory = "logistics/pvt/inventory/skus";

/// <summary>
/// The rest bridge search
/// </summary>
public const string BRIDGE_SEARCH = "bridge/mb/search";
public const string BridgeSearch = "bridge/mb/search";

/// <summary>
/// The pricing endpoint.
/// </summary>
public const string PRICING = "pricing/prices";
public const string Pricing = "pricing/prices";

/// <summary>
/// The rest catalog
/// </summary>
public const string CATALOG = "catalog_system/pvt";
public const string Catalog = "catalog_system/pvt";

/// <summary>
/// The rest catalog pub
/// </summary>
public const string CATALOG_PUB = "catalog_system/pub";
public const string CatalogPub = "catalog_system/pub";
}
}
6 changes: 3 additions & 3 deletions Src/VTEX/Transport/ChangeOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public sealed class ChangeOrder
public int DiscountValue { get; set; }

/// <summary>
/// Gets or sets the incremente value.
/// Gets or sets the increment value.
/// </summary>
/// <value>
/// The incremente value.
/// The increment value.
/// </value>
[JsonProperty("incrementValue")]
public int IncrementeValue { get; set; }
public int IncrementValue { get; set; }

/// <summary>
/// Gets or sets the items added.
Expand Down
3 changes: 3 additions & 0 deletions Src/VTEX/Transport/ClientProfileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public string DocumentTypeInternal
set
{
if (string.IsNullOrWhiteSpace(value))
{
return;
}

DocumentType = EnumExtensions.GetEnumByInternalValueAttribute<DocumentType>(value);
}
}
Expand Down
6 changes: 5 additions & 1 deletion Src/VTEX/Transport/DateRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public string FromInternal
set
{
if (DateTime.TryParse(value, out var from))
From = from;
{
From = @from;
}
}
}

Expand All @@ -57,7 +59,9 @@ public string ToInternal
set
{
if (DateTime.TryParse(value, out var to))
{
To = to;
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Src/VTEX/Transport/FixedPrice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public sealed class FixedPrice
public decimal Value { get; set; }

/// <summary>
/// Gets or sets the listprice.
/// Gets or sets the list price.
/// </summary>
/// <value>
/// The listprice.
/// The list price.
/// </value>
[JsonProperty("listPrice")]
public decimal? Listprice { get; set; }
public decimal? ListPrice { get; set; }

/// <summary>
/// Gets or sets the minimum quantity.
Expand Down
2 changes: 1 addition & 1 deletion Src/VTEX/Transport/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class Inventory
/// </summary>
/// <value>The sku identifier.</value>
[JsonProperty("skuid")]
public int SKUId { get; set; }
public int SkuId { get; set; }

/// <summary>
/// Gets or sets the balances.
Expand Down
Loading

0 comments on commit 880357f

Please sign in to comment.