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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 460f49f73d43bd505a2e7c7653bfb7925e3a11a2
4
- data.tar.gz: 79ac76121185d0df60ea9fb79010221d14c04e7d
3
+ metadata.gz: 8597e13821235e2d9446c1889fd11bc7e5f0af9e
4
+ data.tar.gz: 8949246d9a869af67a14349c068d308892bbe52f
5
5
  SHA512:
6
- metadata.gz: 495ca251c7c37284144f103962e16d1fc23c13f639c63a52cd156044dcb3b2c6ffc2daae606df57e0a0ebdd63b56dd6542034e38d8e1e7a6ec18b1cce2c87b0f
7
- data.tar.gz: 48874bd6794fb065d272ff654cde98976c938a4cb658afd9ad8590e5052a508582ebaa780b12ff6fa27998b89fea162fdc3aa62dfe8406c4d9d9cfb9f03442c5
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
- Unidom::Contact::ContactSubscription.subscribed_by(subscriber).valid_at.alive.first
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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Contact
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-contact
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-02-25 00:00:00.000000000 Z
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.2'
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.2'
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 (统一领域对象模型)是一系列的领域模型引擎。联系方式领域模型引擎包括联系方式订阅和电子邮箱地址的模型。