unidom-party 0.6 → 0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfbbfddcce3cf5f2ac61009b0044986d8be8305e
4
- data.tar.gz: b84b5f3b54e6cc33f605a8393e3d65f32e7f48ab
3
+ metadata.gz: 369b0d1c532781d5663efea019098633e6a590f5
4
+ data.tar.gz: 015b40cba67c84a9668bd5c600594f119e6a9971
5
5
  SHA512:
6
- metadata.gz: 741275bc47493859668d28ec11b687256ab77023ddf36287f5d25425009d5f03cdbb7d05fabc29baab0c66fc0e0ca623a8ed81b9c09bb10b28664a34c78e1430
7
- data.tar.gz: 31469de07a8d38269969b19b5062a94eb364aa5e807e4aca675b6d8f24ea4a40504ae5e56f3ad8e6dc36381db2cd92f56876bb0fbaf27de30212cab6422fbad8
6
+ metadata.gz: a79e6b07c6955096bcd7d8e73a22a1e6e4c3cda475771b19a697df73a3e3b467f95a23027b8910e1a110e1ca1dc5cd8815314a99df0bba5a56f1ff34f6f31fd8
7
+ data.tar.gz: fad07c60a3861fd6f4c3c961e06709d3b4563201e97c8e72c9708451ab53c9cfcacf258127e6892f7b40aa0721ab898ac1b85ff39852a0d85d2e9a5dc0495827
data/README.md CHANGED
@@ -6,6 +6,10 @@
6
6
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Party domain model engine includes Person, Shop, and Company models.
7
7
  Unidom (统一领域对象模型)是一系列的领域模型引擎。参与者领域模型引擎包括个人、店铺、公司的模型。
8
8
 
9
+ ## Recent Update
10
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
11
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
12
+
9
13
  ## Usage in Gemfile
10
14
  ```ruby
11
15
  gem 'unidom-party'
@@ -15,6 +19,7 @@ gem 'unidom-party'
15
19
  ```shell
16
20
  rake db:migrate
17
21
  ```
22
+ The migration versions start with 200101.
18
23
 
19
24
  ## Call the Model
20
25
  ```ruby
@@ -30,7 +35,7 @@ person.target_party_relations
30
35
  government_agency = Unidom::Party::GovernmentAgency.valid_at.alive.first
31
36
  government_agency.supervision_region
32
37
 
33
- relation = Unidom::Party::PartyRelation.relate company, person, linkage_code: 'EMPL', grade: 0, priority: 0, opened_at: Time.now, attributes: {}
38
+ relation = Unidom::Party::PartyRelation.relate! company, person, linkage_code: 'EMPL', grade: 0, priority: 0, opened_at: Time.now, attributes: {}
34
39
  # The company employs the person
35
40
 
36
41
  Unidom::Party::PartyRelation.source_party_is(company).target_party_is(person).valid_at.alive
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_self
@@ -10,6 +10,5 @@
10
10
  * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
11
  * file per style scope.
12
12
  *
13
- *= require_tree .
14
13
  *= require_self
15
14
  */
@@ -4,11 +4,11 @@ class Unidom::Party::Company < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_companies'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
10
 
9
11
  has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
12
  has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
13
 
12
- include Unidom::Common::Concerns::ModelExtension
13
-
14
14
  end
@@ -4,6 +4,8 @@ class Unidom::Party::GovernmentAgency < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_government_agencies'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
10
 
9
11
  belongs_to :supervision_region, polymorphic: true
@@ -13,6 +15,4 @@ class Unidom::Party::GovernmentAgency < ActiveRecord::Base
13
15
 
14
16
  scope :supervision_region_is, ->(region) { where supervision_region: region }
15
17
 
16
- include Unidom::Common::Concerns::ModelExtension
17
-
18
18
  end
@@ -4,6 +4,8 @@ class Unidom::Party::PartyRelation < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_party_relations'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :grade, presence: true, numericality: { integer_only: true }
8
10
  validates :priority, presence: true, numericality: { integer_only: true }
9
11
 
@@ -13,13 +15,21 @@ class Unidom::Party::PartyRelation < ActiveRecord::Base
13
15
  scope :source_party_is, ->(source_party) { where source_party: source_party }
14
16
  scope :target_party_is, ->(target_party) { where target_party: target_party }
15
17
 
16
- include Unidom::Common::Concerns::ModelExtension
17
-
18
- def self.relate(source_party, target_party, linkage_code: 'FRND', grade: 0, priority: 0, opened_at: Time.now, attributes: {})
18
+ def self.relate(source_party, target_party, linkage_code: 'FRND', grade: 0, opened_at: Time.now, priority: 0, attributes: {})
19
19
  relation = source_party_is(source_party).target_party_is(target_party).linkage_coded_as(linkage_code).first_or_initialize grade: grade, priority: priority, opened_at: opened_at
20
20
  relation.assign_attributes attributes
21
- relation.save
21
+ relation.save!
22
22
  relation
23
23
  end
24
24
 
25
+ def self.relate!(source_party, target_party, linkage_code: 'FRND', grade: 0, opened_at: Time.now, priority: 0, attributes: {})
26
+ relation = source_party_is(source_party).target_party_is(target_party).linkage_coded_as(linkage_code).first_or_initialize grade: grade, priority: priority, opened_at: opened_at
27
+ relation.assign_attributes attributes
28
+ relation.save!
29
+ end
30
+
31
+ class << self
32
+ deprecate relate: :relate!, deprecator: ActiveSupport::Deprecation.new('1.0', 'unidom-party')
33
+ end
34
+
25
35
  end
@@ -4,11 +4,11 @@ class Unidom::Party::Person < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_people'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
10
 
9
11
  has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
12
  has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
13
 
12
- include Unidom::Common::Concerns::ModelExtension
13
-
14
14
  end
@@ -4,11 +4,11 @@ class Unidom::Party::Shop < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_shops'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
10
 
9
11
  has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
12
  has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
13
 
12
- include Unidom::Common::Concerns::ModelExtension
13
-
14
14
  end
@@ -2,13 +2,14 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Party</title>
5
- <%= stylesheet_link_tag "party/application", media: "all" %>
6
- <%= javascript_include_tag "party/application" %>
5
+ <%= stylesheet_link_tag "party/application", media: "all" %>
7
6
  <%= csrf_meta_tags %>
8
7
  </head>
9
8
  <body>
10
9
 
11
10
  <%= yield %>
12
11
 
12
+ <%= javascript_include_tag 'party/application' %>
13
+
13
14
  </body>
14
15
  </html>
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '0.6'.freeze
3
+ VERSION = '0.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-party
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
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-03-24 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '0.9'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The Party domain model engine includes Person, Shop, and Company models. Unidom
29
29
  (统一领域对象模型)是一系列的领域模型引擎。参与者领域模型引擎包括个人、店铺、公司的模型。
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.4.5.1
79
+ rubygems_version: 2.6.4
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Unidom Party Domain Model Engine 参与者领域模型引擎