Skip to content

Commit

Permalink
Develop (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulbawane authored Jan 30, 2025
1 parent ed60bbe commit ec8ddfa
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 140 deletions.
2 changes: 1 addition & 1 deletion BVSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'BVSwift'
s.version = '1.15.2'
s.version = '1.15.3'
s.summary = 'Simple Swift based iOS SDK to interact with the Bazaarvoice platform API.'
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.'

Expand Down
8 changes: 4 additions & 4 deletions BVSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
B74C3F562CC9332C00D3EA13 /* BVProductExpressionsQueryTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B74C3F552CC9332C00D3EA13 /* BVProductExpressionsQueryTest.swift */; };
B7C8336F2D365DBF0088B7C0 /* BVReviewSummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C8336E2D365DBF0088B7C0 /* BVReviewSummary.swift */; };
B7C833712D365F790088B7C0 /* BVReviewSummaryQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C833702D365F790088B7C0 /* BVReviewSummaryQuery.swift */; };
B7C833732D3661870088B7C0 /* BVReviewSummaryFormatStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C833722D3661870088B7C0 /* BVReviewSummaryFormatStats.swift */; };
B7C833732D3661870088B7C0 /* BVFormatStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C833722D3661870088B7C0 /* BVFormatStats.swift */; };
B7C833752D366A680088B7C0 /* BVReviewSummaryQueryTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C833742D366A680088B7C0 /* BVReviewSummaryQueryTest.swift */; };
B7C833772D3793290088B7C0 /* BVReviewSummaryQueryResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C833762D3793290088B7C0 /* BVReviewSummaryQueryResponse.swift */; };
B7C8337D2D390E1C0088B7C0 /* BVReviewSummaryQueryable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7C8337C2D390E1C0088B7C0 /* BVReviewSummaryQueryable.swift */; };
Expand Down Expand Up @@ -611,7 +611,7 @@
B74C3F552CC9332C00D3EA13 /* BVProductExpressionsQueryTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVProductExpressionsQueryTest.swift; sourceTree = "<group>"; };
B7C8336E2D365DBF0088B7C0 /* BVReviewSummary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummary.swift; sourceTree = "<group>"; };
B7C833702D365F790088B7C0 /* BVReviewSummaryQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummaryQuery.swift; sourceTree = "<group>"; };
B7C833722D3661870088B7C0 /* BVReviewSummaryFormatStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummaryFormatStats.swift; sourceTree = "<group>"; };
B7C833722D3661870088B7C0 /* BVFormatStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVFormatStats.swift; sourceTree = "<group>"; };
B7C833742D366A680088B7C0 /* BVReviewSummaryQueryTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummaryQueryTest.swift; sourceTree = "<group>"; };
B7C833762D3793290088B7C0 /* BVReviewSummaryQueryResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummaryQueryResponse.swift; sourceTree = "<group>"; };
B7C8337C2D390E1C0088B7C0 /* BVReviewSummaryQueryable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BVReviewSummaryQueryable.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1092,7 +1092,7 @@
89E3106E27F4C9F700D42042 /* BVTagStats.swift */,
894615B128913424007B2138 /* BVCostomSort.swift */,
894615AD288FE812007B2138 /* BVRelevancySort.swift */,
B7C833722D3661870088B7C0 /* BVReviewSummaryFormatStats.swift */,
B7C833722D3661870088B7C0 /* BVFormatStats.swift */,
);
path = Types;
sourceTree = "<group>";
Expand Down Expand Up @@ -1623,7 +1623,7 @@
9F51CA50240CD1150043AED5 /* BVReviewHighlightsConfiguration.swift in Sources */,
98686CB22407115900D67889 /* BVConversationsSubmissionable.swift in Sources */,
98686C64240710AE00D67889 /* BVAnswerFilter.swift in Sources */,
B7C833732D3661870088B7C0 /* BVReviewSummaryFormatStats.swift in Sources */,
B7C833732D3661870088B7C0 /* BVFormatStats.swift in Sources */,
98686D422407136400D67889 /* BVRecommendationsCategory.swift in Sources */,
98686C9B2407113100D67889 /* BVAnswer.swift in Sources */,
98686CA32407113100D67889 /* BVComment.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion BVSwift/BVCommon/Configuration/BVConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal struct BVConstants {
static let appVersionField: String = "_appVersion"
static let buildNumberField: String = "_buildNumber"
static let sdkVersionField: String = "_bvIosSwiftSdkVersion"
static let bvSwiftSDKVersion: String = "1.15.2"
static let bvSwiftSDKVersion: String = "1.15.3"
}

internal extension Bundle {
Expand Down
10 changes: 0 additions & 10 deletions BVSwift/BVCommon/Query/BVQueryable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,6 @@ public protocol BVQueryLanguageStatable {
func language(_ value: String) -> Self
}

/// Protocol definition for the behavior of adding embedded values
public protocol BVQueryEmbedStatable {
func embed(_ value: String) -> Self
}

/// Protocol definition for the behavior of adding summary format values
public protocol BVQueryFormatStatable {
func formatType(_ value: String) -> Self
}

/// Protocol definition for the behavior of adding custom query fields
/// - Note:
/// \
Expand Down
45 changes: 45 additions & 0 deletions BVSwift/BVConversations/Display/Fields/Types/BVFormatStats.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
//
// BVFormatStats.swift
// BVSwift
//
// Copyright © 2025 Bazaarvoice. All rights reserved.
//

import Foundation

internal struct BVFormatStats: BVQueryField {

private let value: CustomStringConvertible

var internalDescription: String {
return BVConversationsConstants.BVReviewSummary.Keys.formatType
}

var representedValue: CustomStringConvertible {
return value
}

var description: String {
return internalDescription
}

init(_ _value: BVFormatStatsType) {
value = _value.representedValue
}
}

public enum BVFormatStatsType: Int {

case bullet
case paragraph

public var representedValue: CustomStringConvertible {
switch self {
case .bullet:
return BVConversationsConstants.BVReviewSummary.Keys.bullet
case .paragraph:
return BVConversationsConstants.BVReviewSummary.Keys.paragraph
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ extension BVReviewSummaryQuery: BVQueryUnsafeField {
}
}

// MARK: - BVReviewSummaryQuery: BVQueryEmbedStatable
extension BVReviewSummaryQuery: BVQueryFormatStatable {
@discardableResult
public func formatType(_ value: String) -> Self {
let formatType: BVURLParameter = .field(BVReviewSummaryFormatStats(value), nil)
extension BVReviewSummaryQuery {
public func formatType(_ value: BVFormatStatsType) -> Self {
let formatType: BVURLParameter = .field(BVFormatStats(value), nil)
add(formatType)
return self
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ internal struct BVProductSentimentsConstants {
static let productId: String = "productId"
static let limit: String = "limit"
static let embed: String = "embed"
static let quotes: String = "quotes"
static let feature: String = "feature"
static let language: String = "language"
}
}

Expand Down
17 changes: 15 additions & 2 deletions BVSwift/BVProductSentiments/Sentiments/Stats/BVEmbedStats.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ internal struct BVEmbedStats: BVQueryField {
return internalDescription
}

init(_ _value: String) {
value = "\(_value)"
init(_ _value: BVEmbedStatsType) {
value = _value.representedValue
}
}


public enum BVEmbedStatsType: Int {

case quotes

public var representedValue: CustomStringConvertible {
switch self {
case .quotes:
return BVProductSentimentsConstants.BVQueryType.Keys.quotes
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal struct BVLanguageStats: BVQueryField {
private let value: CustomStringConvertible

var internalDescription: String {
return BVConversationsConstants.BVQueryType.Keys.language
return BVProductSentimentsConstants.BVQueryType.Keys.language
}

var representedValue: CustomStringConvertible {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ extension BVSummarisedFeaturesQuery: BVQueryLanguageStatable {
}
}

// MARK: - BVSummarisedFeaturesQuery: BVQueryEmbedStatable
extension BVSummarisedFeaturesQuery: BVQueryEmbedStatable {
@discardableResult
public func embed(_ value: String) -> Self {
extension BVSummarisedFeaturesQuery {
public func embed(_ value: BVEmbedStatsType) -> Self {
let embed: BVURLParameter = .field(BVEmbedStats(value), nil)
add(embed)
return self
Expand Down
2 changes: 1 addition & 1 deletion BVSwift/Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.15.2</string>
<string>1.15.3</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSPrincipalClass</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BVReviewSummaryQueryTest: XCTestCase {
description: "testProductReviewSummaryQuery")

let reviewSummaryQueryRequest = BVProductReviewSummaryQuery(productId: "P000036")
.formatType("bullet") //paragraph
.formatType(.paragraph) //.bullet
.configure(BVReviewSummaryQueryTest.config)
.handler { (response: BVReviewSummaryQueryResponse<BVReviewSummary>) in
// success
Expand All @@ -68,7 +68,6 @@ class BVReviewSummaryQueryTest: XCTestCase {
XCTAssertNotNil(reviewSummary.summary)
expectation.fulfill()
}

reviewSummaryQueryRequest.async()
self.waitForExpectations(timeout: 20) { (error) in
XCTAssertNil(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BVSummarisedFeaturesQueryTest: XCTestCase {
self.expectation(description: "testProductSummarisedFeatures")

let query = BVSummarisedFeaturesQuery(productId: "P000010")
.embed("quotes")
.embed(.quotes)
.language("en")
.configure(BVSummarisedFeaturesQueryTest.config)
.handler { (response: BVProductSentimentsQueryResponse<BVSummarisedFeatures>) in
Expand Down

0 comments on commit ec8ddfa

Please sign in to comment.