unidom-party 1.1 → 1.2

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: 7d44dcf01377fa6797a750edb94b2c8182e98479
4
- data.tar.gz: b4c7fa3d7e60b442962b8cbd3dc0ec86bcf19d06
3
+ metadata.gz: 880d93c7b67cc3ce1e60dd59ed90b260b9f4abac
4
+ data.tar.gz: 5c0a772a1e861375c0fcea35c66be01a402e2d3f
5
5
  SHA512:
6
- metadata.gz: a6923e9a51e04950edca947f0e8a4dd8166537fd6d7cfb14d46c33a4c1e5b00e84ffd693c2cfb90d6c06285c7f8b7cd60d72d890a7fd2a4f25be77585bdc748f
7
- data.tar.gz: 83e799e3dd925119559f84b5a701da8908cbdaf9c1f01a188f6ba44bc09a44613fdb056069a5178f55ce61bbdcf062963eab78fc70c0ff2274d147b1ac7682c4
6
+ metadata.gz: d272e1ea4e63e8661faf9bb1919cad06c60102fe92d9a467b81876351cb4636c2635b48f0e38e55659e56b747928e5ae54b4b2492e7d8b976a54bc0ea641326a
7
+ data.tar.gz: 4a023806269906e34633ff880c14cf0ec7c7a2e8a6b2115713150d7b4c3670cd7258545a970ca733c59c6d2cfbfcfe39b557eadaf273ec9cfcaeebfbdd30e5f2
data/README.md CHANGED
@@ -53,7 +53,9 @@ include Unidom::Party::Concerns::AsTargetParty
53
53
  ### As Source Party concern
54
54
  The As Source Party concern do the following tasks for the includer automatically:
55
55
  1. Define the has_many :target_party_relations macro as: ``has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party``
56
+ 2. Define the #relate! method as: ``relate!(to: nil, due_to: nil, at: Time.now)``
56
57
 
57
58
  ### As Target Party concern
58
59
  The As Target Party concern do the following tasks for the includer automatically:
59
60
  1. Define the has_many :source_party_relations macro as: ``has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party``
61
+ 2. Define the #is_related! method as: ``is_related!(to: nil, due_to: nil, at: Time.now)``
@@ -6,6 +6,14 @@ module Unidom::Party::Concerns::AsSourceParty
6
6
 
7
7
  has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
8
8
 
9
+ def relate!(to: nil, due_to: nil, at: Time.now)
10
+ target_party_relations.create! target_party: to, linkage_code: due_to, opened_at: at
11
+ end
12
+
13
+ #def relate?(to: nil, due_to: nil, at: Time.now)
14
+ # target_party_relations.target_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
+ #end
16
+
9
17
  end
10
18
 
11
19
  module ClassMethods
@@ -6,6 +6,14 @@ module Unidom::Party::Concerns::AsTargetParty
6
6
 
7
7
  has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
8
8
 
9
+ def is_related!(to: nil, due_to: nil, at: Time.now)
10
+ source_party_relations.create! source_party: to, linkage_code: due_to, opened_at: at
11
+ end
12
+
13
+ #def is_related?(to: nil, due_to: nil, at: Time.now)
14
+ # source_party_relations.source_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
+ #end
16
+
9
17
  end
10
18
 
11
19
  module ClassMethods
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.2'.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: '1.1'
4
+ version: '1.2'
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-09 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common