rees46 0.0.2.0 → 0.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/rees46/recommender.rb +6 -0
- data/lib/rees46/tracker.rb +10 -2
- data/lib/rees46/version.rb +1 -1
- data/spec/rees46/recommender_spec.rb +1 -1
- data/spec/workflow_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69dbc2d842faff24a71f0b33457e85c199d5cdfe
|
4
|
+
data.tar.gz: cea9255bf35bd15320f315e0b7a5e0ea92e68493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f80949cab11b18d4ca7861ce05b48cce3e6b8e76e48d4fb8469cfadc955ebbe5622c4cb5fa4133a58328cc0a4f680d944f95168fd7de585465011d568f80411
|
7
|
+
data.tar.gz: f327f3727e5034704e933907fe458c6d11cbe9556d08e436fcfdd6a942dfde9eb39bff6c4a1026ddb2299524b2db9bd0f3eb6da86fb2950b6319a4b6ac884826
|
data/README.md
CHANGED
@@ -34,6 +34,8 @@ end
|
|
34
34
|
|
35
35
|
Все действия необходимо производить только после инициализации модуля.
|
36
36
|
|
37
|
+
[Список параметров](http://memo.mkechinov.ru/pages/viewpage.action?pageId=786532#id-ИспользованиеJSSDK-4.1.СтруктураPARAMS(информацияособытии)), которые можно передавать с товаром. Чем больше будет передано параметров - тем выше будет качество рекомендаций.
|
38
|
+
|
37
39
|
### Просмотр:
|
38
40
|
```ruby
|
39
41
|
REES46::Tracker.view(item: { item_id: 5, price: 1499.99, is_available: true })
|
data/lib/rees46/recommender.rb
CHANGED
@@ -25,6 +25,12 @@ module REES46
|
|
25
25
|
result = params.dup
|
26
26
|
result = result.merge(recommender_type: recommender_type)
|
27
27
|
|
28
|
+
[:locations, :categories].each do |key|
|
29
|
+
if result[key].present? && result[key].any?
|
30
|
+
result[key] = result[key].join(',')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
if params[:cart].present?
|
29
35
|
params[:cart].each_with_index do |cart_id, i|
|
30
36
|
result["cart[#{i}]"] = cart_id
|
data/lib/rees46/tracker.rb
CHANGED
@@ -27,7 +27,11 @@ module REES46
|
|
27
27
|
|
28
28
|
if result[:item].present?
|
29
29
|
result[:item].each do |key, value|
|
30
|
-
|
30
|
+
if value.is_a?(Array)
|
31
|
+
result["#{key}[0]"] = value.join(',')
|
32
|
+
else
|
33
|
+
result["#{key}[0]"] = value
|
34
|
+
end
|
31
35
|
end
|
32
36
|
result.delete(:item)
|
33
37
|
end
|
@@ -35,7 +39,11 @@ module REES46
|
|
35
39
|
if result[:items].present?
|
36
40
|
result[:items].each_with_index do |item, i|
|
37
41
|
item.each do |key, value|
|
38
|
-
|
42
|
+
if value.is_a?(Array)
|
43
|
+
result["#{key}[#{i}]"] = value.join(',')
|
44
|
+
else
|
45
|
+
result["#{key}[#{i}]"] = value
|
46
|
+
end
|
39
47
|
end
|
40
48
|
end
|
41
49
|
result.delete(:items)
|
data/lib/rees46/version.rb
CHANGED
@@ -22,7 +22,7 @@ describe REES46::Recommender do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'sends request' do
|
25
|
-
REES46::Recommender.interesting(item_id: 25, limit: 10, category: 25, locations:
|
25
|
+
REES46::Recommender.interesting(item_id: 25, limit: 10, category: 25, locations: [5,123,91], cart: [25, 1, 4])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/spec/workflow_spec.rb
CHANGED
@@ -70,7 +70,7 @@ describe 'Примеры использования' do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
let(:item1) { { item_id: 5, price: 10_999.99, is_available: true, category: 15 } }
|
73
|
-
let(:item2) { { item_id: 39, price: 458.10, is_available: true,
|
73
|
+
let(:item2) { { item_id: 39, price: 458.10, is_available: true, categories: [4, 25] } }
|
74
74
|
|
75
75
|
it 'Просмотр товара' do
|
76
76
|
expect(REES46::Tracker.view(item: item1)).to eq({'status' => 'success'})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rees46
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Zhavoronkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|