public IResponseBase Execute(IRequestParameter parameters) { var result = new Response <PowerReviewAvgRateResponse>(); try { _request = (PowerReviewAvgRateRequest)parameters; var cacheKey = string.Format(Config.PowerReview.CacheKeyAvgRate, _request.ProductId); result = CacheMemory.Get <Response <PowerReviewAvgRateResponse> >(cacheKey); if (result == null || result.resultset.AvgRates.Count == 0) { var communicationRequest = BuildUrl(parameters); _response = Communicate(communicationRequest); result = ParseResponse(_response); if (result.resultset.AvgRates.Count > 0) { if (Config.PowerReview.IsCacheEnabled) { CacheMemory.SetAndExpiresMinutesAsync(cacheKey, result, Config.PowerReview.Cache_TTL_InMinutes); } } } } catch (Exception ex) { _errors.Add(ex.Handle("PowerReviewGetAvgRates.Execute", ErrorSeverity.FollowUp, ErrorType.RequestError)); } return(result); }
private List <AvgRate> GetPwAvgRate(string productId) { var avgRatesRequest = new PowerReviewAvgRateRequest(); var avgrates = new PowerReviewGetAvgRates(_core); avgRatesRequest.ProductId = productId; return(((Response <PowerReviewAvgRateResponse>)avgrates.Execute(avgRatesRequest)).resultset.AvgRates); }