Skip to content

Commit

Permalink
Merge branch 'release/0.2.1'
Browse files Browse the repository at this point in the history
Release/0.2.1
  • Loading branch information
devesh-shetty authored Jul 31, 2017
2 parents 54544ed + 978b844 commit 4950f2c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.2.1 (2017-07-31)
--------------------------
JSON Event Transformer: Fix issue encountered when parsing string fields containing ' (#9)

Version 0.2.0 (2017-07-24)
--------------------------
Downgrade the target to .NET Standard 1.1 (#7)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ limitations under the License.
[license-image]: http://img.shields.io/badge/license-Apache--2-blue.svg?style=flat
[license]: http://www.apache.org/licenses/LICENSE-2.0

[release-image]: https://img.shields.io/badge/release-0.2.0-blue.svg?style=flat
[release-image]: https://img.shields.io/badge/release-0.2.1-blue.svg?style=flat
[releases]: https://github.com/snowplow/snowplow-dotnet-analytics-sdk/releases

[techdocs-image]: https://d3i6fms1cm1j0i.cloudfront.net/github/images/techdocs.png
Expand Down
12 changes: 4 additions & 8 deletions Snowplow.Analytics.Tests/Json/EventTransformerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private Dictionary<string, string> GetInputWithContextAndUnstructEvent()
{ "geo_zipcode", "94109"},
{ "geo_latitude", "37.443604"},
{ "geo_longitude", "-122.4124"},
{ "geo_region_name", "Florida"},
{ "geo_region_name", "Test o' florida'"},
{ "ip_isp", "FDN Communications"},
{ "ip_organization", "Bouygues Telecom"},
{ "ip_domain", "nuvox.net"},
Expand Down Expand Up @@ -199,7 +199,7 @@ private Dictionary<string, string> GetInputWithoutContextAndUnstructEvent()
{ "geo_zipcode", "94109"},
{ "geo_latitude", "37.443604"},
{ "geo_longitude", "-122.4124"},
{ "geo_region_name", "Florida"},
{ "geo_region_name", "Test o' florida'"},
{ "ip_isp", "FDN Communications"},
{ "ip_organization", "Bouygues Telecom"},
{ "ip_domain", "nuvox.net"},
Expand Down Expand Up @@ -337,7 +337,7 @@ private string GetSerializedExpectedOutputForInputWithContextAndUnstructEvent()
'geo_zipcode' : '94109',
'geo_latitude' : 37.443604,
'geo_longitude' : -122.4124,
'geo_region_name' : 'Florida',
'geo_region_name' : 'Test o\' florida\'',
'ip_isp' : 'FDN Communications',
'ip_organization' : 'Bouygues Telecom',
'ip_domain' : 'nuvox.net',
Expand Down Expand Up @@ -523,7 +523,7 @@ private string GetSerializedExpectedOutputForInputWithoutContextAndUnstructEvent
'geo_zipcode' : '94109',
'geo_latitude' : 37.443604,
'geo_longitude' : -122.4124,
'geo_region_name' : 'Florida',
'geo_region_name' : 'Test o\' florida\'',
'ip_isp' : 'FDN Communications',
'ip_organization' : 'Bouygues Telecom',
'ip_domain' : 'nuvox.net',
Expand Down Expand Up @@ -644,12 +644,9 @@ public void TestTransformForInputWithContextAndUnstructEvent()
{
var input = GetInputWithContextAndUnstructEvent();
var expected = GetSerializedExpectedOutputForInputWithContextAndUnstructEvent();

var tsv = ConvertDictToTsv(input);
var transformedTsv = EventTransformer.Transform(tsv);

Assert.Equal(expected, transformedTsv);

}

[Fact]
Expand All @@ -663,7 +660,6 @@ public void TestTransformForInputWithoutContextAndUnstructEvent()
var transformedTsv = EventTransformer.Transform(tsv);

Assert.Equal(expected, transformedTsv);

}

[Fact]
Expand Down
12 changes: 6 additions & 6 deletions Snowplow.Analytics/Json/EventTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ namespace Snowplow.Analytics.Json
{
public static class EventTransformer
{
private static JObject StringField(string key, string val) => JObject.Parse("{'" + key + "': '" + val + "'}");
private static JObject IntField(string key, string val) => JObject.Parse("{'" + key + "': " + int.Parse(val) + "}");
private static JObject DoubleField(string key, string val) => JObject.Parse("{'" + key + "': " + double.Parse(val) + "}");
private static JObject StringField(string key, string val) => JObject.Parse("{ \"" + key + "\": \"" + val + "\"}");
private static JObject IntField(string key, string val) => JObject.Parse("{\"" + key + "\": " + int.Parse(val) + "}");
private static JObject DoubleField(string key, string val) => JObject.Parse("{\"" + key + "\": " + double.Parse(val) + "}");
private static JObject BoolField(string key, string val) => HandleBooleanField(key, val);
private static JObject TstampField(string key, string val) => JObject.Parse("{'" + key + "': '" + ReformatTstamp(val) + "'}");
private static JObject TstampField(string key, string val) => JObject.Parse("{\"" + key + "\": \"" + ReformatTstamp(val) + "\"}");
private static JObject CustomContextsField(string key, string val) => JsonShredder.ParseContexts(val);
private static JObject DerivedContextsField(string key, string val) => JsonShredder.ParseContexts(val);
private static JObject UnstructField(string key, string val) => JsonShredder.ParseUnstruct(val);
Expand Down Expand Up @@ -270,11 +270,11 @@ private static readonly Dictionary<string, Func<string, string, JObject>>
{
if (val.Equals("1"))
{
return JObject.Parse("{'" + key + "': true }");
return JObject.Parse("{\"" + key + "\": true }");
}
else if (val.Equals("0"))
{
return JObject.Parse("{'" + key + "': false }");
return JObject.Parse("{\"" + key + "\": false }");
}
throw new SnowplowEventTransformationException($"Invalid value {val} for field {key}");
Expand Down
12 changes: 6 additions & 6 deletions Snowplow.Analytics/Snowplow.Analytics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<PackageId>Snowplow.Analytics</PackageId>
<PackageVersion>0.2.0</PackageVersion>
<PackageVersion>0.2.1</PackageVersion>
<Authors>Devesh Shetty</Authors>
<Description>The Snowplow Analytics SDK for .NET lets you work with Snowplow enriched events in your .NET event processing and data modeling jobs. Use this SDK with Azure Data Lake Analytics, Azure Functions, AWS Lambda, Microsoft Orleans and other .NET-compatible data processing frameworks.</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>Downgrade the target to .NET Standard 1.1 (#7)</PackageReleaseNotes>
<PackageReleaseNotes>JSON Event Transformer: Fix issue encountered when parsing string fields containing ' (#9)</PackageReleaseNotes>
<Copyright>Copyright 2017</Copyright>
<PackageTags>snowplow analytics events transformer</PackageTags>
<ReleaseVersion>0.2.0</ReleaseVersion>
<AssemblyVersion>0.2.0</AssemblyVersion>
<FileVersion>0.2.0</FileVersion>
<Version>0.2.0</Version>
<ReleaseVersion>0.2.1</ReleaseVersion>
<AssemblyVersion>0.2.1</AssemblyVersion>
<FileVersion>0.2.1</FileVersion>
<Version>0.2.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 4950f2c

Please sign in to comment.