unidom-price 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: 8fb85ac9f5915f7063d59ed01969c4de801366c9
4
- data.tar.gz: e2bea2f3621748c29c1a4f344d9ec27525652650
3
+ metadata.gz: ad1b3bfa256196866e0c121411789815360c50d5
4
+ data.tar.gz: 1a614f382c7c1a40d44afdf341b08ce26ea92313
5
5
  SHA512:
6
- metadata.gz: e918924291ce40decf86d96d6a4e4058df01b8218c84c1417acb361fb049bd90345319bc3669a4984d6bb34ad146cb5b77924a490b4001083f737495191fb645
7
- data.tar.gz: 2f5ff3214277f6a9da7a089d1e29297241889c700d085fb20cb8de50a544381fa1f99e792d57c3501036fd8c77abf648f9a04cda9489a6af06d61d607bd3ae27
6
+ metadata.gz: b46a6f6baa45b54de4ce80af9035cd85b16ab5f689c388bf6bf658c84021d92c693c4bb8832578ce9c6d4726b4a81ba906c9ce02c045f7ead620925a13cbb6f5
7
+ data.tar.gz: e252e804530a7b49ce1a1c5c6d0fd8176388134aacc40883bb4dc0703a56a3c23fcfdcd3abdca08cbeac11b8acaacc4e07e8a3d7c75092e7a9b7d999cb640512
data/README.md CHANGED
@@ -53,3 +53,19 @@ prices = Unidom::Price::Price.priced_is(product).priced_by(pricer).charging_code
53
53
  # Price a product
54
54
  Unidom::Price::Price.price! product, amount: 100
55
55
  ```
56
+
57
+
58
+
59
+ ## Include the Concerns
60
+ ```ruby
61
+ include Unidom::Price::Concerns::AsPriced
62
+ include Unidom::Price::Concerns::AsPricer
63
+ ```
64
+
65
+ ### As Priced
66
+ The As Priced concern do the following tasks for the includer automatically:
67
+ 1. Define the has_many :prices macro as: ``has_many :prices, class_name: 'Unidom::Price::Price', as: :priced``
68
+
69
+ ### As Pricer
70
+ The As Priced concern do the following tasks for the includer automatically:
71
+ 1. Define the has_many :pricings macro as: ``has_many :pricings, class_name: 'Unidom::Price::Price', as: :pricer``
@@ -0,0 +1,14 @@
1
+ module Unidom::Price::Concerns::AsPriced
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :prices, class_name: 'Unidom::Price::Price', as: :priced
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ module Unidom::Price::Concerns::AsPricer
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :pricings, class_name: 'Unidom::Price::Price', as: :pricer
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Price
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-price
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
@@ -39,6 +39,8 @@ files:
39
39
  - app/assets/stylesheets/unidom/price/application.css
40
40
  - app/controllers/unidom/price/application_controller.rb
41
41
  - app/helpers/unidom/price/application_helper.rb
42
+ - app/models/unidom/price/concerns/as_priced.rb
43
+ - app/models/unidom/price/concerns/as_pricer.rb
42
44
  - app/models/unidom/price/price.rb
43
45
  - app/views/layouts/unidom/price/application.html.erb
44
46
  - config/routes.rb