unidom-shipment 0.2 → 0.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: db3f11fd844936751b8ec3bf6ae4d46ccebbe400
4
- data.tar.gz: dcda5f4ca3a5aa23138a5e7f5d04288246466399
3
+ metadata.gz: 47402bf9c8f7a99d62b95a5121c2940168de0a92
4
+ data.tar.gz: 80ec887738bfa806ab25d11d8d461b35a4b9ece5
5
5
  SHA512:
6
- metadata.gz: 996c0d30c181ea7c578dddd67c1931d63b6304d4899cbf8d136ccb7df14808e3f659f6f919c54932d77a6bfd7ef410a8f7b243c0c3815a7f4c19436d2fa04113
7
- data.tar.gz: 7df87e7d26546a25c87acdc1e72aafd6f068780ccb5b5b60a2e7376de6a0eb9dff1b58c8ed722dc3fbdabc3438031af5d6733d1594c93bb98e5e4ab4697d8da3
6
+ metadata.gz: da1a73e6824e4e623d43bdabb2dfdd68d89c22f5a06ce9ce046fd54ac7fedd62eab1e3d0e17ac3e577f4a083bf46874c260a67b60eeed45d58f654348d1eeb41
7
+ data.tar.gz: 5e1c59a66be1f4f7cb1085ca4757f7f819177accfe21a8636bc6af814dc96f5ee74e3e59740c8ed2d2c85bf19100f56924c640be0abc985da036cf16913796b6
data/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/unidom-shipment.svg)](https://badge.fury.io/rb/unidom-shipment)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-shipment.svg)](https://gemnasium.com/github.com/topbitdu/unidom-shipment)
5
6
 
6
- Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Shipment domain model engine includes the Shipment and the Shipment Item.
7
- Unidom (统一领域对象模型)是一系列的领域模型引擎。装运领域模型引擎包括装运和装运项的模型。
7
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Shipment domain model engine includes the Shipment, Shipment Item, Shipment Package, Shipment Package Item, and Shipment Receipt model.
8
+ Unidom (统一领域对象模型)是一系列的领域模型引擎。装运领域模型引擎包括装运、装运项、装运包裹、装运包裹项、装运收据的模型。
8
9
 
9
10
 
10
11
 
@@ -44,3 +45,15 @@ shipment_package = Unidom::Shipment::ShipmentPackage.valid_at.alive.first
44
45
  shipment_package_item = shipment_package.items.create! shipment_item: shipment_item, quantity: 10
45
46
  shipment_receipt = shipment_package.receipts.create! shipped: shipment_item.shipped, store_item: inventory_item
46
47
  ```
48
+
49
+
50
+
51
+ ## Include the Concerns
52
+ ```ruby
53
+ include Unidom::Shipment::Concerns::AsShipped
54
+ ```
55
+
56
+ ### As Shipped
57
+ The As Shipped concern do the following tasks for the includer automatically:
58
+ 1. Define the has_many :shipment_items macro as: ``has_many :shipment_items, class_name: 'Unidom::Shipment::ShipmentItem', foreign_key: :shipped_id``
59
+ 2. Define the has_many :shipment_receipts macro as: ``has_many :shipment_receipts, class_name: 'Unidom::Shipment::ShipmentReceipt', foreign_key: :shipped_id``
@@ -0,0 +1,15 @@
1
+ module Unidom::Shipment::Concerns::AsShipped
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :shipment_items, class_name: 'Unidom::Shipment::ShipmentItem', foreign_key: :shipped_id
8
+ has_many :shipment_receipts, class_name: 'Unidom::Shipment::ShipmentReceipt', foreign_key: :shipped_id
9
+
10
+ end
11
+
12
+ module ClassMethods
13
+ end
14
+
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Shipment
3
- VERSION = '0.2'.freeze
3
+ VERSION = '0.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-shipment
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.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-29 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -44,6 +44,7 @@ files:
44
44
  - app/jobs/unidom/shipment/application_job.rb
45
45
  - app/mailers/unidom/shipment/application_mailer.rb
46
46
  - app/models/unidom/shipment/application_record.rb
47
+ - app/models/unidom/shipment/concerns/as_shipped.rb
47
48
  - app/models/unidom/shipment/shipment.rb
48
49
  - app/models/unidom/shipment/shipment_item.rb
49
50
  - app/models/unidom/shipment/shipment_package.rb