Skip to content

Commit f3d9f94

Browse files
Release 1.11.0
1 parent e4e2ec7 commit f3d9f94

File tree

6 files changed

+87
-3
lines changed

6 files changed

+87
-3
lines changed

BVSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'BVSwift'
11-
s.version = '1.10.0'
11+
s.version = '1.11.0'
1212
s.summary = 'Simple Swift based iOS SDK to interact with the Bazaarvoice platform API.'
1313
s.description = 'The Bazaarvoice Software Development Kit (SDK) is a Swift iOS library that provides an easy way to generate REST calls to the Bazaarvoice Developer API. Using this SDK, mobile developers can quickly integrate Bazaarvoice content into their native iOS apps for iPhone and iPad on iOS 8.0 or newer.'
1414

BVSwift/BVCommon/Configuration/BVConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal struct BVConstants {
1818
static let appVersionField: String = "_appVersion"
1919
static let buildNumberField: String = "_buildNumber"
2020
static let sdkVersionField: String = "_bvIosSwiftSdkVersion"
21-
static let bvSwiftSDKVersion: String = "1.10.0"
21+
static let bvSwiftSDKVersion: String = "1.11.0"
2222

2323
}
2424

BVSwift/BVConversations/Display/Fields/Types/BVProductStatisticsStat.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public enum BVProductStatisticsStat: BVQueryStat {
1818

1919
case nativeReviews
2020
case reviews
21+
case answers
22+
case questions
23+
2124

2225
public static var statPrefix: String {
2326
return BVConversationsConstants.BVQueryStat.defaultField
@@ -35,6 +38,11 @@ extension BVProductStatisticsStat: BVConversationsQueryValue {
3538
return BVConversationsConstants.BVNativeReviews.key
3639
case .reviews:
3740
return BVReview.pluralKey
41+
case .answers:
42+
return BVAnswer.pluralKey
43+
case .questions:
44+
return BVQuestion.pluralKey
45+
3846
}
3947
}
4048
}

BVSwift/BVConversations/Model/BVProductStatistics.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,24 @@ public struct BVProductStatistics: BVQueryable {
3434
return productStatisticsInternal?.nativeReviewStatistics
3535
}
3636

37+
public var qaStatistics: BVQAStatistics? {
38+
return productStatisticsInternal?.qaStatistics
39+
}
40+
41+
3742
private let productStatisticsInternal: BVProductStatisticsInternal?
3843
private struct BVProductStatisticsInternal: Codable {
3944

4045
let productId: String?
4146
let reviewStatistics: BVReviewStatistics?
4247
let nativeReviewStatistics: BVReviewStatistics?
48+
let qaStatistics: BVQAStatistics?
4349

4450
internal enum CodingKeys: String, CodingKey {
4551
case productId = "ProductId"
4652
case reviewStatistics = "ReviewStatistics"
4753
case nativeReviewStatistics = "NativeReviewStatistics"
54+
case qaStatistics = "QAStatistics"
4855
}
4956
}
5057

BVSwift/Support/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.10.0</string>
20+
<string>1.11.0</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>NSPrincipalClass</key>

BVSwiftTests/BVConversations/Display/BVProductStatisticsQueryTest.swift

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,73 @@ class BVProductStatisticsQueryTest: XCTestCase {
406406
error, "Something went horribly wrong, request took too long.")
407407
}
408408
}
409+
410+
func testQAStatistics() {
411+
412+
let expectation =
413+
self.expectation(
414+
description: "testQAStatistics")
415+
416+
let usLocale: Locale = Locale(identifier: "en_US")
417+
418+
guard let productStatisticsQuery =
419+
BVProductStatisticsQuery(productIds: ["test3"]) else {
420+
XCTFail()
421+
expectation.fulfill()
422+
return
423+
}
424+
425+
productStatisticsQuery
426+
.filter((.contentLocale(usLocale), .equalTo))
427+
.stats(.questions)
428+
.stats(.answers)
429+
.configure(BVProductStatisticsQueryTest.config)
430+
.handler {
431+
(response: BVConversationsQueryResponse<BVProductStatistics>) in
432+
433+
if case .failure(let error) = response {
434+
print(error)
435+
XCTFail()
436+
expectation.fulfill()
437+
return
438+
}
439+
440+
guard case let .success(_, productStatistics) = response else {
441+
XCTFail()
442+
expectation.fulfill()
443+
return
444+
}
445+
446+
guard let firstProductStatistic: BVProductStatistics =
447+
productStatistics.first,
448+
let qaStatistics =
449+
firstProductStatistic.qaStatistics else {
450+
XCTFail()
451+
expectation.fulfill()
452+
return
453+
}
454+
455+
XCTAssertEqual(productStatistics.count, 1)
456+
XCTAssertNotNil(qaStatistics)
457+
XCTAssertNotNil(qaStatistics.totalAnswerCount)
458+
XCTAssertNotNil(qaStatistics.totalQuestionCount)
459+
460+
expectation.fulfill()
461+
}
462+
463+
guard let req = productStatisticsQuery.request else {
464+
XCTFail()
465+
expectation.fulfill()
466+
return
467+
}
468+
469+
print(req)
470+
471+
productStatisticsQuery.async()
472+
473+
self.waitForExpectations(timeout: 20) { (error) in
474+
XCTAssertNil(
475+
error, "Something went horribly wrong, request took too long.")
476+
}
477+
}
409478
}

0 commit comments

Comments
 (0)