unidom-contact 1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -8
- data/Rakefile +2 -2
- data/app/assets/config/unidom-contact_manifest.js +2 -0
- data/app/assets/javascripts/unidom/contact/application.js +1 -1
- data/app/assets/stylesheets/unidom/contact/application.css +3 -3
- data/app/controllers/unidom/contact/application_controller.rb +1 -0
- data/app/jobs/unidom/contact/application_job.rb +2 -0
- data/app/mailers/unidom/contact/application_mailer.rb +4 -0
- data/app/models/unidom/contact/application_record.rb +3 -0
- data/app/models/unidom/contact/contact_subscription.rb +1 -1
- data/app/models/unidom/contact/email_address.rb +1 -1
- data/lib/unidom/contact/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7820e3b26fd0f497242c4b7267d2a4747426f719
|
4
|
+
data.tar.gz: ef251ac7c7c2709fd65e248082b8783032d95252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bab15c102d9bd750ed3648af4201bbea2f8964da173b3c8ca332a61b709f7b8b00f516d3d672d5dd91deea278e350164ef2bfa78837513aa467409077c22e98
|
7
|
+
data.tar.gz: 10f5068a072f52394dacfa8f385a1225aaaed90ae0808a32f208682cf146627699ce8b37485a7a32221971697df4c7cc556bcf867b2dd0073a6d227bb54edc05
|
data/README.md
CHANGED
@@ -2,26 +2,39 @@
|
|
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-contact.svg)](https://badge.fury.io/rb/unidom-contact)
|
5
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-contact.svg)](https://gemnasium.com/github.com/topbitdu/unidom-contact)
|
5
6
|
|
6
7
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Contact domain model engine includes Contact Subscription and Email Address models.
|
7
8
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。联系方式领域模型引擎包括联系方式订阅和电子邮箱地址的模型。
|
8
9
|
|
10
|
+
|
11
|
+
|
9
12
|
## Recent Update
|
13
|
+
|
10
14
|
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
11
15
|
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
12
16
|
|
17
|
+
|
18
|
+
|
13
19
|
## Usage in Gemfile
|
20
|
+
|
14
21
|
```ruby
|
15
22
|
gem 'unidom-contact'
|
16
23
|
```
|
17
24
|
|
25
|
+
|
26
|
+
|
18
27
|
## Run the Database Migration
|
28
|
+
|
19
29
|
```shell
|
20
30
|
rake db:migrate
|
21
31
|
```
|
22
32
|
The migration versions start with 200103.
|
23
33
|
|
34
|
+
|
35
|
+
|
24
36
|
## Call the Model
|
37
|
+
|
25
38
|
```ruby
|
26
39
|
contact = Unidom::Contact::China::MobilePhoneNumber.phone_number_is('13912345678').valid_at.alive.first_or_create!
|
27
40
|
subscriber = Unidom::Party::Person.create! name: 'John'
|
@@ -41,7 +54,10 @@ Unidom::Contact::EmailAddress.full_address_is('topbit.du@gmail.com').first
|
|
41
54
|
|
42
55
|
```
|
43
56
|
|
57
|
+
|
58
|
+
|
44
59
|
## Include the Concerns
|
60
|
+
|
45
61
|
```ruby
|
46
62
|
include Unidom::Contact::Concerns::AsContact
|
47
63
|
include Unidom::Contact::Concerns::AsSubscriber
|
@@ -49,18 +65,21 @@ include Unidom::Contact::Concerns::AsEmailAddressSubscriber
|
|
49
65
|
```
|
50
66
|
|
51
67
|
### As Contact concern
|
52
|
-
|
53
|
-
|
54
|
-
|
68
|
+
|
69
|
+
The As Contact concern do the following tasks for the includer automatically:
|
70
|
+
1. Define the has_many :contact_subscriptions macro as: ``has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :contact``
|
71
|
+
2. Define the #is_subscribed_as_contact! method as: ``is_subscribed_as_contact!(by: nil, at: Time.now, name: by.try(:name), primary: true)``
|
55
72
|
3. Define the #is_subscribed_as_contact? method as: ``is_subscribed_as_contact?(by: nil, at: Time.now, primary: true)``
|
56
73
|
|
57
74
|
### As Subscriber concern
|
58
|
-
|
59
|
-
|
60
|
-
|
75
|
+
|
76
|
+
The As Subscriber concern do the following tasks for the includer automatically:
|
77
|
+
1. Define the has_many :contact_subscriptions macro as: ``has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :subscriber``
|
78
|
+
2. Define the #subscribe_contact! method as: ``subscribe_contact!(contact, at: Time.now, name: nil, primary: true)``
|
61
79
|
3. Define the #subscribe_contact? method as: ``subscribe_contact?(contact, at: Time.now, primary: true)``
|
62
80
|
|
63
81
|
### As Email Address Subscriber concern
|
64
|
-
|
65
|
-
|
82
|
+
|
83
|
+
The As Email Address Subscriber concern do the following tasks for the includer automatically:
|
84
|
+
1. Include the As Subscriber concern
|
66
85
|
2. Define the has_many :email_addresses macro as: ``has_many :email_addresses, through: :contact_subscriptions, source: :contact, source_type: 'Unidom::Contact::EmailAddress'``
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
10
|
rdoc.rdoc_dir = 'rdoc'
|
11
11
|
rdoc.title = 'Unidom Contact'
|
12
12
|
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
@@ -20,5 +20,5 @@ load 'rails/tasks/statistics.rake'
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
require 'bundler/gem_tasks'
|
24
24
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
6
|
//
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
9
|
//
|
10
10
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
@@ -6,9 +6,9 @@
|
|
6
6
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
7
|
*
|
8
8
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any
|
10
|
-
*
|
11
|
-
* file per style scope.
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
12
|
*
|
13
13
|
*= require_self
|
14
14
|
*/
|
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:
|
4
|
+
version: 1.3.1
|
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-11-06 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: '1.
|
19
|
+
version: '1.6'
|
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: '1.
|
26
|
+
version: '1.6'
|
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 (统一领域对象模型)是一系列的领域模型引擎。联系方式领域模型引擎包括联系方式订阅和电子邮箱地址的模型。
|
@@ -36,10 +36,14 @@ files:
|
|
36
36
|
- MIT-LICENSE
|
37
37
|
- README.md
|
38
38
|
- Rakefile
|
39
|
+
- app/assets/config/unidom-contact_manifest.js
|
39
40
|
- app/assets/javascripts/unidom/contact/application.js
|
40
41
|
- app/assets/stylesheets/unidom/contact/application.css
|
41
42
|
- app/controllers/unidom/contact/application_controller.rb
|
42
43
|
- app/helpers/unidom/contact/application_helper.rb
|
44
|
+
- app/jobs/unidom/contact/application_job.rb
|
45
|
+
- app/mailers/unidom/contact/application_mailer.rb
|
46
|
+
- app/models/unidom/contact/application_record.rb
|
43
47
|
- app/models/unidom/contact/concerns/as_contact.rb
|
44
48
|
- app/models/unidom/contact/concerns/as_email_address_subscriber.rb
|
45
49
|
- app/models/unidom/contact/concerns/as_subscriber.rb
|