Exemple #1
0
 public Shipment(Address originAddress, Address destinationAddress, List <Package> packages, ShipmentOptions options = null)
 {
     OriginAddress      = originAddress ?? throw new ArgumentNullException(nameof(originAddress));
     DestinationAddress = destinationAddress ?? throw new ArgumentNullException(nameof(destinationAddress));
     Packages           = packages?.AsReadOnly() ?? throw new ArgumentNullException(nameof(packages));
     Options            = options ?? new ShipmentOptions();
 }
Exemple #2
0
 /// <summary>
 ///     Retrieves rates for all of the specified providers using the specified address and packages information.
 /// </summary>
 /// <param name="originAddress">An instance of <see cref="Address" /> specifying the origin of the shipment.</param>
 /// <param name="destinationAddress">An instance of <see cref="Address" /> specifying the destination of the shipment.</param>
 /// <param name="packages">An instance of <see cref="PackageCollection" /> specifying the packages to be rated.</param>
 /// <param name="options">An optional instance of <see cref="ShipmentOptions" /> specifying the shipment options.</param>
 /// <returns>A <see cref="Shipment" /> instance containing all returned rates.</returns>
 public Shipment GetRates(Address originAddress, Address destinationAddress, List <Package> packages, ShipmentOptions options = null)
 {
     return(GetRatesAsync(originAddress, destinationAddress, packages, options).Result);
 }
Exemple #3
0
 /// <summary>
 ///     Retrieves rates for all of the specified providers using the specified address and package information.
 /// </summary>
 /// <param name="originAddress">An instance of <see cref="Address" /> specifying the origin of the shipment.</param>
 /// <param name="destinationAddress">An instance of <see cref="Address" /> specifying the destination of the shipment.</param>
 /// <param name="package">An instance of <see cref="Package" /> specifying the package to be rated.</param>
 /// <param name="options">An optional instance of <see cref="ShipmentOptions" /> specifying the shipment options.</param>
 /// <returns>A <see cref="Shipment" /> instance containing all returned rates.</returns>
 public Shipment GetRates(Address originAddress, Address destinationAddress, Package package, ShipmentOptions options = null)
 {
     return(GetRates(originAddress, destinationAddress, new List <Package> {
         package
     }, options));
 }
Exemple #4
0
 /// <summary>
 ///     Retrieves rates for all of the specified providers using the specified address and package information.
 /// </summary>
 /// <param name="originAddress">An instance of <see cref="Address" /> specifying the origin of the shipment.</param>
 /// <param name="destinationAddress">An instance of <see cref="Address" /> specifying the destination of the shipment.</param>
 /// <param name="package">An instance of <see cref="Package" /> specifying the package to be rated.</param>
 /// <param name="options">An optional instance of <see cref="ShipmentOptions" /> specifying the shipment options.</param>
 /// <returns>A <see cref="Shipment" /> instance containing all returned rates.</returns>
 public async Task <Shipment> GetRatesAsync(Address originAddress, Address destinationAddress, Package package, ShipmentOptions options = null)
 {
     return(await GetRatesAsync(originAddress, destinationAddress, new List <Package> {
         package
     }, options).ConfigureAwait(false));
 }
Exemple #5
0
        /// <summary>
        ///     Retrieves rates for all of the specified providers using the specified address and packages information.
        /// </summary>
        /// <param name="originAddress">An instance of <see cref="Address" /> specifying the origin of the shipment.</param>
        /// <param name="destinationAddress">An instance of <see cref="Address" /> specifying the destination of the shipment.</param>
        /// <param name="packages">An instance of <see cref="PackageCollection" /> specifying the packages to be rated.</param>
        /// <param name="options">An optional instance of <see cref="ShipmentOptions" /> specifying the shipment options.</param>
        /// <returns>A <see cref="Shipment" /> instance containing all returned rates.</returns>
        public async Task <Shipment> GetRatesAsync(Address originAddress, Address destinationAddress, List <Package> packages, ShipmentOptions options = null)
        {
            var shipment = new Shipment(originAddress, destinationAddress, packages, options)
            {
                RateAdjusters = _adjusters
            };

            return(await GetRates(shipment).ConfigureAwait(false));
        }