Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/JustinCanton/Geo.NET into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
JustinCanton committed Oct 16, 2024
2 parents da3bcab + 0ae1177 commit 2ac42e5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.

## [2.1.2](https://github.com/JustinCanton/Geo.NET/compare/2.1.1...2.1.2) (2024-10-15)
### Bug Fixes
- **core**: updating the System.Text.Json package references to fix the vulnerabilities ([#114](https://github.com/JustinCanton/Geo.NET/issues/114)) ([f218ce2](https://github.com/JustinCanton/Geo.NET/commit/f218ce298e295830bcb193781e9fb0b57b11328a))
- **arcgis**: updating the parameter names for deserialization of country information ([#113](https://github.com/JustinCanton/Geo.NET/issues/113)) ([d74864e](https://github.com/JustinCanton/Geo.NET/commit/d74864e70b2106dedf4b6c7373d5d5b7c712403f))

## [2.1.1](https://github.com/JustinCanton/Geo.NET/compare/2.1.0...2.1.1) (2024-08-02)
### Bug Fixes
- **security**: fixing a security vulnerability in the System.Text.Json nuget ([c700660](https://github.com/JustinCanton/Geo.NET/commit/c700660bda59ec5946a95d0ff4de69633946ef6e))
Expand Down
6 changes: 6 additions & 0 deletions src/Geo.ArcGIS/Models/Responses/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ public class Address
[JsonPropertyName("PostalExt")]
public string PostalCodeExtension { get; set; }

/// <summary>
/// Gets or sets the country of the address.
/// </summary>
[JsonPropertyName("CntryName")]
public string Country { get; set; }

/// <summary>
/// Gets or sets the country code of the address.
/// </summary>
Expand Down
11 changes: 10 additions & 1 deletion src/Geo.ArcGIS/Models/Responses/LocationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public class LocationAttribute : Attribute
[JsonPropertyName("CountryCode")]
public string CountryCode { get; set; }

/// <summary>
/// Sets the country code by an alternate name.
/// </summary>
[JsonPropertyName("Country")]
public string AlternateCountryCode
{
set { CountryCode = value; }
}

/// <summary>
/// Gets or sets the location name.
/// </summary>
Expand Down Expand Up @@ -304,7 +313,7 @@ public class LocationAttribute : Attribute
/// <summary>
/// Gets or sets the country of a location.
/// </summary>
[JsonPropertyName("Country")]
[JsonPropertyName("CntryName")]
public string Country { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Geo.Core/Geo.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.10" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
10 changes: 8 additions & 2 deletions test/Geo.ArcGIS.Tests/Services/ArcGISGeocodingShould.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public ArcGISGeocodingShould()
"{ \"address\":{ \"Match_addr\":\"Cali's California Style Burritos\", \"LongLabel\":\"Cali's California Style Burritos, 3046 Dolphin Dr, Elizabethtown, KY, 42701, USA\"," +
"\"ShortLabel\":\"Cali's California Style Burritos\", \"Addr_type\":\"POI\", \"Type\":\"Mexican Food\", \"PlaceName\":\"Cali's California Style Burritos\"," +
"\"AddNum\":\"3046\", \"Address\":\"3046 Dolphin Dr\", \"Block\":\"\", \"Sector\":\"\", \"Neighborhood\":\"\", \"District\":\"\", \"City\":\"Elizabethtown\", \"MetroArea\":\"\"," +
"\"Subregion\":\"Hardin County\", \"Region\":\"Kentucky\", \"Territory\":\"\", \"Postal\":\"42701\", \"PostalExt\":\"\", \"CountryCode\":\"USA\" }," +
"\"Subregion\":\"Hardin County\", \"Region\":\"Kentucky\", \"Territory\":\"\", \"Postal\":\"42701\", \"PostalExt\":\"\", \"CountryCode\":\"USA\", \"CntryName\":\"United States of America\" }," +
"\"location\":{ \"x\":-85.837039999999945,\"y\":37.710620000000063,\"spatialReference\":{ \"wkid\":4326,\"latestWkid\":4326} }}"),
});

Expand Down Expand Up @@ -112,7 +112,8 @@ public ArcGISGeocodingShould()
{
StatusCode = HttpStatusCode.OK,
Content = new StringContent("{\"spatialReference\":{\"wkid\":4326,\"latestWkid\":4326},\"candidates\":[{\"address\":\"123 East\",\"location\":{\"x\":-85.837039999999945,\"y\":37.710620000000063}," +
"\"score\":100,\"attributes\":{\"Match_addr\":\"123 East\",\"Addr_type\":\"POI\"},\"extent\":{\"xmin\":-85.84203999999994,\"ymin\":37.70562000000006,\"xmax\":-85.832039999999949,\"ymax\":37.715620000000065}}]}"),
"\"score\":100,\"attributes\":{\"LongLabel\": \"123 Main Street, Walton, Street, Somerset, England, BA16 9QL, GBR\",\"ShortLabel\": \"123 Main Street\",\"Addr_type\": \"StreetAddress\"," +
"\"CntryName\":\"United States of America\", \"Country\":\"USA\"},\"extent\":{\"xmin\":-85.84203999999994,\"ymin\":37.70562000000006,\"xmax\":-85.832039999999949,\"ymax\":37.715620000000065}}]}"),
});

mockHandler
Expand Down Expand Up @@ -580,6 +581,8 @@ public async Task ReverseGeocodingAsyncSuccessfully()
var response = await sut.ReverseGeocodingAsync(parameters);
response.Address.MatchAddress.Should().Be("Cali's California Style Burritos");
response.Location.Longitude.Should().Be(-85.837039999999945);
response.Address.Country.Should().Be("United States of America");
response.Address.CountryCode.Should().Be("USA");
}

/// <summary>
Expand Down Expand Up @@ -636,6 +639,9 @@ public async Task AddressCandidateAsyncSuccessfully()
var response = await sut.AddressCandidateAsync(parameters);
response.Candidates.Count.Should().Be(1);
response.SpatialReference.WellKnownID.Should().Be(4326);
response.Candidates[0].Attributes.Should().NotBeNull();
(response.Candidates[0].Attributes as LocationAttribute).Country.Should().Be("United States of America");
(response.Candidates[0].Attributes as LocationAttribute).CountryCode.Should().Be("USA");
}

/// <summary>
Expand Down

0 comments on commit 2ac42e5

Please sign in to comment.