solidus_recommendations 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +14 -0
- data/Rakefile +1 -0
- data/app/models/concerns/spree/callbackable.rb +12 -6
- data/app/models/concerns/spree/indexable.rb +1 -0
- data/app/models/concerns/spree/order/indexable.rb +1 -0
- data/app/models/concerns/spree/product/recommendable.rb +1 -0
- data/app/models/concerns/spree/user/indexable.rb +2 -1
- data/app/models/spree/order_decorator.rb +1 -0
- data/app/models/spree/product_decorator.rb +2 -0
- data/app/models/spree/user_decorator.rb +1 -0
- data/config/routes.rb +1 -0
- data/lib/generators/solidus_recommendations/install/install_generator.rb +1 -0
- data/lib/solidus_recommendations.rb +1 -0
- data/lib/solidus_recommendations/client.rb +1 -0
- data/lib/solidus_recommendations/engine.rb +1 -0
- data/lib/solidus_recommendations/errors.rb +2 -2
- data/lib/solidus_recommendations/factories.rb +1 -0
- data/lib/solidus_recommendations/recommendable/base.rb +1 -0
- data/lib/solidus_recommendations/recommendable/products.rb +1 -0
- data/lib/solidus_recommendations/version.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c7e6fc04399fed54b0c578787e86812d7a56990
|
4
|
+
data.tar.gz: c0c3b4345c707c157e00ce3a8560eb5d1b765665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62fe61ff65a30ecd312c9bd88d4c649cb2ab2ba13ede47d92c4dd2c86849fe49f21990ac7fae60c1cebe9b5c978e100c8f87ded97360ac15eec5e8a0bef043d3
|
7
|
+
data.tar.gz: 76761823a69f3ac0a4415c2237314dca5e06674a7cb3307ccaea6fe40b3a677926c800ef369f632dab866363bfa123b5b060353d2d9c608d7438c330ac0fb868
|
data/README.md
CHANGED
@@ -3,6 +3,11 @@ SolidusRecommendations
|
|
3
3
|
|
4
4
|
Uses Elasticsearch on top of Solidus framework to retrieve relevant recommendations based on what users have purchased in the past.
|
5
5
|
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
* Elasticsearch must be installed and running. https://www.elastic.co/downloads/elasticsearch
|
10
|
+
|
6
11
|
Installation
|
7
12
|
------------
|
8
13
|
|
@@ -19,6 +24,15 @@ bundle
|
|
19
24
|
bundle exec rails g solidus_recommendations:install
|
20
25
|
```
|
21
26
|
|
27
|
+
From the console:
|
28
|
+
```ruby
|
29
|
+
Spree.user_class.__elasticsearch__.create_index!
|
30
|
+
Spree::Order.__elasticsearch__.create_index!
|
31
|
+
|
32
|
+
Spree.user_class.import
|
33
|
+
Spree::Order.import
|
34
|
+
```
|
35
|
+
|
22
36
|
Usage
|
23
37
|
-----
|
24
38
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Spree
|
2
3
|
module Callbackable
|
3
4
|
extend ActiveSupport::Concern
|
@@ -9,20 +10,25 @@ module Spree
|
|
9
10
|
after_commit :update_document, on: :update
|
10
11
|
after_commit :delete_document, on: :destroy
|
11
12
|
|
12
|
-
delegate :delete_document, to: :__elasticsearch__
|
13
|
-
|
14
13
|
##
|
15
14
|
# Index document into elasticsearch
|
16
15
|
#
|
17
|
-
|
18
|
-
__elasticsearch__.index_document(version_options)
|
19
|
-
end
|
16
|
+
delegate :index_document, to: :__elasticsearch__
|
20
17
|
|
21
18
|
##
|
22
19
|
# Updates elasticsearch document from featured model
|
23
20
|
#
|
24
21
|
def update_document
|
25
|
-
__elasticsearch__.update_document
|
22
|
+
__elasticsearch__.update_document
|
23
|
+
rescue Elasticsearch::Transport::Transport::Errors::NotFound
|
24
|
+
Rails.logger.warn "[#{self.class}] Document with id #{id} not found on elasticsearch cluster"
|
25
|
+
__elasticsearch__.index_document
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete_document
|
29
|
+
__elasticsearch__.delete_document
|
30
|
+
rescue Elasticsearch::Transport::Transport::Errors::NotFound
|
31
|
+
Rails.logger.warn "[#{self.class}] Document with id #{id} not found on elasticsearch cluster"
|
26
32
|
end
|
27
33
|
|
28
34
|
private
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_recommendations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Scott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- app/models/concerns/spree/product/recommendable.rb
|
254
254
|
- app/models/concerns/spree/user/indexable.rb
|
255
255
|
- app/models/spree/order_decorator.rb
|
256
|
+
- app/models/spree/product_decorator.rb
|
256
257
|
- app/models/spree/user_decorator.rb
|
257
258
|
- config/locales/en.yml
|
258
259
|
- config/routes.rb
|