Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenGraphProductItem" /> class.
        /// </summary>
        /// <param name="title">The title of the object as it should appear in the graph.</param>
        /// <param name="image">The default image.</param>
        /// <param name="availability">The availability of the item, one of 'instock', 'oos', or 'pending'.</param>
        /// <param name="condition">The condition of the item, one of 'new', 'refurbished', or 'used'.</param>
        /// <param name="prices">The prices of the item.</param>
        /// <param name="retailerItemId">The retailer's ID for the item.</param>
        /// <param name="url">The canonical URL of the object, used as its ID in the graph.</param>
        /// <exception cref="System.ArgumentNullException">prices or retailerItemId is <c>null</c>.</exception>
        public OpenGraphProductItem(
            string title,
            OpenGraphImage image,
            OpenGraphAvailability availability,
            OpenGraphCondition condition,
            IEnumerable <OpenGraphCurrency> prices,
            string retailerItemId,
            string url = null)
            : base(title, image, url)
        {
            if (prices == null)
            {
                throw new ArgumentNullException("prices");
            }

            if (retailerItemId == null)
            {
                throw new ArgumentNullException("retailerItemId");
            }

            this.Availability   = availability;
            this.Condition      = condition;
            this.Prices         = prices;
            this.RetailerItemId = retailerItemId;
        }
        /// <summary>
        /// Returns the lowercase <see cref="string" /> representation of the <see cref="OpenGraphAvailability" />.
        /// </summary>
        /// <param name="openGraphAvailability">The open graph availability.</param>
        /// <returns>
        /// The lowercase <see cref="string" /> representation of the <see cref="OpenGraphAvailability" />.
        /// </returns>
        public static string ToLowercaseString(this OpenGraphAvailability openGraphAvailability)
        {
            switch (openGraphAvailability)
            {
            case OpenGraphAvailability.InStock:
                return("instock");

            case OpenGraphAvailability.OutOfStock:
                return("oos");

            case OpenGraphAvailability.Pending:
                return("pending");

            default:
                return(string.Empty);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenGraphProductItem" /> class.
        /// </summary>
        /// <param name="title">The title of the object as it should appear in the graph.</param>
        /// <param name="mainImage">The main image which should represent your object within the graph. This is a required property.</param>
        /// <param name="availability">The availability of the item, one of 'instock', 'oos', or 'pending'.</param>
        /// <param name="condition">The condition of the item, one of 'new', 'refurbished', or 'used'.</param>
        /// <param name="prices">The prices of the item.</param>
        /// <param name="retailerItemId">The retailer's ID for the item.</param>
        /// <param name="url">The canonical URL of the object, used as its ID in the graph. Leave as <c>null</c> to get the URL of the current page.</param>
        /// <exception cref="System.ArgumentNullException">prices or retailerItemId is <c>null</c>.</exception>
        public OpenGraphProductItem(
            string title,
            OpenGraphImage mainImage,
            OpenGraphAvailability availability,
            OpenGraphCondition condition,
            IEnumerable<OpenGraphCurrency> prices,
            string retailerItemId,
            string url = null)
            : base(title, mainImage, url)
        {
            if (prices == null) { throw new ArgumentNullException(nameof(prices)); }
            if (retailerItemId == null) { throw new ArgumentNullException(nameof(retailerItemId)); }

            this.Availability = availability;
            this.Condition = condition;
            this.Prices = prices;
            this.RetailerItemId = retailerItemId;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenGraphProductItem" /> class.
        /// </summary>
        /// <param name="title">The title of the object as it should appear in the graph.</param>
        /// <param name="image">The default image.</param>
        /// <param name="availability">The availability of the item, one of 'instock', 'oos', or 'pending'.</param>
        /// <param name="condition">The condition of the item, one of 'new', 'refurbished', or 'used'.</param>
        /// <param name="prices">The prices of the item.</param>
        /// <param name="retailerItemId">The retailer's ID for the item.</param>
        /// <param name="url">The canonical URL of the object, used as its ID in the graph.</param>
        /// <exception cref="System.ArgumentNullException">prices or retailerItemId is <c>null</c>.</exception>
        public OpenGraphProductItem(
            string title,
            OpenGraphImage image,
            OpenGraphAvailability availability,
            OpenGraphCondition condition,
            IEnumerable<OpenGraphCurrency> prices,
            string retailerItemId,
            string url = null)
            : base(title, image, url)
        {
            if (prices == null) { throw new ArgumentNullException("prices"); }
            if (retailerItemId == null) { throw new ArgumentNullException("retailerItemId"); }

            this.availability = availability;
            this.condition = condition;
            this.prices = prices;
            this.retailerItemId = retailerItemId;
        }