Example #1
0
        /// <summary>
        /// The example refers to the process of updating a vehicle.
        /// </summary>
        public void UpdateVehicle()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            CreateTestVehcile();

            // TO DO: on this stage specifying of the parameter vehicle_alias is mandatory. Will be checked later
            var vehicleParams = new VehicleV4Parameters()
            {
                VehicleModelYear    = 1995,
                VehicleYearAcquired = 2018,
                VehicleMake         = "Ford",
                VehicleAxleCount    = 2,
                FuelType            = "unleaded 93",
                HeightInches        = 72,
                WeightLb            = 2000
            };

            // Run the query
            var updatedVehicle = route4Me.updateVehicle(
                vehicleParams,
                vehiclesToRemove[vehiclesToRemove.Count - 1],
                out string errorString);

            PrintTestVehciles(updatedVehicle, errorString);

            RemoveTestVehicles();
        }
        /// <summary>
        /// The example refers to the process of creating a new vehicle.
        /// </summary>
        public void CreatetVehicle()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var class7TruckParams = new VehicleV4Parameters()
            {
                VehicleName                   = "FORD F750",
                VehicleAlias                  = "FORD F750",
                VehicleVin                    = "1NPAX6EX2YD550743",
                VehicleLicensePlate           = "FFV9547",
                VehicleModel                  = "F-750",
                VehicleModelYear              = 2010,
                VehicleYearAcquired           = 2018,
                VehicleRegCountryId           = 223,
                VehicleMake                   = "Ford",
                VehicleTypeID                 = "livestock_carrier",
                VehicleAxleCount              = 2,
                MpgCity                       = 8,
                MpgHighway                    = 15,
                FuelType                      = "diesel",
                HeightInches                  = 96,
                HeightMetric                  = 244,
                WeightLb                      = 26000,
                MaxWeightPerAxleGroupInPounds = 15000,
                MaxWeightPerAxleGroupMetric   = 6800,
                WidthInInches                 = 96,
                WidthMetric                   = 240,
                LengthInInches                = 312,
                LengthMetric                  = 793,
                Use53FootTrailerRouting       = "NO",
                UseTruckRestrictions          = "YES",
                DividedHighwayAvoidPreference = "FAVOR",
                FreewayAvoidPreference        = "NEUTRAL",
                TruckConfig                   = "26_STRAIGHT_TRUCK",
                TollRoadUsage                 = "ALWAYS_AVOID",
                InternationalBordersOpen      = "NO",
                PurchasedNew                  = true
            };

            // Run the query
            var result = route4Me.CreateVehicle(class7TruckParams, out string errorString);

            PrintTestVehciles(result, errorString);

            if (result != null && result.GetType() == typeof(VehicleV4CreateResponse))
            {
                Console.WriteLine("The test vehicle {0} created successfully.", result.VehicleGuid);

                vehiclesToRemove.Add(result.VehicleGuid);

                RemoveTestVehicles();
            }
        }
Example #3
0
        /// <summary>
        /// The example refers to the process of deleting a vehicle.
        /// </summary>
        public void DeleteVehicle()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            CreateTestVehcile();

            var vehicleParams = new VehicleV4Parameters()
            {
                VehicleId = vehiclesToRemove[vehiclesToRemove.Count - 1]
            };

            // Run the query
            var vehicles = route4Me.deleteVehicle(vehicleParams, out string errorString);

            PrintTestVehciles(vehicles, errorString);
        }