aboutyou-sdk 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/aboutyou-sdk/Model/Product.rb +5 -6
- data/tests/Sinatra-test/Main.rb +40 -1
- data/tests/testAutocomplete.rb +2 -1
- data/tests/testCatFilter.rb +1 -1
- data/tests/testCatTree.rb +1 -1
- data/tests/testFacetTypes.rb +1 -1
- data/tests/testFacets.rb +0 -1
- data/tests/testFetchFacet.rb +1 -1
- data/tests/testJavaScript.rb +1 -1
- data/tests/testProdCatLongestPath.rb +1 -1
- data/tests/testProductSearchResult.rb +1 -1
- data/tests/testProductsByEans.rb +3 -3
- data/tests/testProductsByIds.rb +0 -0
- data/tests/testSuggest.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjEzOTI5OTAzNjY0YjAxOTBmNTg5YWI4NWM5OTIwOGQzZTcyYjYxYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTBhYzcwMWRiOGI1YmY0NjUyZmU2ZDM3ODc5Y2IzMDhiZjJmODUxMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDhhYzUwMjc5OTI0ZjU3YzJkNTEwZTc5ZDY1MjlmNGI3NTUwZmQzZmNkZTE4
|
10
|
+
ZmJlYWY1MzA2MmUwYTIyNTk0MTdiNWE1MjEzMDg5ZDMxMjNkN2U5NTZhY2Iz
|
11
|
+
MGI4ODNjMDNjM2U0OThlODg0MjBiYjYwOWUwOTg4MmFiN2U3NDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWFmNWM3M2EzNTJhNGEyNGQ2YTZiMmM3NmIxOWNmYThjZmQ0ZDJmYTVhMWIx
|
14
|
+
Yzk3NWE0MGE5ODA5ZDBjYWRiN2JmN2IxOTEyNzg4YTI0ZDgxZjZlM2Q0ZTM2
|
15
|
+
ZWRlYWUzMWFiODkzZjE4YzBjYjA5NzQ5MmQ1OTU0OGI0M2I4OTg=
|
@@ -35,7 +35,6 @@ module AboutYou
|
|
35
35
|
|
36
36
|
def self.createFromJson(jsonObject, factory, appId)
|
37
37
|
product = self.new
|
38
|
-
|
39
38
|
# these are required fields
|
40
39
|
raise 'MalformedJsonException!' unless jsonObject["id"] || jsonObject["name"]
|
41
40
|
|
@@ -57,14 +56,14 @@ module AboutYou
|
|
57
56
|
product.maxSavingsPercentage = jsonObject["max_savings_percentage"] ? jsonObject["max_savings_percentage"] : nil
|
58
57
|
|
59
58
|
product.defaultImage = jsonObject["default_image"] ? factory.createImage(jsonObject["default_image"]) : nil
|
60
|
-
product.defaultVariant = jsonObject["default_variant"] ? factory.createVariant(jsonObject["default_variant"]) : nil
|
59
|
+
product.defaultVariant = jsonObject["default_variant"] ? factory.createVariant(jsonObject["default_variant"], self) : nil
|
61
60
|
|
62
61
|
product.variants = product.parseVariants(jsonObject, factory, product)
|
63
62
|
product.inactiveVariants = product.parseVariants(jsonObject, factory, product, 'inactive_variants')
|
64
63
|
product.styles = product.parseStyles(jsonObject, factory)
|
65
64
|
|
66
65
|
key = 'categories.' + String(appId)
|
67
|
-
product.categoryIdPaths = jsonObject[
|
66
|
+
product.categoryIdPaths = jsonObject[key] ? jsonObject[key] : []
|
68
67
|
|
69
68
|
product.facetIds = product.parseFacetIds(jsonObject)
|
70
69
|
|
@@ -165,16 +164,16 @@ module AboutYou
|
|
165
164
|
end
|
166
165
|
|
167
166
|
def facetGroupSet
|
168
|
-
self.generateFacetGroupSet unless
|
167
|
+
self.generateFacetGroupSet unless @facetGroups
|
169
168
|
|
170
|
-
|
169
|
+
@facetGroups
|
171
170
|
end
|
172
171
|
|
173
172
|
|
174
173
|
def category(active = false)
|
175
174
|
return nil unless self.categoryIdPaths
|
176
175
|
|
177
|
-
|
176
|
+
self.leafCategories(active)[self.leafCategories(active).keys[0]]
|
178
177
|
end
|
179
178
|
|
180
179
|
def categoryWithLongestActivePath
|
data/tests/Sinatra-test/Main.rb
CHANGED
@@ -1,5 +1,44 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
|
3
|
-
get "/" do
|
3
|
+
get "/autocomplete" do
|
4
|
+
erb :autocomplete
|
5
|
+
end
|
6
|
+
get "/docExampleCart" do
|
7
|
+
erb :docExampleCart
|
8
|
+
end
|
9
|
+
get "/docExampleCategories" do
|
10
|
+
erb :docExampleCategories
|
11
|
+
end
|
12
|
+
get "/docExampleCategoriesFacets" do
|
13
|
+
erb :docExampleCategoriesFacets
|
14
|
+
end
|
15
|
+
get "/docExampleProducts" do
|
16
|
+
erb :docExampleProducts
|
17
|
+
end
|
18
|
+
get "/docExampleProductsBreadcrumb" do
|
19
|
+
erb :docExampleProductsBreadcrumb
|
20
|
+
end
|
21
|
+
get "/docExampleProductsFacets" do
|
22
|
+
erb :docExampleProductsFacets
|
23
|
+
end
|
24
|
+
get "/docExampleProductsPriceRanges" do
|
25
|
+
erb :docExampleProductsPriceRanges
|
26
|
+
end
|
27
|
+
get "/docExampleProductsSaleFacets" do
|
28
|
+
erb :docExampleProductsSaleFacets
|
29
|
+
end
|
30
|
+
get "/docExampleProductsSelectCategory" do
|
31
|
+
erb :docExampleProductsSelectCategory
|
32
|
+
end
|
33
|
+
get "/docExampleProductsStyle" do
|
34
|
+
erb :docExampleProductsStyle
|
35
|
+
end
|
36
|
+
get "/docExampleVariantsByEans" do
|
37
|
+
erb :docExampleVariantsByEans
|
38
|
+
end
|
39
|
+
get "/filterCatId" do
|
40
|
+
erb :filterCatId
|
41
|
+
end
|
42
|
+
get "/testDocExample" do
|
4
43
|
erb :testDocExample
|
5
44
|
end
|
data/tests/testAutocomplete.rb
CHANGED
data/tests/testCatFilter.rb
CHANGED
data/tests/testCatTree.rb
CHANGED
data/tests/testFacetTypes.rb
CHANGED
data/tests/testFacets.rb
CHANGED
data/tests/testFetchFacet.rb
CHANGED
data/tests/testJavaScript.rb
CHANGED
data/tests/testProductsByEans.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'pry_debug'
|
3
|
-
|
3
|
+
require_relative '../lib/aboutyou-sdk.rb'
|
4
4
|
|
5
5
|
class AY
|
6
6
|
attr_accessor :result
|
@@ -27,8 +27,8 @@ shop.result = ""
|
|
27
27
|
productsResult = shop.fetchProductsByEans(["7323000051968"], ["variants", "default_image"])
|
28
28
|
productsResult.products.each do |prod|
|
29
29
|
shop.result = shop.result + '<ul>' + '<li>' + String(prod.id) + ' : ' + prod.name + '</br>' + '<img src="' + prod.defaultImage.url + '">'
|
30
|
-
prod.variants.
|
31
|
-
shop.result = shop.result + '<ul>' + '<li>' + 'Variante: '
|
30
|
+
prod.variants.each do |key, var|
|
31
|
+
shop.result = shop.result + '<ul>' + '<li>' + 'Variante: ' + String(var.id) + '</ul>'
|
32
32
|
end
|
33
33
|
shop.result = shop.result + '</li>' + '</ul>'
|
34
34
|
end
|
data/tests/testProductsByIds.rb
CHANGED
File without changes
|
data/tests/testSuggest.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aboutyou-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferenc Beutel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|