unidom-shopping 1.0.1 → 1.1

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: a923706df663d431fc8b1b0753b0b4dc12369009
4
- data.tar.gz: 01dfad6116844e6c6ea2d92d24ac91c4057590c2
3
+ metadata.gz: 5249024e787de46a268dfc2f6f3870343e166c89
4
+ data.tar.gz: b8cece8d174069da706b18f7f4edb2c585ee95d0
5
5
  SHA512:
6
- metadata.gz: bdb63cc51429a58451ca3c9a57caf8566ec52b611e24d33400b43d3827f43885a856f7dadba5e73fee9e81e39be984f18701e2d1d7fe2633e25bb346d14c8e2a
7
- data.tar.gz: c7f8e7fc7dc97575ce77a814ec5af535b59eb253907f452dede54949851d90c6a6c98d1a0ed185f5129e60284fa5c5ecc95d21028fa875d90e774d188ae4ebc5
6
+ metadata.gz: 9a4e13e2eba9853519f949e1ed27a205be55e4e2074c90cb3dd49638f2b8da92e1bdf35263fd99af0323cdcc09e96957f3314762b5b5e438c5eedd0d725d22a7
7
+ data.tar.gz: f3e73689c8c4ccbb3800041f240b8130e97289ebda0b02e17c6b37e2106426534de6c465392835642dc40c69410d0cda3d872595775ce09e1f52d4bd8935f927
data/README.md CHANGED
@@ -41,3 +41,19 @@ shopping_cart.add! ball, unit_price: 19.99
41
41
  shopping_cart = Unidom::Shopping::ShoppingCart.shopped_by(lady).shop_is(shop).valid_at.alive.first
42
42
  shopping_cart.items.valid_at.alive # fish & ball
43
43
  ```
44
+
45
+
46
+
47
+ ## Include the Concerns
48
+ ```ruby
49
+ include Unidom::Shopping::Concerns::AsCartShopper
50
+ include Unidom::Shopping::Concerns::AsItemShopper
51
+ ```
52
+
53
+ ### As Cart Shopper
54
+ The As Cart Shopper concern do the following tasks for the includer automatically:
55
+ 1. Define the has_many :shopping_carts macro as: ``has_many :shopping_carts, class_name: 'Unidom::Shopping::ShoppingCart', as: :shopper``
56
+
57
+ ### As Item Shopper
58
+ The As Item Shopper concern do the following tasks for the includer automatically:
59
+ 1. Define the has_many :shopping_items macro as: ``has_many :shopping_items, class_name: 'Unidom::Shopping::ShoppingItem', as: :shopper``
@@ -0,0 +1,14 @@
1
+ module Unidom::Shopping::Concerns::AsCartShopper
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :shopping_carts, class_name: 'Unidom::Shopping::ShoppingCart', as: :shopper
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ module Unidom::Shopping::Concerns::AsItemShopper
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :shopping_items, class_name: 'Unidom::Shopping::ShoppingItem', as: :shopper
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ module Unidom::Shopping::Concerns::AsShopped
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :shopping_items, class_name: 'Unidom::Shopping::ShoppingItem', as: :shopped
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Shopping
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1'.freeze
4
4
  end
5
5
  end
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.0.1
4
+ version: '1.1'
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-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -40,6 +40,9 @@ files:
40
40
  - app/assets/stylesheets/unidom/shopping/application.css
41
41
  - app/controllers/unidom/shopping/application_controller.rb
42
42
  - app/helpers/unidom/shopping/application_helper.rb
43
+ - app/models/unidom/shopping/concerns/as_cart_shopper.rb
44
+ - app/models/unidom/shopping/concerns/as_item_shopper.rb
45
+ - app/models/unidom/shopping/concerns/as_shopped.rb
43
46
  - app/models/unidom/shopping/shopping_cart.rb
44
47
  - app/models/unidom/shopping/shopping_item.rb
45
48
  - app/views/layouts/unidom/shopping/application.html.erb