public ProductOffers GetProductOffers(ProductOffersRequest productOffersRequest) { HttpWebRequest request = CatalogRequestBuilder.ConstructProductOffersRequest(apiKey, productOffersRequest); ProductOffers productOffers = ProcessBodylessRequest(request).ToObject<ProductOffers>(); return productOffers; }
public void TestGetProductOffers() { ProductOffersRequest productOffersRequest = new ProductOffersRequest(); productOffersRequest.Id = "1004004012288125"; productOffersRequest.Offers = new EnumTypes.OfferType[] { EnumTypes.OfferType.ALL }; ProductOffers productOffers = client.GetProductOffers(productOffersRequest); Assert.IsNotNull(productOffers.OfferData); Assert.IsNotNull(productOffers.OfferData.Offers); Assert.IsTrue(productOffers.OfferData.Offers.Count > 0); }
public static HttpWebRequest ConstructProductOffersRequest(string apiKey, ProductOffersRequest productOffersRequest) { NameValueCollection queryParams = new NameValueCollection(); queryParams.Add("apikey", apiKey); if (productOffersRequest.Offers != null) { queryParams.Add("offer", FormatterUtils.FormatOffer(productOffersRequest.Offers)); } string queryString = HttpUtils.ToQueryString(queryParams); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Constants.URL_PREFIX + "/catalog/v4/offers/" + productOffersRequest.Id + "/" + queryString); request.Method = "GET"; request.Accept = "application/json"; return request; }