product_home_template 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af3c2c1a11eaa98df112c7aa405fd40b1eb9b1e2
4
- data.tar.gz: 146777d8fda4d09ed522158d1c1c3e105bea7f80
3
+ metadata.gz: c220ad58eb00f85a3789cc48cb0927b8eaed7852
4
+ data.tar.gz: 7c0a26c36841786157d07b8b27c7601c70677e19
5
5
  SHA512:
6
- metadata.gz: 4d93585d76f853f05d1586f019dc171d5fc1e715d3b7e86963d89fa52f311f04b4e623cb6b872bcdeae0aae19de487bb6696214e2b6b15d54ea8e4650fd7e090
7
- data.tar.gz: 54ae8ccf8f115955c6bacc6fea0e22fd5f2b8feeace9d20dc160542960fc0089b661114c5dd22132848b5e74e35664568ae6124bb04e69731c08da025ff15ba1
6
+ metadata.gz: 79f78ddf6a7f48061d53b8308117050058cc6b77aab32e948dc58967bde9ab7d0bef7d27876919d99bd447230e227dc70c41282665c1ab82e288615a847e790c
7
+ data.tar.gz: 41cf7fb40e51a17bd335dc5d34b59185dc5ce555840febe7a4965296384f7c9079bd701a4cfd2aa08ae7f26cd535e5b203c83ca72ea9b8f51a55682571c18fb1
@@ -1,3 +1,3 @@
1
1
  module ProductHomeTemplate
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,32 +1,41 @@
1
1
  require "product_home_template/version"
2
+ #This class provides the template method of providing the output to show products by ranking, click history and general method.
2
3
  class BasicWay
4
+ #this method initializes the hash array with a specific store details.
3
5
  def initialize(param)
4
6
  @store_detail = StoreDetail.find(param)
5
7
  end
6
8
 
9
+ #this method provides the products array with pagination type
7
10
  def with_page(pages)
8
11
  my_special_method(pages)
9
12
  end
10
13
 
14
+ #this method provides the products array without pagination type
11
15
  def without_page(member)
12
16
  my_special_method_without(member)
13
17
  end
14
18
 
19
+ #this method to run the logic of sorting the products with pagination
15
20
  def my_special_method(pages)
16
21
  puts("triggered in abstract")
17
22
  end
18
23
 
24
+ #this method to run the logic of sorting the products with pagination
19
25
  def my_special_method_without(member)
20
26
  puts("triggered in abstract")
21
27
  end
22
28
 
23
29
  end
24
30
 
31
+ #this class provides the functionality to inherit the base class to provide the products by ranking highest selling product.
25
32
  class CheckByHit < BasicWay
33
+ #this method initializes base class object with the store detail
26
34
  def initialize(param)
27
35
  super(param)
28
36
  end
29
37
 
38
+ #this method to run the logic of sorting the products with pagination by ranking the hit
30
39
  def my_special_method(pages)
31
40
  @product_by_hits = @store_detail.products.order('hit asc').paginate(page: pages, per_page: 3).take(3)
32
41
  puts("===== by hit =====")
@@ -34,6 +43,7 @@ class CheckByHit < BasicWay
34
43
  return @product_by_hits
35
44
  end
36
45
 
46
+ #this method to run the logic of sorting the products without pagination by ranking the hit
37
47
  def my_special_method_without(member)
38
48
  @product_by_hits = @store_detail.products.order('hit asc').take(3)
39
49
  return @product_by_hits
@@ -41,11 +51,13 @@ class CheckByHit < BasicWay
41
51
  end
42
52
 
43
53
  class CheckByRank < BasicWay
54
+ #this method initializes base class object with the store detail and an empty array to store the products by click history
44
55
  def initialize(param)
45
56
  super(param)
46
57
  @record_products = []
47
58
  end
48
59
 
60
+ #this method to run the logic of sorting the products with pagination by ranking the click history
49
61
  def my_special_method(pages)
50
62
  @sorted_click = current_member.clicks.order('id desc').select("product_identity").group_by{|o| o.product_identity}.keys.uniq.take(3)
51
63
  @sorted_click.each do |c|
@@ -54,6 +66,7 @@ class CheckByRank < BasicWay
54
66
  @record_products
55
67
  end
56
68
 
69
+ #this method to run the logic of sorting the products without pagination by ranking the click history
57
70
  def my_special_method_without(member)
58
71
  @sorted_click = member.clicks.order('id desc').select("product_identity").group_by{|o| o.product_identity}.keys.uniq.take(3)
59
72
  @sorted_click.each do |c|
@@ -66,17 +79,22 @@ class CheckByRank < BasicWay
66
79
 
67
80
  end
68
81
 
82
+ #this class provides the funcationality of listing all the products available for that particular store
69
83
  class CheckByNormal < BasicWay
84
+
85
+ #this method initializes base class object with the store detail
70
86
  def initialize(param)
71
87
  super(param)
72
88
  end
73
89
 
90
+ #this method to run the logic of listing the products with pagination
74
91
  def my_special_method(pages)
75
92
  @products = @store_detail.products.paginate(page: pages, per_page: 3)
76
93
  puts("=== by baisc page ===")
77
94
  return @products
78
95
  end
79
96
 
97
+ #this method to run the logic of listing the products without pagination
80
98
  def my_special_method_without(member)
81
99
  @products = @store_detail.products
82
100
  return @products
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: product_home_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishore Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-17 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler