Examples of BVRequest


Examples of org.nijhazer.bazaarvoice.core.request.BVRequest

    }

    public List<BVProductStatistic> getProductStatistics(List<String> productIds) {
        List<BVProductStatistic> results = new ArrayList<BVProductStatistic>();

        BVRequest request = buildRequest();
        request.setResource(configuration.get(BVConstants.RESOURCE_STATISTICS));
        StringBuilder productIdsBuilder = new StringBuilder();
        boolean first = true;
        for (String productId : productIds) {
            if (first) {
                first = false;
            } else {
                productIdsBuilder.append(",");
            }
            productIdsBuilder.append(productId);
        }
        request.addParameter(BVConstants.URL_FILTER, String.format("productid:%s", productIdsBuilder.toString()));
        request.addParameter(BVConstants.URL_STATS, "Reviews,NativeReviews");
        request.addParameter(BVConstants.URL_LIMIT, "99");
        if (getLocale() != null) {
            request.addParameter(BVConstants.URL_FILTER, String.format("%s:%s:%s", BVConstants.URL_LOCALE, BVConstants.URL_EQUALS, getLocale()));
        }
        request.addRequestProcessor(new BVReviewStatisticsJSONProcessor());

        long startTime = Calendar.getInstance().getTimeInMillis();
        BVResponse response = request.process();
        this.setMostRecentAPIResponse(response);
        this.setMostRecentAPICallProcessingTime(Calendar.getInstance().getTimeInMillis() - startTime);

        for (BVElement result : response.getResults()) {
            results.add((BVProductStatistic) result);
View Full Code Here

Examples of org.nijhazer.bazaarvoice.core.request.BVRequest

        batches.add(batch);
        return batches;
    }

    private BVRequest buildRequest() {
        BVRequest request = new BVRequest();
        request.setBaseURL(configuration.get(BVConstants.RESOURCE_BASE));
        request.setApiVersion(configuration.get(BVConstants.CONFIG_API_VERSION));
        if (configuration.get(BVConstants.CONFIG_STAGING).equalsIgnoreCase("true")) {
            request.setStaging(true);
            request.setApiKey(configuration.get(BVConstants.CONFIG_API_KEY_STAGING));
        } else {
            request.setStaging(false);
            request.setApiKey(configuration.get(BVConstants.CONFIG_API_KEY_PRODUCTION));
        }
        request.addRequestProcessor(new BVRequestJSONProcessor());
        return request;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.