-
Notifications
You must be signed in to change notification settings - Fork 2
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
Dmitry Koval
authored and
Dmitry Koval
committed
Oct 20, 2021
1 parent
9a4ade1
commit 2fd3905
Showing
10 changed files
with
332 additions
and
3 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
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
53 changes: 53 additions & 0 deletions
53
route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/AddressBarcodes/BarcodeDataRequest.cs
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,53 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Route4MeSDK.DataTypes.V5 | ||
{ | ||
/// <summary> | ||
/// Barcode data request | ||
/// </summary> | ||
[DataContract] | ||
public class BarcodeDataRequest : QueryTypes.GenericParameters | ||
{ | ||
/// <summary> | ||
/// Barcode | ||
/// </summary> | ||
[DataMember(Name = "barcode", EmitDefaultValue = false)] | ||
public string Barcode { get; set; } | ||
|
||
/// <summary> | ||
/// Scan type | ||
/// </summary> | ||
[DataMember(Name = "scan_type", EmitDefaultValue = false)] | ||
public string ScanType { get; set; } | ||
|
||
/// <summary> | ||
/// Latitude | ||
/// </summary> | ||
[DataMember(Name = "lat", EmitDefaultValue = false)] | ||
public double Latitude { get; set; } | ||
|
||
/// <summary> | ||
/// Longitude | ||
/// </summary> | ||
[DataMember(Name = "lan", EmitDefaultValue = false)] | ||
public double Longitude { get; set; } | ||
|
||
/// <summary> | ||
/// Date | ||
/// </summary> | ||
[DataMember(Name = "timestamp_date", EmitDefaultValue = false)] | ||
public long TimestampDate { get; set; } | ||
|
||
/// <summary> | ||
/// UTC data | ||
/// </summary> | ||
[DataMember(Name = "timestamp_utc", EmitDefaultValue = false)] | ||
public long TimestampUtc { get; set; } | ||
|
||
/// <summary> | ||
/// Scanned at | ||
/// </summary> | ||
[DataMember(Name = "scanned_at", EmitDefaultValue = false)] | ||
public string ScannedAt { get; set; } | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/AddressBarcodes/BarcodeDataResponse.cs
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,71 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Route4MeSDK.DataTypes.V5 | ||
{ | ||
/// <summary> | ||
/// Barcode data response | ||
/// </summary> | ||
[DataContract] | ||
public class BarcodeDataResponse | ||
{ | ||
/// <summary> | ||
/// The route ID. | ||
/// </summary> | ||
[DataMember(Name = "route_id", EmitDefaultValue = false)] | ||
public string RouteId { get; set; } | ||
|
||
/// <summary> | ||
/// Route destination ID | ||
/// </summary> | ||
[DataMember(Name = "route_destination_id", EmitDefaultValue = false)] | ||
public int RouteDestinationId { get; set; } | ||
|
||
/// <summary> | ||
/// Order id | ||
/// </summary> | ||
[DataMember(Name = "order_id", EmitDefaultValue = false)] | ||
public int? OrderId { get; set; } | ||
|
||
/// <summary> | ||
/// Barcode | ||
/// </summary> | ||
[DataMember(Name = "barcode", EmitDefaultValue = false)] | ||
public string Barcode { get; set; } | ||
|
||
/// <summary> | ||
/// Scan type | ||
/// </summary> | ||
[DataMember(Name = "scan_type", EmitDefaultValue = false)] | ||
public string ScanType { get; set; } | ||
|
||
/// <summary> | ||
/// Latitude | ||
/// </summary> | ||
[DataMember(Name = "lat", EmitDefaultValue = false)] | ||
public double Latitude { get; set; } | ||
|
||
/// <summary> | ||
/// Longitude | ||
/// </summary> | ||
[DataMember(Name = "lan", EmitDefaultValue = false)] | ||
public double Longitude { get; set; } | ||
|
||
/// <summary> | ||
/// Date | ||
/// </summary> | ||
[DataMember(Name = "timestamp_date", EmitDefaultValue = false)] | ||
public long TimestampDate { get; set; } | ||
|
||
/// <summary> | ||
/// UTC date | ||
/// </summary> | ||
[DataMember(Name = "timestamp_utc", EmitDefaultValue = false)] | ||
public long TimestampUtc { get; set; } | ||
|
||
/// <summary> | ||
/// Scanned at | ||
/// </summary> | ||
[DataMember(Name = "scanned_at", EmitDefaultValue = false)] | ||
public string ScannedAt { get; set; } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/AddressBarcodes/GetAddressBarcodesResponse.cs
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,29 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Route4MeSDK.DataTypes.V5 | ||
{ | ||
/// <summary> | ||
/// Response from the get address barcodes request | ||
/// </summary> | ||
[DataContract] | ||
public sealed class GetAddressBarcodesResponse : QueryTypes.GenericParameters | ||
{ | ||
/// <summary> | ||
/// The status | ||
/// </summary> | ||
[DataMember(Name = "status", EmitDefaultValue = false)] | ||
public string Status { get; set; } | ||
|
||
/// <summary> | ||
/// Reference to the next page data | ||
/// </summary> | ||
[DataMember(Name = "next_page_cursor", EmitDefaultValue = false)] | ||
public string NextPageData { get; set; } | ||
|
||
/// <summary> | ||
/// An array of the <see cref="BarcodeDataResponse"/> type objects | ||
/// </summary> | ||
[DataMember(Name = "data", EmitDefaultValue = false)] | ||
public BarcodeDataResponse[] Data { get; set; } | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...harp-sdk/Route4MeSDKLibrary/QueryTypes/V5/AddressBarcodes/GetAddressBarcodesParameters.cs
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,36 @@ | ||
namespace Route4MeSDK.QueryTypes.V5 | ||
{ | ||
/// <summary> | ||
/// Parameters for the get address barcodes request. | ||
/// </summary> | ||
/// <seealso cref="Route4MeSDK.QueryTypes.GenericParameters" /> | ||
public sealed class GetAddressBarcodesParameters : GenericParameters | ||
{ | ||
/// <summary> | ||
/// The route ID. | ||
/// <remarks><para>Query parameter.</para></remarks> | ||
/// </summary> | ||
[HttpQueryMemberAttribute(Name = "route_id", EmitDefaultValue = false)] | ||
public string RouteId { get; set; } | ||
|
||
/// <summary> | ||
/// Route destination ID | ||
/// </summary> | ||
[HttpQueryMemberAttribute(Name = "route_destination_id", EmitDefaultValue = false)] | ||
public int? RouteDestinationId { get; set; } | ||
|
||
/// <summary> | ||
/// Limit the number of records in response. | ||
/// <remarks><para>Query parameter.</para></remarks> | ||
/// </summary> | ||
[HttpQueryMemberAttribute(Name = "limit", EmitDefaultValue = false)] | ||
public uint? Limit { get; set; } | ||
|
||
/// <summary> | ||
/// The reference to the next data part | ||
/// <remarks><para>Query parameter.</para></remarks> | ||
/// </summary> | ||
[HttpQueryMemberAttribute(Name = "cursor", EmitDefaultValue = false)] | ||
public string Cursor { get; set; } | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...arp-sdk/Route4MeSDKLibrary/QueryTypes/V5/AddressBarcodes/SaveAddressBarcodesParameters.cs
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,32 @@ | ||
using System.Runtime.Serialization; | ||
using Route4MeSDK.DataTypes.V5; | ||
|
||
namespace Route4MeSDK.QueryTypes.V5 | ||
{ | ||
/// <summary> | ||
/// Parameters for the add address barcodes request. | ||
/// </summary> | ||
/// <seealso cref="Route4MeSDK.QueryTypes.GenericParameters" /> | ||
[DataContract] | ||
public sealed class SaveAddressBarcodesParameters : GenericParameters | ||
{ | ||
/// <summary> | ||
/// The route ID. | ||
/// <remarks><para>Query parameter.</para></remarks> | ||
/// </summary> | ||
[DataMember(Name = "route_id", EmitDefaultValue = false)] | ||
public string RouteId { get; set; } | ||
|
||
/// <summary> | ||
/// Route destination ID | ||
/// </summary> | ||
[DataMember(Name = "route_destination_id", EmitDefaultValue = false)] | ||
public int RouteDestinationId { get; set; } | ||
|
||
/// <summary> | ||
/// Barcodes to be saved | ||
/// </summary> | ||
[DataMember(Name = "barcodes", EmitDefaultValue = false)] | ||
public BarcodeDataRequest[] Barcodes { get; set; } | ||
} | ||
} |
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
51 changes: 51 additions & 0 deletions
51
route4me-csharp-sdk/Route4MeSdkV5UnitTest/V5/AddressBarcodes/AddressBarcodesTests.cs
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,51 @@ | ||
using Route4MeSDK; | ||
using Route4MeSDK.DataTypes.V5; | ||
using Route4MeSDK.QueryTypes.V5; | ||
using Xunit; | ||
|
||
namespace Route4MeSdkV5UnitTest.V5.AddressBarcodes | ||
{ | ||
public class AddressBarcodesTests | ||
{ | ||
[Fact] | ||
public void AddressBarcodesGetSaveTest() | ||
{ | ||
var route4me = new Route4MeManagerV5(ApiKeys.ActualApiKey); | ||
|
||
var getAddressBarcodesParameters = new GetAddressBarcodesParameters() | ||
{ | ||
RouteId = "893E6C33F0494572DEB2FAE34B2D3E0B", | ||
RouteDestinationId = 705601646 | ||
}; | ||
var readResult1 = route4me.GetAddressBarcodes(getAddressBarcodesParameters, out var resultResponse); | ||
Assert.NotEmpty(readResult1.Data); | ||
|
||
var saveAddressBarcodesResponse = route4me.SaveAddressBarcodes(new SaveAddressBarcodesParameters() | ||
{ | ||
RouteId = "893E6C33F0494572DEB2FAE34B2D3E0B", | ||
RouteDestinationId = 705601646, | ||
Barcodes = new BarcodeDataRequest[] | ||
{ | ||
new BarcodeDataRequest() | ||
{ | ||
Barcode = "TEST2", | ||
Latitude = 40.610804, | ||
Longitude = -73.920172, | ||
TimestampDate = 1634169600, | ||
TimestampUtc = 1634198666, | ||
ScanType = "picked_up", | ||
ScannedAt = "2021-10-15 19:18:11" | ||
} | ||
} | ||
|
||
}, out resultResponse); | ||
|
||
Assert.True(saveAddressBarcodesResponse.status); | ||
|
||
var readResult2 = route4me.GetAddressBarcodes(getAddressBarcodesParameters, out resultResponse); | ||
|
||
Assert.True(readResult2.Data.Length - readResult1.Data.Length == 1); | ||
|
||
} | ||
} | ||
} |