aboutyou-sdk 0.0.29 → 0.0.30
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/CacheProvider/dalli.rb +3 -0
- data/lib/AboutYou/Criteria/product_fields.rb +3 -0
- data/lib/AboutYou/Criteria/product_search_criteria.rb +8 -8
- data/lib/AboutYou/Factory/default_model_factory.rb +15 -2
- data/lib/AboutYou/Model/Basket/abstract_basket_item.rb +25 -20
- data/lib/AboutYou/Model/Basket/basket_item.rb +27 -27
- data/lib/AboutYou/Model/Basket/basket_set.rb +60 -62
- data/lib/AboutYou/Model/Basket/basket_set_item.rb +8 -9
- data/lib/AboutYou/Model/Basket/basket_variant_item.rb +55 -21
- data/lib/AboutYou/Model/ProductSearchResult/facet_count.rb +0 -2
- data/lib/AboutYou/Model/ProductSearchResult/price_range.rb +2 -2
- data/lib/AboutYou/Model/abstract_model.rb +5 -3
- data/lib/AboutYou/Model/app.rb +0 -2
- data/lib/AboutYou/Model/autocomplete.rb +0 -2
- data/lib/AboutYou/Model/basket.rb +91 -19
- data/lib/AboutYou/Model/brand.rb +8 -4
- data/lib/AboutYou/Model/categories_result.rb +13 -2
- data/lib/AboutYou/Model/category.rb +45 -19
- data/lib/AboutYou/Model/category_tree.rb +21 -7
- data/lib/AboutYou/Model/facet.rb +44 -22
- data/lib/AboutYou/Model/facet_group.rb +55 -21
- data/lib/AboutYou/Model/facet_group_set.rb +106 -23
- data/lib/AboutYou/Model/image.rb +36 -25
- data/lib/AboutYou/Model/image_size.rb +8 -5
- data/lib/AboutYou/Model/initiate_order.rb +26 -7
- data/lib/AboutYou/Model/order.rb +12 -2
- data/lib/AboutYou/Model/product.rb +261 -5
- data/lib/AboutYou/Model/product_search_result.rb +40 -10
- data/lib/AboutYou/Model/{products_ean_result.rb → products_eans_result.rb} +11 -5
- data/lib/AboutYou/Model/products_result.rb +13 -14
- data/lib/AboutYou/Model/result_error.rb +18 -2
- data/lib/AboutYou/Model/variant.rb +87 -26
- data/lib/AboutYou/Model/variants_result.rb +31 -15
- data/lib/AboutYou/client.rb +7 -0
- data/lib/AboutYou/query.rb +7 -2
- data/lib/AboutYou/query_builder.rb +22 -3
- data/lib/aboutyou-sdk.rb +7 -0
- metadata +3 -3
@@ -2,23 +2,24 @@ module AboutYou
|
|
2
2
|
module SDK
|
3
3
|
module Model
|
4
4
|
###
|
5
|
-
#
|
6
5
|
# This class represents a variants result
|
7
|
-
#
|
8
6
|
###
|
9
7
|
class VariantsResult
|
10
|
-
#
|
8
|
+
# Array of AboutYou::SDK::Model::Variant
|
11
9
|
attr_accessor :variants
|
12
|
-
#
|
10
|
+
# Array of Errors
|
13
11
|
attr_accessor :errors
|
14
12
|
|
15
13
|
###
|
14
|
+
# This method is used for creating the variants result
|
16
15
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
16
|
+
# * *Args* :
|
17
|
+
# - +variants+ -> Array of AboutYou::SDK::Model::Variant
|
18
|
+
# - +errors+ -> Array of Errors [optional]
|
19
|
+
# - +product_search_result+ -> AboutYou::SDK::Model::ProductSearchResult [optional]
|
20
20
|
#
|
21
|
-
#
|
21
|
+
# * *Returns* :
|
22
|
+
# - Instance of AboutYou::SDK::Model::VariantsResult
|
22
23
|
###
|
23
24
|
def self.create(variants, errors = [], product_search_result)
|
24
25
|
variants_result = new
|
@@ -49,38 +50,53 @@ module AboutYou
|
|
49
50
|
end
|
50
51
|
|
51
52
|
###
|
52
|
-
#
|
53
|
+
# This method checks if there are variants found
|
54
|
+
#
|
55
|
+
# * *Returns* :
|
56
|
+
# - Boolean determining whether the result has found variants or not
|
53
57
|
###
|
54
58
|
def variants_found?
|
55
59
|
variants.count > 0
|
56
60
|
end
|
57
61
|
|
58
62
|
###
|
59
|
-
#
|
63
|
+
# This method checks if there are variants not found
|
64
|
+
#
|
65
|
+
# * *Returns* :
|
66
|
+
# - Boolean determining whether the result has not found variants or not
|
60
67
|
###
|
61
68
|
def variants_not_found?
|
62
69
|
errors.count > 0
|
63
70
|
end
|
64
71
|
|
65
72
|
###
|
66
|
-
#
|
73
|
+
# Getter for the found variants
|
74
|
+
#
|
75
|
+
# * *Returns* :
|
76
|
+
# - Array of AboutYou::SDK::Model::Variant
|
67
77
|
###
|
68
78
|
def variants_found
|
69
79
|
variants
|
70
80
|
end
|
71
81
|
|
72
82
|
###
|
73
|
-
#
|
83
|
+
# This method searches for a variant by a certain variant_id
|
74
84
|
#
|
75
|
-
#
|
76
|
-
#
|
85
|
+
# * *Args* :
|
86
|
+
# - +id+ -> id used for searching
|
87
|
+
|
88
|
+
# * *Returns* :
|
89
|
+
# - nil / instance of AboutYou::SDK::Model::Variant
|
77
90
|
###
|
78
91
|
def variant_by_id(id)
|
79
92
|
variants[id] ? variants[id] : nil
|
80
93
|
end
|
81
94
|
|
82
95
|
###
|
83
|
-
#
|
96
|
+
# geter for the not found variants
|
97
|
+
#
|
98
|
+
# * *Returns* :
|
99
|
+
# - Array of AboutYou::SDK::Model::Variant
|
84
100
|
###
|
85
101
|
def variants_not_found
|
86
102
|
errors
|
data/lib/AboutYou/client.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
module AboutYou
|
2
|
+
###
|
3
|
+
# The SDK namespace
|
4
|
+
###
|
2
5
|
module SDK
|
3
6
|
###
|
4
7
|
# This Class manages the API-Calls
|
@@ -83,6 +86,10 @@ module AboutYou
|
|
83
86
|
# * *Args* :
|
84
87
|
# - +body+ -> the body of the api-call, containing all request data
|
85
88
|
#
|
89
|
+
# * *Fails* :
|
90
|
+
# - if the http response code is not between 200 and 300 or 304
|
91
|
+
# - if the body of the http response is not an array
|
92
|
+
#
|
86
93
|
# * *Returns* :
|
87
94
|
# - Json-String containing the response-body
|
88
95
|
###
|
data/lib/AboutYou/query.rb
CHANGED
@@ -19,8 +19,7 @@ module AboutYou
|
|
19
19
|
attr_accessor :client
|
20
20
|
# the query built by the app itself
|
21
21
|
attr_accessor :query
|
22
|
-
# a Hash containing the mapping for
|
23
|
-
# api_call_name => method_name_in_model_factory
|
22
|
+
# a Hash containing the mapping for api_call_name => method_name_in_model_factory
|
24
23
|
attr_accessor :mapping
|
25
24
|
# the model factory which builds the models from the api-response
|
26
25
|
attr_accessor :factory
|
@@ -261,6 +260,12 @@ module AboutYou
|
|
261
260
|
#
|
262
261
|
# * *Args* :
|
263
262
|
# - +jsonResponse+ -> the plain json received from the api
|
263
|
+
#
|
264
|
+
# * *Fails* :
|
265
|
+
# - if the response is false, not an array or has a different amount of subresponses then requests
|
266
|
+
# - if there is any subresponse which was not requested
|
267
|
+
# - if there is no model factory mapping for a subresponse
|
268
|
+
#
|
264
269
|
###
|
265
270
|
def check_response(json_response)
|
266
271
|
fail 'UnexpectedResultException!' if
|
@@ -15,6 +15,10 @@ module AboutYou
|
|
15
15
|
# - +limit+ -> Maximum number of results [optional]
|
16
16
|
# - +types+ -> Array of types to search for [optional]
|
17
17
|
#
|
18
|
+
# * *Fails* :
|
19
|
+
# - if the searchword is not a String
|
20
|
+
# - if the limit cant be transformed into an integer
|
21
|
+
#
|
18
22
|
# * *Returns* :
|
19
23
|
# - Instance of AboutYou::SDK::Query
|
20
24
|
###
|
@@ -236,6 +240,9 @@ module AboutYou
|
|
236
240
|
# * *Args* :
|
237
241
|
# - +ids+ -> either a single category ID as integer or an array of IDs
|
238
242
|
#
|
243
|
+
# * *Fails* :
|
244
|
+
# - if a category id is smaller then 1
|
245
|
+
#
|
239
246
|
# * *Returns* :
|
240
247
|
# - Instance of AboutYou::SDK::Query
|
241
248
|
###
|
@@ -445,6 +452,9 @@ module AboutYou
|
|
445
452
|
# * *Args* :
|
446
453
|
# - +params+ -> Hash containing 2 keys: "id", "group_id"
|
447
454
|
#
|
455
|
+
# * *Fails* :
|
456
|
+
# - if params is not set
|
457
|
+
#
|
448
458
|
# * *Returns* :
|
449
459
|
# - Instance of AboutYou::SDK::Query
|
450
460
|
###
|
@@ -498,6 +508,9 @@ module AboutYou
|
|
498
508
|
# - +searchword+ -> the search string to search for
|
499
509
|
# - +category_ids+ -> the cat ids to filter for
|
500
510
|
#
|
511
|
+
# * *Fails* :
|
512
|
+
# - if the searchword is not a String
|
513
|
+
#
|
501
514
|
# * *Returns* :
|
502
515
|
# - Instance of AboutYou::SDK::Query
|
503
516
|
###
|
@@ -548,10 +561,16 @@ module AboutYou
|
|
548
561
|
#
|
549
562
|
# * *Args* :
|
550
563
|
# - +session_id+ -> the session id of a user
|
564
|
+
#
|
565
|
+
# * *Fails* :
|
566
|
+
# - if the session id is not a String
|
567
|
+
# - if the session id has less then 4 characters
|
551
568
|
###
|
552
|
-
def check_session_id(
|
553
|
-
fail 'InvalidArgumentException! The session id must be a string' unless
|
554
|
-
|
569
|
+
def check_session_id(session_id)
|
570
|
+
fail 'InvalidArgumentException! The session id must be a string' unless
|
571
|
+
session_id.is_a? String
|
572
|
+
fail 'InvalidArgumentException! The session id must have at least
|
573
|
+
5 characters' unless session_id.length > 4
|
555
574
|
end
|
556
575
|
end
|
557
576
|
end
|
data/lib/aboutyou-sdk.rb
CHANGED
@@ -111,6 +111,9 @@ class AY
|
|
111
111
|
# - +variant_id+ -> Id of the Variant which should be added to the basket
|
112
112
|
# - +amount+ -> The Amount of the Item which should be added to the basket
|
113
113
|
#
|
114
|
+
# * *Fails* :
|
115
|
+
# - if the variant id cant be transformed into an Integer
|
116
|
+
#
|
114
117
|
# * *Returns* :
|
115
118
|
# - Instance of AboutYou::SDK::Model::Basket
|
116
119
|
###
|
@@ -232,6 +235,10 @@ class AY
|
|
232
235
|
# - +searchword+ -> The prefix search word to search for
|
233
236
|
# - +category_ids+ -> The category ids used as a filter [optional]
|
234
237
|
#
|
238
|
+
# * *Fails* :
|
239
|
+
# - if a category id cant be transformed into an Integer
|
240
|
+
# - if a category id is smaller then 1
|
241
|
+
#
|
235
242
|
# * *Returns* :
|
236
243
|
# - Array of Strings
|
237
244
|
###
|
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.30
|
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-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -92,7 +92,7 @@ files:
|
|
92
92
|
- lib/AboutYou/Model/order.rb
|
93
93
|
- lib/AboutYou/Model/product.rb
|
94
94
|
- lib/AboutYou/Model/product_search_result.rb
|
95
|
-
- lib/AboutYou/Model/
|
95
|
+
- lib/AboutYou/Model/products_eans_result.rb
|
96
96
|
- lib/AboutYou/Model/products_result.rb
|
97
97
|
- lib/AboutYou/Model/result_error.rb
|
98
98
|
- lib/AboutYou/Model/variant.rb
|