unidom-shopping 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d8aed7e7fccb99fb0e019369481aaa9ef9cb34
|
4
|
+
data.tar.gz: ccc5c72a893f298aa7008a10ac66c7f6575d2485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1960b8024baff5c6f00a652f80a6316661b558ac6a2084e291692d0d68b8afa78f1e4f11bf30be96afb6f17f842491c4251257a9e9d0077825290b9b0a7de6ee
|
7
|
+
data.tar.gz: ba2f84b76ce58aedd09ab3fd96bbed334343d7ed0f4a69e16405411a7b05441311852ed5699df8328624385d27e47f0f59afd87fe92dda8de8815fe46a31c392
|
data/README.md
CHANGED
@@ -54,8 +54,10 @@ include Unidom::Shopping::Concerns::AsItemShopper
|
|
54
54
|
The As Cart Shopper concern do the following tasks for the includer automatically:
|
55
55
|
1. Define the has_many :shopping_carts macro as: ``has_many :shopping_carts, class_name: 'Unidom::Shopping::ShoppingCart', as: :shopper``
|
56
56
|
2. Define the #get_cart! method as: ``get_cart!(from: nil, at: Time.now)``
|
57
|
+
3. Define the #get_cart? method as: ``get_cart?(from: nil, at: Time.now)``
|
57
58
|
|
58
59
|
### As Item Shopper
|
59
60
|
The As Item Shopper concern do the following tasks for the includer automatically:
|
60
61
|
1. Define the has_many :shopping_items macro as: ``has_many :shopping_items, class_name: 'Unidom::Shopping::ShoppingItem', as: :shopper``
|
61
62
|
2. Define the #add! method as: ``add!(it, into: nil, at: Time.now, unit_price: 0, quantity: 1)``
|
63
|
+
3. Define the #add? method as: ``add?(it, into: nil, at: Time.now)``
|
@@ -10,9 +10,9 @@ module Unidom::Shopping::Concerns::AsCartShopper
|
|
10
10
|
shopping_carts.shop_is(from).valid_at(now: at).alive.first_or_create! opened_at: at
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
def get_cart?(from: nil, at: Time.now)
|
14
|
+
shopping_carts.shop_is(from).valid_at(now: at).alive.exists?
|
15
|
+
end
|
16
16
|
|
17
17
|
end
|
18
18
|
|
@@ -18,9 +18,9 @@ module Unidom::Shopping::Concerns::AsItemShopper
|
|
18
18
|
item
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def add?(it, into: nil, at: Time.now)
|
22
|
+
shopping_items.shopping_cart_is(into).shopped_is(it).valid_at(now: at).alive.exists?
|
23
|
+
end
|
24
24
|
|
25
25
|
end
|
26
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-shopping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|