public async Task Delete(TrackingClient client)
 {
     using (var connection = new MySqlConnection())
     {
         await connection.DeleteAsync(client);
     }
 }
예제 #2
0
 void setTrackingConfig(TrackingClient client, string trackingConfigPath, bool useVfw)
 {
     XmlConfigLoader tconf = new XmlConfigLoader();
     tconf.LoadFromFile(trackingConfigPath);
     tconf.Configure(client);
     if (useVfw) client.CameraSettings.SetDriver(eCameraDriver.Vfw);
 }
 public async Task Insert(TrackingClient client)
 {
     using (var connection = new MySqlConnection())
     {
         await connection.InsertAsync(client);
     }
 }
예제 #4
0
        public UTMService(string clientId, string clientSecret,
                          string operatorMail, string operatorPass)
        {
            this._disposeHttpClient      = true;
            this._httpClient             = new HttpClient();
            this._httpClient.BaseAddress = new Uri("https://healthdrone.unifly.tech");
            this._httpClient.DefaultRequestHeaders.Clear();
            this._httpClient.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            this.Tokens = new TokenClient(_httpClient, new Credentials {
                ClientId = clientId, ClientSecret = clientSecret, OperatorMail = operatorMail, OperatorPass = operatorPass
            });
            Token token = null;

            Task.Run(async() => token = await Tokens.Auth()).Wait();
            if (token == null)
            {
                throw new Exception("Authentication went wrong");
            }

            this._httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.access_token);

            this.Operation = new OperationClient(_httpClient);
            this.Tracking  = new TrackingClient(_httpClient);
        }
예제 #5
0
 void setTrackingConfig(TrackingClient client, string trackingConfigPath, bool useVfw)
 {
     XmlTrackingConfigurator tconf = new XmlTrackingConfigurator();
     tconf.LoadFromFile(trackingConfigPath);
     tconf.Configure(client);
     string imgPath = Path.Combine(Path.GetDirectoryName(trackingConfigPath), "images");
     if (Directory.Exists(imgPath)) client.SetReferenceImagePath(imgPath);
     if (useVfw) client.CameraSettings.SetDriver(eCameraDriver.Vfw);
 }
예제 #6
0
        // TODO: Check the way to ignore ConsignmentStatus.PackageSet[].EventSet[].Definitions as those changes time to time on Bring server and tests randomly fail
        //[InlineData(TestpackageAtPickuppoint.TrackingNumber, TestpackageAtPickuppoint.ExpectedJson)]
        //[InlineData(TestpackageDelivered.TrackingNumber, TestpackageDelivered.ExpectedJson)]
        //[InlineData(TestpackageEdi.TrackingNumber, TestpackageEdi.ExpectedJson)]
        //[InlineData(TestpackageLoadedForDelivery.TrackingNumber, TestpackageLoadedForDelivery.ExpectedJson)]
        //[Theory]
        public async Task it_gets_consignments_statuses(string trackingNumber, string expectedJson)
        {
            var settings = new TrackingSettings();
            var sut      = new TrackingClient(settings);
            var expected = JsonConvert.DeserializeObject <TrackingResponse>(expectedJson).ConsignmentSet;

            var actual = await sut.TrackAsync(trackingNumber);

            expected.Should().BeEquivalentTo(actual,
                                             options => options.Excluding(ctx => Regex.IsMatch(ctx.SelectedMemberPath, @"item\[.+\].PackageSet\[.+\].EventSet\[.+\].Definitions")));
        }
예제 #7
0
        void setTrackingConfig(TrackingClient client, string trackingConfigPath, bool useVfw)
        {
            XmlConfigLoader tconf = new XmlConfigLoader();

            tconf.LoadFromFile(trackingConfigPath);
            tconf.Configure(client);
            if (useVfw)
            {
                client.CameraSettings.SetDriver(eCameraDriver.Vfw);
            }
        }
예제 #8
0
        void setTrackingConfig(TrackingClient client, string trackingConfigPath, bool useVfw)
        {
            XmlTrackingConfigurator tconf = new XmlTrackingConfigurator();

            tconf.LoadFromFile(trackingConfigPath);
            tconf.Configure(client);
            string imgPath = Path.Combine(Path.GetDirectoryName(trackingConfigPath), "images");

            if (Directory.Exists(imgPath))
            {
                client.SetReferenceImagePath(imgPath);
            }
            if (useVfw)
            {
                client.CameraSettings.SetDriver(eCameraDriver.Vfw);
            }
        }
예제 #9
0
 public async Task <ActionResult> TrackPackages([FromServices] TrackingClient trackingClient, [FromBody, Required] TrackingRequest trackingRequest)
 {
     return(Ok(await trackingClient.TrackPackagesAsync(trackingRequest, Request.Headers["X-Vtex-Credential"])));
 }
예제 #10
0
 public void SetUp()
 {
     _client = new TrackingClient(new Guid("462517ce-9dbf-44f0-a57b-22b9d50747fd"));
 }