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 +4 -4
- data/README.md +15 -2
- data/app/models/unidom/shipment/concerns/as_shipped.rb +15 -0
- data/lib/unidom/shipment/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47402bf9c8f7a99d62b95a5121c2940168de0a92
|
4
|
+
data.tar.gz: 80ec887738bfa806ab25d11d8d461b35a4b9ece5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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.
|
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-
|
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
|