aboutyou-sdk 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/aboutyou-sdk.rb +208 -136
- data/lib/aboutyou-sdk/Client.rb +35 -8
- data/lib/aboutyou-sdk/Constants.rb +5 -5
- data/lib/aboutyou-sdk/Model/Category.rb +2 -2
- data/lib/aboutyou-sdk/Query.rb +104 -26
- data/lib/aboutyou-sdk/QueryBuilder.rb +141 -64
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjEwNWU3MTUxOGVmMWM4OGU1NmI3N2EzODUxZDQxNDc4MTYwMDg1ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjJhZTViOGQzOTNmNGQzN2RmNjY2YjE5ZjMyNWJlNWZmZjczNjQ4Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2IyNDAyNTE1OGY2MjY3YmRkZjQ4ZjY5ZWY0NWY3OTBjNmY5YjRhYzAxYmRl
|
10
|
+
YmI1YWNhOTE1YzllNDAwMGQ1MjIyNTIyMjdhMTJhMmQ5ZWE3Y2IyZThiNzlh
|
11
|
+
ZmZmZDhiZjg0ZWE4MGFiZGJjZThlZjQ1YjlmNzYwZTJmYjYxMzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjExZDYwM2U1YTdiZWNmY2EyZDdiYmEwYjAwZDJiZjkzOWE1NmRlZDA1Y2Nm
|
14
|
+
NTVlYjRmMzhjMmZmNjBjNDU1ZDQ3MjE0OTBjMzVkOTIzNThjNmEyNThkMmU3
|
15
|
+
NjIwYjk1MDg0NTQ3N2NiNDgzNWFlYzhiM2I0NjFhZTE0MWFiNDI=
|
data/lib/aboutyou-sdk.rb
CHANGED
@@ -8,7 +8,7 @@ require_rel "aboutyou-sdk"
|
|
8
8
|
# Provides access to the Collins Frontend Platform.
|
9
9
|
# All the public methods cover a single API query.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# author:: Collins GmbH & Co KG
|
12
12
|
###
|
13
13
|
class AY
|
14
14
|
IMAGE_URL_STAGE = 'http://mndb.staging.aboutyou.de/mmdb/file'
|
@@ -26,16 +26,35 @@ class AY
|
|
26
26
|
attr_accessor :sessionId
|
27
27
|
|
28
28
|
###
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
|
29
|
+
# the Constructor for the AY class
|
30
|
+
#
|
31
|
+
# * *Args* :
|
32
|
+
# - +appId+ -> The App-Id of the App
|
33
|
+
# - +appPassword+ -> The Auth-Token of the App
|
34
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
35
|
+
# - +apiEndPoint+ -> Can be either live or staging
|
36
|
+
# - +resultFactory+ -> If nil it will use the DefaultModelFactory with the DefaultFacetManager
|
37
|
+
# - +logger+ -> Logger-Template
|
38
|
+
# - +facetManagerCache+ -> The prefered Caching-Strategy
|
39
|
+
#
|
40
|
+
# * *Returns* :
|
41
|
+
# - Instance of AY
|
42
|
+
###
|
43
|
+
def initialize(
|
44
|
+
appId,
|
45
|
+
appPassword,
|
46
|
+
sessionId = 'SESSION_ID',
|
47
|
+
apiEndPoint = AboutYou::SDK::Constants::API_ENVIRONMENT_LIVE,
|
48
|
+
resultFactory = nil,
|
49
|
+
logger = nil,
|
50
|
+
facetManagerCache = nil
|
51
|
+
)
|
34
52
|
|
35
53
|
self.sessionId = sessionId
|
36
54
|
self.appId = appId
|
37
55
|
self.appPassword = appPassword
|
38
56
|
self.aboutYouClient = AboutYou::SDK::Client.new(appId, appPassword, apiEndPoint, logger)
|
57
|
+
resultFactory ? self.modelFactoryInstance = resultFactory : initDefaultFactory(facetManagerCache)
|
39
58
|
|
40
59
|
if apiEndPoint == AboutYou::SDK::Constants::API_ENVIRONMENT_STAGE
|
41
60
|
self.baseImageUrl=(IMAGE_URL_STAGE)
|
@@ -53,17 +72,15 @@ class AY
|
|
53
72
|
# Adds a single item into the basket.
|
54
73
|
# You can specify an amount. Please mind, that an amount > 1 will result in #amount basket positions.
|
55
74
|
# So if you read out the basket again later, it's your job to merge the positions again.
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
|
65
|
-
# @throws \InvalidArgumentException
|
66
|
-
##
|
75
|
+
#
|
76
|
+
# * *Args* :
|
77
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
78
|
+
# - +variantId+ -> The Id of the Variant which should be added to the basket
|
79
|
+
# - +amount+ -> The Amount of the Item which should be added to the basket
|
80
|
+
#
|
81
|
+
# * *Returns* :
|
82
|
+
# - Instance of AboutYou::SDK::Model::Basket
|
83
|
+
###
|
67
84
|
def addItemToBasket(sessionId, variantId, amount = 1)
|
68
85
|
|
69
86
|
basket = AboutYou::SDK::Model::Basket.new
|
@@ -76,7 +93,6 @@ class AY
|
|
76
93
|
end
|
77
94
|
end
|
78
95
|
|
79
|
-
|
80
96
|
amount.times do
|
81
97
|
basket.updateItem(AboutYou::SDK::Model::Basket::BasketItem.new(generateBasketItemId, variantId))
|
82
98
|
end
|
@@ -84,7 +100,15 @@ class AY
|
|
84
100
|
updateBasket(sessionId, basket)
|
85
101
|
end
|
86
102
|
|
87
|
-
|
103
|
+
|
104
|
+
###
|
105
|
+
# Method to create a unique item id for items in basket
|
106
|
+
#
|
107
|
+
# * *Args* :
|
108
|
+
#
|
109
|
+
# * *Returns* :
|
110
|
+
# - an Intger
|
111
|
+
###
|
88
112
|
def generateBasketItemId
|
89
113
|
|
90
114
|
'i_' + SecureRandom.uuid
|
@@ -92,12 +116,14 @@ class AY
|
|
92
116
|
|
93
117
|
|
94
118
|
###
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
119
|
+
# Method to remove items from basket
|
120
|
+
#
|
121
|
+
# * *Args* :
|
122
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
123
|
+
# - +itemIds+ -> an Array of Item ids which should be removed
|
124
|
+
#
|
125
|
+
# * *Returns* :
|
126
|
+
# - Instance of AboutYou::SDK::Model::Basket
|
101
127
|
###
|
102
128
|
def removeItemsFromBasket(sessionId, itemIds)
|
103
129
|
|
@@ -109,10 +135,14 @@ class AY
|
|
109
135
|
|
110
136
|
|
111
137
|
###
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
138
|
+
# Method to update a given basket
|
139
|
+
#
|
140
|
+
# * *Args* :
|
141
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
142
|
+
# - +basket+ -> an Instance of a basket
|
143
|
+
#
|
144
|
+
# * *Returns* :
|
145
|
+
# - Instance of AboutYou::SDK::Model::Basket
|
116
146
|
###
|
117
147
|
def updateBasket(sessionId, basket)
|
118
148
|
|
@@ -121,12 +151,16 @@ class AY
|
|
121
151
|
|
122
152
|
|
123
153
|
###
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
154
|
+
# Method to initiaite the order
|
155
|
+
#
|
156
|
+
# * *Args* :
|
157
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
158
|
+
# - +successUrl+ -> callback URL if the order was OK
|
159
|
+
# - +cancelUrl+ -> callback URL if the order was canceled [optional]
|
160
|
+
# - +errorUrl+ -> callback URL if the order had any exceptions [optional]
|
161
|
+
#
|
162
|
+
# * *Returns* :
|
163
|
+
# - Instance of AboutYou::SDK::Model::InitiateOrder
|
130
164
|
###
|
131
165
|
def initiateOrder(sessionId,successUrl,cancelUrl = nil,errorUrl = nil)
|
132
166
|
|
@@ -137,13 +171,15 @@ class AY
|
|
137
171
|
###
|
138
172
|
# Returns the result of an auto completion API request.
|
139
173
|
# Auto completion searches for products and categories by
|
140
|
-
# a given prefix (
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
174
|
+
# a given prefix (searchword).
|
175
|
+
#
|
176
|
+
# * *Args* :
|
177
|
+
# - +searchword+ -> The prefix search word to search for
|
178
|
+
# - +limit+ -> Maximum number of results [optional]
|
179
|
+
# - +types+ -> Array of types to search for [optional]
|
180
|
+
#
|
181
|
+
# * *Returns* :
|
182
|
+
# - Instance of AboutYou::SDK::Model::Automcomplete
|
147
183
|
###
|
148
184
|
def fetchAutocomplete(searchword, limit = 50, types = [AboutYou::SDK::Constants::TYPE_PRODUCTS, AboutYou::SDK::Constants::TYPE_CATEGORIES])
|
149
185
|
|
@@ -153,13 +189,12 @@ class AY
|
|
153
189
|
|
154
190
|
###
|
155
191
|
# Fetch the basket of the given sessionId.
|
156
|
-
#
|
157
|
-
#
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
# @throws ShopApi\Exception\UnexpectedResultException
|
192
|
+
#
|
193
|
+
# * *Args* :
|
194
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
195
|
+
#
|
196
|
+
# * *Returns* :
|
197
|
+
# - Instance of AboutYou::SDK::Model::Basket
|
163
198
|
###
|
164
199
|
def fetchBasket(sessionId)
|
165
200
|
|
@@ -171,10 +206,12 @@ class AY
|
|
171
206
|
# Returns the result of a category search API request.
|
172
207
|
# By passing one or several category ids it will return
|
173
208
|
# a result of the categories data.
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
209
|
+
#
|
210
|
+
# * *Args* :
|
211
|
+
# - +ids+ -> either a single category ID as integer or an array of IDs [optional]
|
212
|
+
#
|
213
|
+
# * *Returns* :
|
214
|
+
# - Instance of AboutYou::SDK::Model::CategoriesResult
|
178
215
|
###
|
179
216
|
def fetchCategoriesByIds(ids = nil)
|
180
217
|
# we allow to pass a single ID instead of an array
|
@@ -189,12 +226,10 @@ class AY
|
|
189
226
|
|
190
227
|
|
191
228
|
###
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
# @throws ShopApi\Exception\MalformedJsonException
|
197
|
-
# @throws ShopApi\Exception\UnexpectedResultException
|
229
|
+
# Fetches the Root Categories of the Category Tree
|
230
|
+
#
|
231
|
+
# * *Returns* :
|
232
|
+
# - Instance of AboutYou::SDK::Model::CategoryTree
|
198
233
|
###
|
199
234
|
def fetchCategoryTree
|
200
235
|
|
@@ -203,17 +238,13 @@ class AY
|
|
203
238
|
|
204
239
|
|
205
240
|
###
|
206
|
-
# The Categories will be
|
207
|
-
#
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
#
|
214
|
-
# @param bool $fetchIfEmpty
|
215
|
-
#
|
216
|
-
# @return CategoryManagerInterface
|
241
|
+
# The Categories will be fetched automatically, if required by any other fetch method
|
242
|
+
#
|
243
|
+
# * *Args* :
|
244
|
+
# - +fetchIfEmpty+ -> defines whether to fetch if empty or not [optional]
|
245
|
+
#
|
246
|
+
# * *Returns* :
|
247
|
+
# - Instance of AboutYou::SDK::CategoryManager::DefaultCategoryManager
|
217
248
|
###
|
218
249
|
def categoryManager(fetchIfEmpty = true)
|
219
250
|
|
@@ -228,13 +259,14 @@ class AY
|
|
228
259
|
|
229
260
|
|
230
261
|
###
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
262
|
+
# Fetches the products for specific ids
|
263
|
+
#
|
264
|
+
# * *Args* :
|
265
|
+
# - +ids+ -> Either a single id or an Array of ids which should be fetched
|
266
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
267
|
+
#
|
268
|
+
# * *Returns* :
|
269
|
+
# - Instance of AboutYou::SDK::Model::ProductsResult
|
238
270
|
###
|
239
271
|
def fetchProductsByIds(ids , fields = [])
|
240
272
|
# we allow to pass a single ID instead of an array
|
@@ -251,12 +283,13 @@ class AY
|
|
251
283
|
|
252
284
|
|
253
285
|
###
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
286
|
+
# Fetches variants for specific ids
|
287
|
+
#
|
288
|
+
# * *Args* :
|
289
|
+
# - +ids+ -> Either a single id or an Array of ids which should be fetched
|
290
|
+
#
|
291
|
+
# * *Returns* :
|
292
|
+
# - Instance of AboutYou::SDK::Model::VariantsResult
|
260
293
|
###
|
261
294
|
def fetchVariantsByIds(ids)
|
262
295
|
# we allow to pass a single ID instead of an array
|
@@ -274,13 +307,14 @@ class AY
|
|
274
307
|
|
275
308
|
|
276
309
|
###
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
#
|
283
|
-
#
|
310
|
+
# Fetches products for specific eans
|
311
|
+
#
|
312
|
+
# * *Args* :
|
313
|
+
# - +eans+ -> Either a single ean or an Array of eans which should be fetched
|
314
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
315
|
+
#
|
316
|
+
# * *Returns* :
|
317
|
+
# - Instance of AboutYou::SDK::Model::ProductsEanResult
|
284
318
|
###
|
285
319
|
def fetchProductsByEans(eans,fields = [])
|
286
320
|
# we allow to pass a single ID instead of an array
|
@@ -292,12 +326,13 @@ class AY
|
|
292
326
|
|
293
327
|
|
294
328
|
###
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
329
|
+
# Fetches the response for a product search
|
330
|
+
#
|
331
|
+
# * *Args* :
|
332
|
+
# - +criteria+ -> Hash containing one or multiple search terms
|
333
|
+
#
|
334
|
+
# * *Returns* :
|
335
|
+
# - Instance of AboutYou::SDK::Model::ProductSearchResult
|
301
336
|
###
|
302
337
|
def fetchProductSearch(criteria)
|
303
338
|
|
@@ -306,14 +341,13 @@ class AY
|
|
306
341
|
|
307
342
|
|
308
343
|
###
|
309
|
-
# Fetch the facets of the given groupIds
|
310
|
-
#
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#@throws ShopApi\Exception\UnexpectedResultException
|
344
|
+
# Fetch the facets of the given groupIds
|
345
|
+
#
|
346
|
+
# * *Args* :
|
347
|
+
# - +groupIds+ -> Array of group ids [optional]
|
348
|
+
#
|
349
|
+
# * *Returns* :
|
350
|
+
# - Instance of AboutYou::SDK::Model::Facet
|
317
351
|
###
|
318
352
|
def fetchFacets(groupIds=[])
|
319
353
|
|
@@ -321,6 +355,12 @@ class AY
|
|
321
355
|
end
|
322
356
|
|
323
357
|
|
358
|
+
###
|
359
|
+
# Fetches all possible Facet types
|
360
|
+
#
|
361
|
+
# * *Returns* :
|
362
|
+
# - Array with all group ids
|
363
|
+
###
|
324
364
|
def fetchFacetTypes
|
325
365
|
|
326
366
|
query.fetchFacetTypes.executeSingle
|
@@ -328,9 +368,12 @@ class AY
|
|
328
368
|
|
329
369
|
|
330
370
|
###
|
331
|
-
#
|
332
|
-
#
|
333
|
-
#
|
371
|
+
# fetches Order for specific id
|
372
|
+
#
|
373
|
+
# * *Args* :
|
374
|
+
# - +orderId+ -> The id for which an order should be returned
|
375
|
+
# * *Returns* :
|
376
|
+
# - Instance of AboutYou::SDK::Model::Order
|
334
377
|
###
|
335
378
|
def fetchOrder(orderId)
|
336
379
|
|
@@ -340,18 +383,12 @@ class AY
|
|
340
383
|
|
341
384
|
###
|
342
385
|
# Fetch single facets by id and group id
|
343
|
-
#
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
# @param array $params Array of (id, group_id) pairs
|
350
|
-
#
|
351
|
-
# @return \Collins\ShopApi\Model\Facet[] With facet id as key.
|
352
|
-
#
|
353
|
-
# @throws ShopApi\Exception\MalformedJsonException
|
354
|
-
# @throws ShopApi\Exception\UnexpectedResultException
|
386
|
+
#
|
387
|
+
# * *Args* :
|
388
|
+
# - +params+ -> Hash containing 2 keys: "id", "group_id"
|
389
|
+
#
|
390
|
+
# * *Returns* :
|
391
|
+
# - AboutYou::SDK::Model::Facet
|
355
392
|
###
|
356
393
|
def fetchFacet(params)
|
357
394
|
|
@@ -363,10 +400,11 @@ class AY
|
|
363
400
|
# Returns the result of a suggest API request.
|
364
401
|
# Suggestions are words that are often searched together
|
365
402
|
# with the searchword you pass (e.g. "stretch" for "jeans").
|
366
|
-
#
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
403
|
+
#
|
404
|
+
# * *Args* :
|
405
|
+
# - +searchword+ -> The search string to search for
|
406
|
+
# * *Returns* :
|
407
|
+
# - an Array containing the suggestions
|
370
408
|
###
|
371
409
|
def fetchSuggest(searchword)
|
372
410
|
|
@@ -377,20 +415,33 @@ class AY
|
|
377
415
|
###
|
378
416
|
# Returns the list of child apps
|
379
417
|
#
|
380
|
-
#
|
418
|
+
# * *returns* :
|
419
|
+
# - an Array containing all child Apps
|
381
420
|
###
|
382
421
|
def fetchChildApps
|
383
422
|
|
384
423
|
query.fetchChildApps.executeSingle
|
385
424
|
end
|
386
425
|
|
387
|
-
|
426
|
+
|
427
|
+
###
|
428
|
+
# Method for getting the query
|
429
|
+
#
|
430
|
+
# * *Returns* :
|
431
|
+
# - an Instance of AboutYou::SDK::Query
|
432
|
+
###
|
388
433
|
def query
|
389
434
|
|
390
435
|
AboutYou::SDK::Query.new(self.aboutYouClient, modelFactory)
|
391
436
|
end
|
392
437
|
|
393
438
|
|
439
|
+
###
|
440
|
+
# Method for getting the model factory. If no model factory is set it initializes the default one
|
441
|
+
#
|
442
|
+
# * *Returns* :
|
443
|
+
# - an Instance of AboutYou::SDK::Factory::DefaultModelFactory
|
444
|
+
###
|
394
445
|
def modelFactory
|
395
446
|
|
396
447
|
unless self.modelFactoryInstance
|
@@ -402,9 +453,12 @@ class AY
|
|
402
453
|
|
403
454
|
|
404
455
|
###
|
405
|
-
#
|
406
|
-
#
|
407
|
-
#
|
456
|
+
# Method for getting the product search criteria base class, on which you can specify your criteria
|
457
|
+
#
|
458
|
+
# * *Args* :
|
459
|
+
# - +sessionId+ -> a string containing the session id [optional]
|
460
|
+
# * *Returns* :
|
461
|
+
# - AboutYou::SDK::Criteria::ProductSearchCriteria
|
408
462
|
###
|
409
463
|
def productSearchCriteria(sessionId=nil)
|
410
464
|
unless sessionId
|
@@ -420,8 +474,9 @@ class AY
|
|
420
474
|
# to add product variants into the basket of Mary & Paul or auto-resizing
|
421
475
|
# the Iframe. This URL may be changed in future, so please use this method instead
|
422
476
|
# of hardcoding the URL into your HTML template.
|
423
|
-
#
|
424
|
-
#
|
477
|
+
#
|
478
|
+
# * *Returns* :
|
479
|
+
# - a string containing an url to the javascript file
|
425
480
|
###
|
426
481
|
def javaScriptURL
|
427
482
|
|
@@ -436,7 +491,8 @@ class AY
|
|
436
491
|
###
|
437
492
|
# Returns a HTML script tag that loads the Collins JavaScript fie.
|
438
493
|
#
|
439
|
-
#
|
494
|
+
# * *Returns* :
|
495
|
+
# - a string containing an HTML script tag
|
440
496
|
###
|
441
497
|
def javaScriptTag
|
442
498
|
|
@@ -445,8 +501,11 @@ class AY
|
|
445
501
|
|
446
502
|
|
447
503
|
###
|
448
|
-
#
|
449
|
-
#
|
504
|
+
# Setter-Method for the app-Credentials
|
505
|
+
#
|
506
|
+
# * *Args* :
|
507
|
+
# - +appId+ -> the id of an app
|
508
|
+
# - +appPassword+ -> the auth-token for the app
|
450
509
|
###
|
451
510
|
def appCredentials=(appId, appPassword)
|
452
511
|
|
@@ -458,7 +517,10 @@ class AY
|
|
458
517
|
|
459
518
|
|
460
519
|
###
|
461
|
-
#
|
520
|
+
# Setter-Method for the api endpoint
|
521
|
+
#
|
522
|
+
# * *Args* :
|
523
|
+
# - +apiEndPoint+ -> the endpoint can be the string 'stage' or 'live',
|
462
524
|
# then the default endpoints will be used or
|
463
525
|
# an absolute url
|
464
526
|
###
|
@@ -469,7 +531,10 @@ class AY
|
|
469
531
|
|
470
532
|
|
471
533
|
###
|
472
|
-
#
|
534
|
+
# Setter-Method for the base image url
|
535
|
+
#
|
536
|
+
# * *Args* :
|
537
|
+
# - +baseImageUrl+ -> nil will reset to the default url, false to get relative urls, otherwise the url prefix
|
473
538
|
###
|
474
539
|
def baseImageUrl=(baseImageUrl = nil)
|
475
540
|
|
@@ -483,7 +548,14 @@ class AY
|
|
483
548
|
|
484
549
|
self.modelFactory.baseImageUrl=(self.baseImageUrl)
|
485
550
|
end
|
486
|
-
|
551
|
+
|
552
|
+
|
553
|
+
###
|
554
|
+
# initializes the default model factory
|
555
|
+
#
|
556
|
+
# * *Args* :
|
557
|
+
# - +cache+ -> an Instance of the used cache [optional]
|
558
|
+
###
|
487
559
|
def initDefaultFactory(cache = nil)
|
488
560
|
|
489
561
|
resultFactory = AboutYou::SDK::Factory::DefaultModelFactory.new(self,
|
data/lib/aboutyou-sdk/Client.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
module AboutYou
|
2
2
|
module SDK
|
3
|
+
###
|
4
|
+
# This Class manages the API-Calls
|
5
|
+
#
|
6
|
+
# Author:: Collins GmbH & Co KG
|
7
|
+
###
|
3
8
|
class Client
|
4
9
|
|
5
10
|
API_END_POINT_STAGE = 'http://shop-api.staging.aboutyou.de/api'
|
@@ -11,6 +16,19 @@ module AboutYou
|
|
11
16
|
attr_accessor :apiEndPoint
|
12
17
|
attr_accessor :pageId
|
13
18
|
|
19
|
+
|
20
|
+
###
|
21
|
+
# the Constructor for the Client class
|
22
|
+
#
|
23
|
+
# * *Args* :
|
24
|
+
# - +appId+ -> The App-Id of the App
|
25
|
+
# - +appPassword+ -> The Auth-Token of the App
|
26
|
+
# - +apiEndPoint+ -> Can be either live or staging
|
27
|
+
# - +logger+ -> Logger-Template
|
28
|
+
#
|
29
|
+
# * *Returns* :
|
30
|
+
# - Instance of AboutYou::SDK::Client
|
31
|
+
###
|
14
32
|
def initialize(appId, appPassword, apiEndPoint = 'stage', logger = nil)
|
15
33
|
|
16
34
|
self.appId = appId
|
@@ -19,8 +37,11 @@ module AboutYou
|
|
19
37
|
|
20
38
|
|
21
39
|
###
|
22
|
-
#
|
23
|
-
#
|
40
|
+
# Setter for app-credentials
|
41
|
+
#
|
42
|
+
# * *Args* :
|
43
|
+
# - +appId+ -> The App-Id of the App
|
44
|
+
# - +appPassword+ -> The Auth-Token of the App
|
24
45
|
###
|
25
46
|
def appCredentials=(appId, appPassword)
|
26
47
|
|
@@ -30,9 +51,10 @@ module AboutYou
|
|
30
51
|
|
31
52
|
|
32
53
|
###
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
54
|
+
# Setter for the api endpoint
|
55
|
+
#
|
56
|
+
# * *Args* :
|
57
|
+
# - +apiEndPoint+ -> Can be either live or staging
|
36
58
|
###
|
37
59
|
def apiEndpoint=(apiEndPoint)
|
38
60
|
|
@@ -50,10 +72,15 @@ module AboutYou
|
|
50
72
|
|
51
73
|
|
52
74
|
###
|
53
|
-
# Builds a JSON string representing the request
|
54
|
-
# Executes the API request
|
75
|
+
# Builds a JSON string representing the request-data
|
76
|
+
# Executes the API request
|
77
|
+
# builds a JSON string representing the response-data
|
78
|
+
#
|
79
|
+
# * *Args* :
|
80
|
+
# - +body+ -> the body of the api-call, containing all request data
|
55
81
|
#
|
56
|
-
#
|
82
|
+
# * *Returns* :
|
83
|
+
# - Json-String containing the response-body
|
57
84
|
###
|
58
85
|
def request(body)
|
59
86
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
###
|
2
|
-
# Contains often used properties related to the App development.
|
3
|
-
#
|
4
|
-
# @author Antevorte GmbH
|
5
|
-
###
|
6
1
|
module AboutYou
|
7
2
|
module SDK
|
3
|
+
###
|
4
|
+
# Contains often used properties related to the App development.
|
5
|
+
#
|
6
|
+
# Author:: Collins GmbH & Co KG
|
7
|
+
###
|
8
8
|
module Constants
|
9
9
|
SDK_VERSION = 0.1
|
10
10
|
FACET_BRAND = 0
|
@@ -6,7 +6,6 @@ module AboutYou
|
|
6
6
|
ACTIVE_ONLY = true;
|
7
7
|
|
8
8
|
# @var integer */
|
9
|
-
@id;
|
10
9
|
attr_accessor :id
|
11
10
|
|
12
11
|
# @var string */
|
@@ -62,7 +61,7 @@ module AboutYou
|
|
62
61
|
category.isActive = jsonObject["active"];
|
63
62
|
category.position = jsonObject["position"];
|
64
63
|
category.categoryManager = catManager
|
65
|
-
|
64
|
+
|
66
65
|
return category;
|
67
66
|
end
|
68
67
|
|
@@ -89,6 +88,7 @@ module AboutYou
|
|
89
88
|
|
90
89
|
return self.categoryManager.category(self.parentId);
|
91
90
|
end
|
91
|
+
|
92
92
|
|
93
93
|
###
|
94
94
|
# @param bool $activeOnly
|
data/lib/aboutyou-sdk/Query.rb
CHANGED
@@ -2,6 +2,11 @@ require_relative 'QueryBuilder.rb'
|
|
2
2
|
|
3
3
|
module AboutYou
|
4
4
|
module SDK
|
5
|
+
###
|
6
|
+
# The Query class coordinates the building, executing and parsing of one or multiple API-calls
|
7
|
+
#
|
8
|
+
# Author:: Collins GmbH & Co KG
|
9
|
+
###
|
5
10
|
class Query
|
6
11
|
include AboutYou::SDK::QueryBuilder
|
7
12
|
|
@@ -16,6 +21,16 @@ module AboutYou
|
|
16
21
|
attr_accessor :allQuery
|
17
22
|
|
18
23
|
|
24
|
+
###
|
25
|
+
# the Constructor for the Query class
|
26
|
+
#
|
27
|
+
# * *Args* :
|
28
|
+
# - +client+ -> an instance of AboutYou::SDK::Client
|
29
|
+
# - +factory+ -> an instance of AboutYou::SDK::Factory::DefaultModelFactory
|
30
|
+
#
|
31
|
+
# * *Returns* :
|
32
|
+
# - Instance of AboutYou::SDK::Query
|
33
|
+
###
|
19
34
|
def initialize(client, factory)
|
20
35
|
self.client = client
|
21
36
|
self.query= []
|
@@ -42,13 +57,15 @@ module AboutYou
|
|
42
57
|
end
|
43
58
|
|
44
59
|
###
|
45
|
-
#
|
46
|
-
# @param int $limit Maximum number of results.
|
47
|
-
# @param array $types Array of types to search for (Constants::TYPE_...).
|
48
|
-
#
|
49
|
-
# @return $this
|
60
|
+
# wrapper-method for fetchAutocomplete which coordinates Category- and Facet-Manager
|
50
61
|
#
|
51
|
-
#
|
62
|
+
# * *Args* :
|
63
|
+
# - +searchword+ -> a String containing the word to search completitions for
|
64
|
+
# - +limit+ -> Maximum number of results [optional]
|
65
|
+
# - +types+ -> Array of types to search for [optional]
|
66
|
+
#
|
67
|
+
# * *Returns* :
|
68
|
+
# - Instance of AboutYou::SDK::Query
|
52
69
|
###
|
53
70
|
def fetchAutocomplete(searchword, limit = nil, types = nil)
|
54
71
|
|
@@ -61,9 +78,13 @@ module AboutYou
|
|
61
78
|
end
|
62
79
|
|
63
80
|
###
|
64
|
-
#
|
81
|
+
# wrapper-method for fetchBasket which coordinates Category- and Facet-Manager
|
65
82
|
#
|
66
|
-
#
|
83
|
+
# * *Args* :
|
84
|
+
# - +sessionId+ -> a String containing the session id of an user
|
85
|
+
#
|
86
|
+
# * *Returns* :
|
87
|
+
# - Instance of AboutYou::SDK::Query
|
67
88
|
###
|
68
89
|
def fetchBasket(sessionId)
|
69
90
|
|
@@ -76,10 +97,14 @@ module AboutYou
|
|
76
97
|
end
|
77
98
|
|
78
99
|
###
|
79
|
-
#
|
80
|
-
# @param array $fields
|
100
|
+
# wrapper-method for fetchProductsByIds which coordinates Category- and Facet-Manager
|
81
101
|
#
|
82
|
-
#
|
102
|
+
# * *Args* :
|
103
|
+
# - +ids+ -> Either a single id or an Array of ids which should be fetched
|
104
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
105
|
+
#
|
106
|
+
# * *Returns* :
|
107
|
+
# - Instance of AboutYou::SDK::Query
|
83
108
|
###
|
84
109
|
def fetchProductsByIds(ids,fields = [])
|
85
110
|
|
@@ -96,10 +121,14 @@ module AboutYou
|
|
96
121
|
end
|
97
122
|
|
98
123
|
###
|
99
|
-
#
|
100
|
-
# @param array $fields
|
124
|
+
# wrapper-method for fetchProductsByEans which coordinates Category- and Facet-Manager
|
101
125
|
#
|
102
|
-
#
|
126
|
+
# * *Args* :
|
127
|
+
# - +eans+ -> Either a single ean or an Array of eans which should be fetched
|
128
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
129
|
+
#
|
130
|
+
# * *Returns* :
|
131
|
+
# - Instance of AboutYou::SDK::Query
|
103
132
|
###
|
104
133
|
def fetchProductsByEans(eans,fields = [])
|
105
134
|
|
@@ -116,9 +145,13 @@ module AboutYou
|
|
116
145
|
end
|
117
146
|
|
118
147
|
###
|
119
|
-
#
|
148
|
+
# wrapper-method for fetchProductSearch which coordinates Category- and Facet-Manager
|
120
149
|
#
|
121
|
-
#
|
150
|
+
# * *Args* :
|
151
|
+
# - +criteria+ -> Hash containing one or multiple search terms
|
152
|
+
#
|
153
|
+
# * *Returns* :
|
154
|
+
# - Instance of AboutYou::SDK::Query
|
122
155
|
###
|
123
156
|
def fetchProductSearch(criteria)
|
124
157
|
|
@@ -133,7 +166,17 @@ module AboutYou
|
|
133
166
|
|
134
167
|
return self
|
135
168
|
end
|
169
|
+
|
136
170
|
|
171
|
+
###
|
172
|
+
# this method checks whether it is neccessary for the query to get the category-tree from the api
|
173
|
+
#
|
174
|
+
# * *Args* :
|
175
|
+
# - +fetchForced+ -> determines whether the requirance of the category tree is forced
|
176
|
+
#
|
177
|
+
# * *Returns* :
|
178
|
+
# - Instance of AboutYou::SDK::Query
|
179
|
+
###
|
137
180
|
def requireCategoryTree(fetchForced = false)
|
138
181
|
|
139
182
|
unless fetchForced || self.factory.categoryManager.isEmpty
|
@@ -148,6 +191,16 @@ module AboutYou
|
|
148
191
|
return self
|
149
192
|
end
|
150
193
|
|
194
|
+
|
195
|
+
###
|
196
|
+
# this method checks whether it is neccessary for the query to get the facets from the api
|
197
|
+
#
|
198
|
+
# * *Args* :
|
199
|
+
# - +fetchForced+ -> determines whether the requirance of the facets is forced
|
200
|
+
#
|
201
|
+
# * *Returns* :
|
202
|
+
# - Instance of AboutYou::SDK::Query
|
203
|
+
###
|
151
204
|
def requireFacets(fetchForced = false)
|
152
205
|
unless fetchForced || self.factory.facetManager.isEmpty
|
153
206
|
return self
|
@@ -160,8 +213,11 @@ module AboutYou
|
|
160
213
|
end
|
161
214
|
|
162
215
|
###
|
163
|
-
#
|
164
|
-
|
216
|
+
# the methods builds the complete query string which represents the body of the api call
|
217
|
+
#
|
218
|
+
# * *Returns* :
|
219
|
+
# - JSON-String containing all queries which need to be executed
|
220
|
+
###
|
165
221
|
def queryString
|
166
222
|
result = []
|
167
223
|
self.ghostQuery.each do |ghostQuery|
|
@@ -173,10 +229,11 @@ module AboutYou
|
|
173
229
|
|
174
230
|
|
175
231
|
###
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
|
232
|
+
# requests all of the queries and returns the parsed api-response
|
233
|
+
#
|
234
|
+
# * *Returns* :
|
235
|
+
# - an Array containing all of the models build with the data of the api
|
236
|
+
###
|
180
237
|
def execute
|
181
238
|
|
182
239
|
if self.query.empty? && self.ghostQuery.empty?
|
@@ -186,15 +243,23 @@ module AboutYou
|
|
186
243
|
end
|
187
244
|
|
188
245
|
###
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
246
|
+
# requests all of the queries and returns only the first parsed api-response
|
247
|
+
#
|
248
|
+
# * *Returns* :
|
249
|
+
# - the first model build with the data of the api
|
192
250
|
###
|
193
251
|
def executeSingle
|
194
252
|
|
195
253
|
execute[-1]
|
196
254
|
end
|
197
255
|
|
256
|
+
|
257
|
+
###
|
258
|
+
# this method checks whether the api delievered a valid json-response or not
|
259
|
+
#
|
260
|
+
# * *Args* :
|
261
|
+
# - +jsonResponse+ -> the plain json received from the api
|
262
|
+
###
|
198
263
|
def checkResponse(jsonResponse)
|
199
264
|
|
200
265
|
if jsonResponse == false || !(jsonResponse.is_a? Array) || jsonResponse.count != self.allQuery.count
|
@@ -217,7 +282,20 @@ module AboutYou
|
|
217
282
|
end
|
218
283
|
end
|
219
284
|
end
|
220
|
-
|
285
|
+
|
286
|
+
|
287
|
+
###
|
288
|
+
# parses the plain json result from the api and calls the respective modelfactory methods
|
289
|
+
# for building the models for the json resposne
|
290
|
+
#
|
291
|
+
# * *Args* :
|
292
|
+
# - +jsonResponse+ -> the plain json received from the api
|
293
|
+
# - +isMultiRequest+ -> boolean which determines whether the request has more then one
|
294
|
+
# query or not [optional]
|
295
|
+
#
|
296
|
+
# * *Returns* :
|
297
|
+
# - an Array containing all models build from the modelfactory
|
298
|
+
###
|
221
299
|
def parseResult(jsonResponse, isMultiRequest=true)
|
222
300
|
|
223
301
|
self.checkResponse(jsonResponse)
|
@@ -1,15 +1,23 @@
|
|
1
1
|
module AboutYou
|
2
2
|
module SDK
|
3
|
+
###
|
4
|
+
# the QueryBuilder is a module supporting the query with mroe complex logic
|
5
|
+
# concerning the building of the queries for the api-call
|
6
|
+
#
|
7
|
+
# Author:: Collins GmbH & Co KG
|
8
|
+
###
|
3
9
|
module QueryBuilder
|
4
10
|
|
5
11
|
###
|
6
|
-
#
|
7
|
-
# @param int $limit Maximum number of results.
|
8
|
-
# @param array $types Array of types to search for (Constants::TYPE_...).
|
9
|
-
#
|
10
|
-
# @return $this
|
12
|
+
# builds the autocompletion-query
|
11
13
|
#
|
12
|
-
#
|
14
|
+
# * *Args* :
|
15
|
+
# - +searchword+ -> a String containing the word to search completitions for
|
16
|
+
# - +limit+ -> Maximum number of results [optional]
|
17
|
+
# - +types+ -> Array of types to search for [optional]
|
18
|
+
#
|
19
|
+
# * *Returns* :
|
20
|
+
# - Instance of AboutYou::SDK::Query
|
13
21
|
###
|
14
22
|
def fetchAutocomplete(searchword, limit = nil, types = nil)
|
15
23
|
|
@@ -36,9 +44,13 @@ module AboutYou
|
|
36
44
|
end
|
37
45
|
|
38
46
|
###
|
39
|
-
#
|
47
|
+
# builds the basket-query
|
40
48
|
#
|
41
|
-
#
|
49
|
+
# * *Args* :
|
50
|
+
# - +sessionId+ -> a String containing the session id of an user
|
51
|
+
#
|
52
|
+
# * *Returns* :
|
53
|
+
# - Instance of AboutYou::SDK::Query
|
42
54
|
###
|
43
55
|
def fetchBasket(sessionId)
|
44
56
|
|
@@ -49,11 +61,14 @@ module AboutYou
|
|
49
61
|
end
|
50
62
|
|
51
63
|
###
|
52
|
-
#
|
53
|
-
# @param int $productVariantId ID of product variant.
|
54
|
-
# @param int $amount Amount of items to add.
|
64
|
+
# builds the basket-query
|
55
65
|
#
|
56
|
-
|
66
|
+
# * *Args* :
|
67
|
+
# - +sessionId+ -> a String containing the session id of an user
|
68
|
+
# - +items+ -> an Array containing all of the items which should be added
|
69
|
+
#
|
70
|
+
# * *Returns* :
|
71
|
+
# - Instance of AboutYou::SDK::Query
|
57
72
|
###
|
58
73
|
def addItemsToBasket(sessionId, items)
|
59
74
|
|
@@ -82,11 +97,14 @@ module AboutYou
|
|
82
97
|
end
|
83
98
|
|
84
99
|
###
|
85
|
-
#
|
86
|
-
# @param Model\BasketItemSet[] $itemSets
|
87
|
-
# @param int $amount Amount of items to add.
|
100
|
+
# builds the basket-query
|
88
101
|
#
|
89
|
-
#
|
102
|
+
# * *Args* :
|
103
|
+
# - +sessionId+ -> a String containing the session id of an user
|
104
|
+
# - +itemSets+ -> an instance of AboutYou::SDK::Model::BasketSet
|
105
|
+
#
|
106
|
+
# * *Returns* :
|
107
|
+
# - Instance of AboutYou::SDK::Query
|
90
108
|
###
|
91
109
|
def addItemSetsToBasket(sessionId, itemSets)
|
92
110
|
|
@@ -123,15 +141,19 @@ module AboutYou
|
|
123
141
|
end
|
124
142
|
|
125
143
|
###
|
126
|
-
#
|
127
|
-
# @param int $productVariantId ID of product variant.
|
128
|
-
# @param string $basketItemId ID of single item or set in the basket
|
144
|
+
# builds the basket-query
|
129
145
|
#
|
130
|
-
#
|
146
|
+
# * *Args* :
|
147
|
+
# - +sessionId+ -> a String containing the session id of an user
|
148
|
+
# - +productVariantId+ -> ID of product variant
|
149
|
+
# - +basketItemId+ -> ID of single item or set in the basket
|
150
|
+
#
|
151
|
+
# * *Returns* :
|
152
|
+
# - Instance of AboutYou::SDK::Query
|
131
153
|
###
|
132
154
|
def addToBasket(sessionId, productVariantId, basketItemId)
|
133
155
|
|
134
|
-
checkSessionId(sessionId)
|
156
|
+
checkSessionId(sessionId)
|
135
157
|
|
136
158
|
self.query.push({'basket' => {
|
137
159
|
'session_id' => sessionId,
|
@@ -144,10 +166,14 @@ module AboutYou
|
|
144
166
|
end
|
145
167
|
|
146
168
|
###
|
147
|
-
#
|
148
|
-
# @param string[] $itemIds array of basket item ids to delete, this can be sets or single items
|
169
|
+
# builds the basket-query
|
149
170
|
#
|
150
|
-
#
|
171
|
+
# * *Args* :
|
172
|
+
# - +sessionId+ -> a String containing the session id of an user
|
173
|
+
# - +itemIds+ -> array of basket item ids to delete, this can be sets or single items
|
174
|
+
#
|
175
|
+
# * *Returns* :
|
176
|
+
# - Instance of AboutYou::SDK::Query
|
151
177
|
###
|
152
178
|
def removeFromBasket(sessionId, itemIds)
|
153
179
|
|
@@ -169,10 +195,14 @@ module AboutYou
|
|
169
195
|
end
|
170
196
|
|
171
197
|
###
|
172
|
-
#
|
173
|
-
# @param Basket $basket
|
198
|
+
# builds the basket-query
|
174
199
|
#
|
175
|
-
#
|
200
|
+
# * *Args* :
|
201
|
+
# - +sessionId+ -> a String containing the session id of an user
|
202
|
+
# - +basket+ -> an instance of AboutYou::SDK::Model::Basket
|
203
|
+
#
|
204
|
+
# * *Returns* :
|
205
|
+
# - Instance of AboutYou::SDK::Query
|
176
206
|
###
|
177
207
|
def updateBasket(sessionId, basket)
|
178
208
|
|
@@ -190,9 +220,13 @@ module AboutYou
|
|
190
220
|
end
|
191
221
|
|
192
222
|
###
|
193
|
-
#
|
223
|
+
# builds the category-query
|
194
224
|
#
|
195
|
-
#
|
225
|
+
# * *Args* :
|
226
|
+
# - +ids+ -> either a single category ID as integer or an array of IDs
|
227
|
+
#
|
228
|
+
# * *Returns* :
|
229
|
+
# - Instance of AboutYou::SDK::Query
|
196
230
|
###
|
197
231
|
def fetchCategoriesByIds(ids = nil)
|
198
232
|
|
@@ -220,21 +254,26 @@ module AboutYou
|
|
220
254
|
end
|
221
255
|
|
222
256
|
###
|
223
|
-
#
|
257
|
+
# builds the category_tree-query
|
224
258
|
#
|
225
|
-
#
|
259
|
+
# * *Returns* :
|
260
|
+
# - Instance of AboutYou::SDK::Query
|
226
261
|
###
|
227
|
-
def fetchCategoryTree
|
262
|
+
def fetchCategoryTree
|
228
263
|
|
229
264
|
self.query.push({'category_tree' => {"version"=>"2"}})
|
230
265
|
self
|
231
266
|
end
|
232
267
|
|
233
268
|
###
|
234
|
-
#
|
235
|
-
# @param array $fields
|
269
|
+
# builds the products-query
|
236
270
|
#
|
237
|
-
#
|
271
|
+
# * *Args* :
|
272
|
+
# - +ids+ -> Either a single id or an Array of ids which should be fetched
|
273
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
274
|
+
#
|
275
|
+
# * *Returns* :
|
276
|
+
# - Instance of AboutYou::SDK::Query
|
238
277
|
###
|
239
278
|
def fetchProductsByIds(ids,fields = [])
|
240
279
|
# we allow to pass a single ID instead of an array
|
@@ -250,9 +289,13 @@ module AboutYou
|
|
250
289
|
end
|
251
290
|
|
252
291
|
###
|
253
|
-
#
|
292
|
+
# builds the live_variant-query
|
254
293
|
#
|
255
|
-
#
|
294
|
+
# * *Args* :
|
295
|
+
# - +ids+ -> Either a single id or an Array of ids which should be fetched
|
296
|
+
#
|
297
|
+
# * *Returns* :
|
298
|
+
# - Instance of AboutYou::SDK::Query
|
256
299
|
###
|
257
300
|
def fetchLiveVariantByIds(ids)
|
258
301
|
# we allow to pass a single ID instead of an array
|
@@ -265,10 +308,14 @@ module AboutYou
|
|
265
308
|
end
|
266
309
|
|
267
310
|
###
|
268
|
-
#
|
269
|
-
# @param array $fields
|
311
|
+
# builds the products_eans-query
|
270
312
|
#
|
271
|
-
#
|
313
|
+
# * *Args* :
|
314
|
+
# - +eans+ -> Either a single ean or an Array of eans which should be fetched
|
315
|
+
# - +fields+ -> Additional product fields which should be fetched for each product [optional]
|
316
|
+
#
|
317
|
+
# * *Returns* :
|
318
|
+
# - Instance of AboutYou::SDK::Query
|
272
319
|
###
|
273
320
|
def fetchProductsByEans(eans,fields = [])
|
274
321
|
|
@@ -283,9 +330,13 @@ module AboutYou
|
|
283
330
|
end
|
284
331
|
|
285
332
|
###
|
286
|
-
#
|
333
|
+
# builds the get_order-query
|
287
334
|
#
|
288
|
-
#
|
335
|
+
# * *Args* :
|
336
|
+
# - +orderId+ -> id of the order which should be fetched
|
337
|
+
#
|
338
|
+
# * *Returns* :
|
339
|
+
# - Instance of AboutYou::SDK::Query
|
289
340
|
###
|
290
341
|
def fetchOrder(orderId)
|
291
342
|
|
@@ -294,12 +345,16 @@ module AboutYou
|
|
294
345
|
end
|
295
346
|
|
296
347
|
###
|
297
|
-
#
|
298
|
-
# @param string $successUrl
|
299
|
-
# @param string $cancelUrl
|
300
|
-
# @param string $errorUrl
|
348
|
+
# builds the initiate_order-query
|
301
349
|
#
|
302
|
-
#
|
350
|
+
# * *Args* :
|
351
|
+
# - +sessionId+ -> A String containing the sessionId of the User
|
352
|
+
# - +successUrl+ -> callback URL if the order was OK
|
353
|
+
# - +cancelUrl+ -> callback URL if the order was canceled [optional]
|
354
|
+
# - +errorUrl+ -> callback URL if the order had any exceptions [optional]
|
355
|
+
#
|
356
|
+
# * *Returns* :
|
357
|
+
# - Instance of AboutYou::SDK::Query
|
303
358
|
###
|
304
359
|
def initiateOrder(sessionId, successUrl, cancelUrl, errorUrl)
|
305
360
|
|
@@ -320,9 +375,13 @@ module AboutYou
|
|
320
375
|
end
|
321
376
|
|
322
377
|
###
|
323
|
-
#
|
378
|
+
# builds the product_search-query
|
324
379
|
#
|
325
|
-
#
|
380
|
+
# * *Args* :
|
381
|
+
# - +criteria+ -> Hash containing one or multiple search terms
|
382
|
+
#
|
383
|
+
# * *Returns* :
|
384
|
+
# - Instance of AboutYou::SDK::Query
|
326
385
|
###
|
327
386
|
def fetchProductSearch(criteria)
|
328
387
|
|
@@ -333,11 +392,13 @@ module AboutYou
|
|
333
392
|
end
|
334
393
|
|
335
394
|
###
|
336
|
-
#
|
337
|
-
#
|
338
|
-
# @return $this
|
395
|
+
# builds the facets-query
|
339
396
|
#
|
340
|
-
#
|
397
|
+
# * *Args* :
|
398
|
+
# - +groupIds+ -> Array of group ids [optional]
|
399
|
+
#
|
400
|
+
# * *Returns* :
|
401
|
+
# - Instance of AboutYou::SDK::Query
|
341
402
|
###
|
342
403
|
def fetchFacets(groupIds = [])
|
343
404
|
|
@@ -350,11 +411,13 @@ module AboutYou
|
|
350
411
|
end
|
351
412
|
|
352
413
|
###
|
353
|
-
#
|
354
|
-
#
|
355
|
-
# @return $this
|
414
|
+
# builds the facet-query
|
356
415
|
#
|
357
|
-
#
|
416
|
+
# * *Args* :
|
417
|
+
# - +params+ -> Hash containing 2 keys: "id", "group_id"
|
418
|
+
#
|
419
|
+
# * *Returns* :
|
420
|
+
# - Instance of AboutYou::SDK::Query
|
358
421
|
###
|
359
422
|
def fetchFacet(params)
|
360
423
|
|
@@ -367,7 +430,10 @@ module AboutYou
|
|
367
430
|
end
|
368
431
|
|
369
432
|
###
|
370
|
-
#
|
433
|
+
# builds the facet_types-query
|
434
|
+
#
|
435
|
+
# * *Returns* :
|
436
|
+
# - Instance of AboutYou::SDK::Query
|
371
437
|
###
|
372
438
|
def fetchFacetTypes
|
373
439
|
|
@@ -376,9 +442,13 @@ module AboutYou
|
|
376
442
|
end
|
377
443
|
|
378
444
|
###
|
379
|
-
#
|
445
|
+
# builds the suggest-query
|
380
446
|
#
|
381
|
-
#
|
447
|
+
# * *Args* :
|
448
|
+
# - +searchword+ -> the searchs tring to search for
|
449
|
+
#
|
450
|
+
# * *Returns* :
|
451
|
+
# - Instance of AboutYou::SDK::Query
|
382
452
|
###
|
383
453
|
def fetchSuggest(searchword)
|
384
454
|
|
@@ -387,7 +457,10 @@ module AboutYou
|
|
387
457
|
end
|
388
458
|
|
389
459
|
###
|
390
|
-
#
|
460
|
+
# builds the child_apps-query
|
461
|
+
#
|
462
|
+
# * *Returns* :
|
463
|
+
# - Instance of AboutYou::SDK::Query
|
391
464
|
###
|
392
465
|
def fetchChildApps
|
393
466
|
|
@@ -396,7 +469,10 @@ module AboutYou
|
|
396
469
|
end
|
397
470
|
|
398
471
|
###
|
399
|
-
#
|
472
|
+
# turns all queries built in here into a json string
|
473
|
+
#
|
474
|
+
# * *Returns* :
|
475
|
+
# - Json string containing all queries built in here
|
400
476
|
###
|
401
477
|
def queryString
|
402
478
|
|
@@ -404,9 +480,10 @@ module AboutYou
|
|
404
480
|
end
|
405
481
|
|
406
482
|
###
|
407
|
-
#
|
483
|
+
# checks whether the session id is valid or not
|
408
484
|
#
|
409
|
-
#
|
485
|
+
# * *Args* :
|
486
|
+
# - +sessionId+ -> the session id of a user
|
410
487
|
###
|
411
488
|
def checkSessionId(sessionId)
|
412
489
|
|