unidom-contact 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 +12 -1
- data/app/models/unidom/contact/contact_subscription.rb +4 -0
- data/lib/unidom/contact/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8597e13821235e2d9446c1889fd11bc7e5f0af9e
|
4
|
+
data.tar.gz: 8949246d9a869af67a14349c068d308892bbe52f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b93f0428812782f1da5b6afbe5d84ca46cd6d8444c0b5afaba24a8ded098f6991de02d36262b86cd31b9a584ead2a255fbc350055a0bdb5b3c030723c20a3bfb
|
7
|
+
data.tar.gz: fe14e4eec22560e263a2afa0f3c74b1c8616f5f60cf77c819bf1794e7ecfe0b549bb4770e86061439b26202cdfc199824a26b887ec8ee03389611d022c283ca2
|
data/README.md
CHANGED
@@ -18,6 +18,17 @@ rake db:migrate
|
|
18
18
|
|
19
19
|
## Call the Model
|
20
20
|
```ruby
|
21
|
-
|
21
|
+
contact = MobilePhoneNumber.create phone_number: '13912345678'
|
22
|
+
subscriber = Person.create name: 'John'
|
23
|
+
subscription = Unidom::Contact::ContactSubscription.subscribe contact, subscriber, name: 'John Mobile', primary: true, grade: 0, priority: 0
|
24
|
+
# Associate the subscriber & the contact
|
25
|
+
|
26
|
+
Unidom::Contact::ContactSubscription.subscribed_by(subscriber).valid_at.alive
|
27
|
+
# Get a list of all contact subscriptions of subscriber
|
28
|
+
|
29
|
+
Unidom::Contact::ContactSubscription.contact_is(contact).valid_at.alive
|
30
|
+
# Get a list of all contact subscriptions of contact
|
31
|
+
|
22
32
|
Unidom::Contact::EmailAddress.full_address_is('topbit.du@gmail.com').first
|
33
|
+
# Find the Email Address
|
23
34
|
```
|
@@ -16,4 +16,8 @@ class Unidom::Contact::ContactSubscription < ActiveRecord::Base
|
|
16
16
|
|
17
17
|
include Unidom::Common::Concerns::ModelExtension
|
18
18
|
|
19
|
+
def self.subscribe(contact, subscriber, name: subscriber.name, primary: false, grade: 0, priority: 0)
|
20
|
+
contact_is(contact).subscribed_by(subscriber).valid_at.alive.first_or_create name: name, elemental: primary, grade: grade, priority: priority, opened_at: Time.now
|
21
|
+
end
|
22
|
+
|
19
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-contact
|
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-03-23 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.
|
19
|
+
version: '0.5'
|
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.
|
26
|
+
version: '0.5'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Contact domain model engine includes Contact Subscription and Email Address
|
29
29
|
models. Unidom (统一领域对象模型)是一系列的领域模型引擎。联系方式领域模型引擎包括联系方式订阅和电子邮箱地址的模型。
|