Skip to content

Commit

Permalink
Merge pull request #4 from msomhorst/master
Browse files Browse the repository at this point in the history
XSD update and SearchBuilder extention
  • Loading branch information
pvdissel committed Nov 20, 2015
2 parents af5a64e + 17b9802 commit d45dcbf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,33 @@ class OpenApiClientIntegrationSpec extends Specification {
product.offerData.offers.size() >= 1
}

def 'Return products and categories'() {
def results = OpenApiClient.withDefaultClient(apiKey).searchBuilder()
.term('harry potter')
.dataType(QueryDataType.DataType.PRODUCTS)
.dataType(QueryDataType.DataType.CATEGORIES)
.search()

expect:
results.totalResultSize >= 1
results.products.size() > 0
results.categories.size() > 0
results.refinementGroups.size() == 0
}

def 'Return only refinements'() {
def results = OpenApiClient.withDefaultClient(apiKey).searchBuilder()
.term('harry potter')
.dataType(QueryDataType.DataType.REFINEMENTS)
.search()

expect:
results.totalResultSize >= 1
results.products.size() == 0
results.categories.size() == 0
results.refinementGroups.size() > 0
}

def 'Can find out if the OpenAPI is healthy'() {
def status = OpenApiClient.withDefaultClient(apiKey).getHealthStatus()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public SearchBuilder category(String id) {
return new SearchBuilder(this);
}

public SearchBuilder dataType(QueryDataType.DataType dataType) {
dataTypes.add(dataType);
return new SearchBuilder(this);
}

public SearchBuilder allOffers() {
offerTypes.add(ALL);
return new SearchBuilder(this);
Expand Down
4 changes: 4 additions & 0 deletions subprojects/schema/src/main/xsd/openapi-4.0.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<xs:element name="ShortDescription" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="LongDescription" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="TrackLists" type="TrackList" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="energyLabelLetter" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="AttributeGroups" type="AttributeGroup" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EntityGroups" type="EntityGroup" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Urls" type="Entry" minOccurs="0" maxOccurs="unbounded"/>
Expand All @@ -98,6 +99,7 @@
<xs:element name="Comment" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="Seller" type="Seller" minOccurs="0" maxOccurs="1"/>
<xs:element name="bestOffer" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="ReleaseDate" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -131,6 +133,7 @@
<xs:element name="warrantyConditions" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="repairConditions" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="approvalPercentage" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="registrationDate" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>

Expand Down Expand Up @@ -265,6 +268,7 @@
<xs:sequence>
<xs:element name="Category" minOccurs="0" maxOccurs="1" type="Category"/>
<xs:element name="RefinementGroups" minOccurs="0" maxOccurs="unbounded" type="RefinementGroup"/>
<xs:element name="RetailId" minOccurs="0" maxOccurs="1" type="xs:string"/>
</xs:sequence>
</xs:complexType>

Expand Down

0 comments on commit d45dcbf

Please sign in to comment.