Skip to content

Commit

Permalink
8.12.0 Version
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidBazaarVoice authored Oct 27, 2022
1 parent 5060fdc commit 4960631
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# 8.12.0
## Q&A Statistics

* Allowing client to map Q&A Statistics in statistics.json.

# 8.11.0
## Relevancy Sort and Content Locale Sort Support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public String getKey() {
public enum StatsType implements UGCOption{
Reviews("Reviews"),
NativeReviews("NativeReviews"),
All("Reviews,NativeReviews");
Questions("Questions"),
Answers("Answers"),
All("Reviews,NativeReviews,Questions,Answers");

private String key;
StatsType(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class ProductStatistics {
private ReviewStatistics reviewStatistics;
@SerializedName("NativeReviewStatistics")
private ReviewStatistics nativeReviewStatistics;
@SerializedName("QAStatistics")
private QAStatistics qaStatistics;
@SerializedName("ProductId")
private String productId;

Expand All @@ -39,6 +41,10 @@ public ReviewStatistics getNativeReviewStatistics() {
return nativeReviewStatistics;
}

public QAStatistics getQAStatistics() {
return qaStatistics;
}

public String getProductId() {
return productId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,4 +898,16 @@ public void reviewDisplayRequestCreateRequestWithContentLocaleSort() {
final Request okRequest = requestFactory.create(reviewsRequest);
assertEquals("ContentLocale:fr_FR", reviewsRequest.getSorts().get(0).toString());
}

@Test
public void testQAStatsStatisticsRequest() {
final List<String> productIds = new ArrayList<String>();
productIds.add("product1");
productIds.add("product2");
final BulkRatingsRequest request = new BulkRatingsRequest.Builder(productIds, BulkRatingOptions.StatsType.Answers)
.build();
final Request okRequest = requestFactory.create(request);
final HttpUrl url = okRequest.url();
assertEquals("Answers", url.queryParameter("Stats"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -843,4 +843,13 @@ public void testValueLabelSecondaryRatingsAveragesReviewResponse() throws Except
assertEquals("What size is the product?", response.getIncludes().getProducts().get(0).getReviewStatistics().getSecondaryRatingsAverages().get("WhatSizeIsTheProduct").getLabel());
assertEquals("Small", response.getIncludes().getProducts().get(0).getReviewStatistics().getSecondaryRatingsAverages().get("WhatSizeIsTheProduct").getValueLabel().get(0));
}

@Test
public void testQAStatsStatisticsResponse() throws Exception {
BulkRatingsResponse response = parseJsonResourceFile("statistics_qa_stats.json", BulkRatingsResponse.class, gson);

assertEquals(3, response.getResults().get(0).getProductStatistics().getQAStatistics().getTotalQuestionCount().intValue());
assertEquals(5, response.getResults().get(0).getProductStatistics().getQAStatistics().getTotalAnswerCount().intValue());

}
}
53 changes: 53 additions & 0 deletions bvconversations/src/test/resources/statistics_qa_stats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"Limit":2,
"offset":0,
"TotalResults":2,
"Locale":"en_US",
"Results":[
{
"ProductStatistics":{
"ProductId":"Synd3-Unique-Product-2",
"NativeReviewStatistics":{
"AverageOverallRating":2.9091,
"TotalReviewCount":11,
"OverallRatingRange":5
},
"ReviewStatistics":{
"AverageOverallRating":3.0455,
"TotalReviewCount":22,
"OverallRatingRange":5
},
"QAStatistics":{
"TotalQuestionCount":3,
"TotalAnswerCount":5
}
}
},
{
"ProductStatistics":{
"ProductId":"Synd3-Match-Product-2",
"NativeReviewStatistics":{
"AverageOverallRating":2.1818,
"TotalReviewCount":11,
"OverallRatingRange":5
},
"ReviewStatistics":{
"AverageOverallRating":2.6818,
"TotalReviewCount":22,
"OverallRatingRange":5
},
"QAStatistics":{
"TotalQuestionCount":3,
"TotalAnswerCount":4
}
}
}
],
"Includes":{

},
"HasErrors":false,
"Errors":[

]
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=8.11.0
VERSION_NAME=8.12.0
GROUP=com.bazaarvoice.bvandroidsdk

POM_DESCRIPTION=Bazaarvoice Android SDK
Expand Down

0 comments on commit 4960631

Please sign in to comment.