-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
3,508 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2014-2019 Basis Technology Corporation. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
namespace rosette_api | ||
{ | ||
public class Address: IAddress | ||
{ | ||
public Address(string house = null, string houseNumber = null, string road = null, string unit = null, string level = null, string staircase = null, string entrance = null, string suburb = null, string cityDistrict = null, string city = null, string island = null, string stateDistrict = null, string state = null, string countryRegion = null, string country = null, string worldRegion = null, string postCode = null, string poBox = null) | ||
{ | ||
this.house = house; | ||
this.houseNumber = houseNumber; | ||
this.road = road; | ||
this.unit = unit; | ||
this.level = level; | ||
this.staircase = staircase; | ||
this.entrance = entrance; | ||
this.suburb = suburb; | ||
this.cityDistrict = cityDistrict; | ||
this.city = city; | ||
this.island = island; | ||
this.stateDistrict = stateDistrict; | ||
this.state = state; | ||
this.countryRegion = countryRegion; | ||
this.country = country; | ||
this.worldRegion = worldRegion; | ||
this.postCode = postCode; | ||
this.poBox = poBox; | ||
} | ||
|
||
/// <summary>house | ||
/// <para> | ||
/// Getter, Setter for the house | ||
/// </para> | ||
/// </summary> | ||
public string house { get; set; } | ||
|
||
/// <summary>houseNumber | ||
/// <para> | ||
/// Getter, Setter for the houseNumber | ||
/// </para> | ||
/// </summary> | ||
public string houseNumber { get; set; } | ||
|
||
/// <summary>road | ||
/// <para> | ||
/// Getter, Setter for the road | ||
/// </para> | ||
/// </summary> | ||
public string road { get; set; } | ||
|
||
/// <summary>unit | ||
/// <para> | ||
/// Getter, Setter for the unit | ||
/// </para> | ||
/// </summary> | ||
public string unit { get; set; } | ||
|
||
/// <summary>level | ||
/// <para> | ||
/// Getter, Setter for the level | ||
/// </para> | ||
/// </summary> | ||
public string level { get; set; } | ||
|
||
/// <summary>staircase | ||
/// <para> | ||
/// Getter, Setter for the staircase | ||
/// </para> | ||
/// </summary> | ||
public string staircase { get; set; } | ||
|
||
/// <summary>entrance | ||
/// <para> | ||
/// Getter, Setter for the entrance | ||
/// </para> | ||
/// </summary> | ||
public string entrance { get; set; } | ||
|
||
/// <summary>suburb | ||
/// <para> | ||
/// Getter, Setter for the suburb | ||
/// </para> | ||
/// </summary> | ||
public string suburb { get; set; } | ||
|
||
/// <summary>cityDistrict | ||
/// <para> | ||
/// Getter, Setter for the cityDistrict | ||
/// </para> | ||
/// </summary> | ||
public string cityDistrict { get; set; } | ||
|
||
/// <summary>city | ||
/// <para> | ||
/// Getter, Setter for the city | ||
/// </para> | ||
/// </summary> | ||
public string city { get; set; } | ||
|
||
/// <summary>island | ||
/// <para> | ||
/// Getter, Setter for the island | ||
/// </para> | ||
/// </summary> | ||
public string island { get; set; } | ||
|
||
/// <summary>stateDistrict | ||
/// <para> | ||
/// Getter, Setter for the stateDistrict | ||
/// </para> | ||
/// </summary> | ||
public string stateDistrict { get; set; } | ||
|
||
/// <summary>state | ||
/// <para> | ||
/// Getter, Setter for the state | ||
/// </para> | ||
/// </summary> | ||
public string state { get; set; } | ||
|
||
/// <summary>countryRegion | ||
/// <para> | ||
/// Getter, Setter for the countryRegion | ||
/// </para> | ||
/// </summary> | ||
public string countryRegion { get; set; } | ||
|
||
/// <summary>country | ||
/// <para> | ||
/// Getter, Setter for the country | ||
/// </para> | ||
/// </summary> | ||
public string country { get; set; } | ||
|
||
/// <summary>worldRegion | ||
/// <para> | ||
/// Getter, Setter for the worldRegion | ||
/// </para> | ||
/// </summary> | ||
public string worldRegion { get; set; } | ||
|
||
/// <summary>postCode | ||
/// <para> | ||
/// Getter, Setter for the postCode | ||
/// </para> | ||
/// </summary> | ||
public string postCode { get; set; } | ||
|
||
/// <summary>poBox | ||
/// <para> | ||
/// Getter, Setter for the poBox | ||
/// </para> | ||
/// </summary> | ||
public string poBox { get; set; } | ||
|
||
/// <summary> is this address fielded? | ||
/// </summary> | ||
public bool fielded() | ||
{ | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using System.Net.Http; | ||
|
||
namespace rosette_api | ||
{ | ||
/// <summary> | ||
/// A class to represnt the results from the Name Similarity endpoint of the Rosette API | ||
/// </summary> | ||
[JsonObject(MemberSerialization.OptOut)] | ||
public class AddressSimilarityResponse : RosetteResponse | ||
{ | ||
private const string scoreKey = "score"; | ||
|
||
/// <summary> | ||
/// The score, on a range of 0-1, of how closely the names match | ||
/// </summary> | ||
[JsonProperty(scoreKey)] | ||
public Nullable<double> Score; | ||
|
||
/// <summary> | ||
/// Creates a AddressSimilarityResponse from the given apiResults | ||
/// </summary> | ||
/// <param name="apiResults">The message from the API</param> | ||
public AddressSimilarityResponse(HttpResponseMessage apiResults) :base(apiResults) | ||
{ | ||
if (this.ContentDictionary.ContainsKey(scoreKey)) | ||
{ | ||
this.Score = this.ContentDictionary[scoreKey] as double?; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Creates a AddressSimilarityResponse from its headers | ||
/// </summary> | ||
/// <param name="score">The name simiarity score: 0-1</param> | ||
/// <param name="responseHeaders">The response headers from the API</param> | ||
/// <param name="content">The content of the response (the score) in dictionary form</param> | ||
/// <param name="contentAsJSON">The content in JSON</param> | ||
public AddressSimilarityResponse(double? score, Dictionary<string, string> responseHeaders, Dictionary<string, object> content, string contentAsJSON) : base(responseHeaders, content, contentAsJSON) | ||
{ | ||
this.Score = score; | ||
} | ||
|
||
/// <summary> | ||
/// Equals override. | ||
/// </summary> | ||
/// <param name="obj">The object to compare against</param> | ||
/// <returns>True if equal.</returns> | ||
public override bool Equals(object obj) | ||
{ | ||
if (obj is AddressSimilarityResponse) | ||
{ | ||
AddressSimilarityResponse other = obj as AddressSimilarityResponse; | ||
return this.Score == other.Score && this.ResponseHeaders.Equals(other.ResponseHeaders); | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// HashCode override | ||
/// </summary> | ||
/// <returns>The hashcode</returns> | ||
public override int GetHashCode() | ||
{ | ||
return this.Score.GetHashCode() ^ this.ResponseHeaders.GetHashCode(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.