unidom-contact 0.3.1 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/app/assets/javascripts/unidom/contact/application.js +1 -1
- data/app/assets/stylesheets/unidom/contact/application.css +0 -1
- data/app/models/unidom/contact/contact_subscription.rb +10 -2
- data/app/views/layouts/unidom/contact/application.html.erb +3 -2
- data/lib/unidom/contact/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd78d306addda5897a851c79dea9b58c71c262c1
|
4
|
+
data.tar.gz: 5063ba74436f72e4bd44aadf5878aa4faf9686e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aead0014470362276c6ddf34a64d4834046dd5fd109772fd34dd00029b720f1083ad0c404bddba9282c52ea1d018653ac7f88a684761bba025ff15ccb01b721c
|
7
|
+
data.tar.gz: 7bfc13067d9eec3fac556cc390bce218f70d5555ac8e7854f13ab99d9013c3479b99845c1cde51ecbeb702a739bcb1e1135bbeadf61ac13fc58a9f5635fd728b
|
data/README.md
CHANGED
@@ -19,12 +19,13 @@ gem 'unidom-contact'
|
|
19
19
|
```shell
|
20
20
|
rake db:migrate
|
21
21
|
```
|
22
|
+
The migration versions start with 200103.
|
22
23
|
|
23
24
|
## Call the Model
|
24
25
|
```ruby
|
25
|
-
contact = MobilePhoneNumber.
|
26
|
-
subscriber = Person.create
|
27
|
-
subscription = Unidom::Contact::ContactSubscription.subscribe contact, subscriber,
|
26
|
+
contact = Unidom::Contact::China::MobilePhoneNumber.phone_number_is('13912345678').valid_at.alive.first_or_create!
|
27
|
+
subscriber = Unidom::Party::Person.create! name: 'John'
|
28
|
+
subscription = Unidom::Contact::ContactSubscription.subscribe! contact, subscriber, 'John Mobile', true, 0, 0, Time.now
|
28
29
|
# Associate the subscriber & the contact
|
29
30
|
|
30
31
|
Unidom::Contact::ContactSubscription.subscribed_by(subscriber).valid_at.alive
|
@@ -35,4 +36,5 @@ Unidom::Contact::ContactSubscription.contact_is(contact).valid_at.alive
|
|
35
36
|
|
36
37
|
Unidom::Contact::EmailAddress.full_address_is('topbit.du@gmail.com').first
|
37
38
|
# Find the Email Address
|
39
|
+
|
38
40
|
```
|
@@ -4,6 +4,8 @@ class Unidom::Contact::ContactSubscription < ActiveRecord::Base
|
|
4
4
|
|
5
5
|
self.table_name = 'unidom_contact_subscriptions'
|
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
|
validates :grade, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1000 }
|
9
11
|
validates :priority, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1000 }
|
@@ -14,10 +16,16 @@ class Unidom::Contact::ContactSubscription < ActiveRecord::Base
|
|
14
16
|
scope :contact_is, ->(contact) { where contact: contact }
|
15
17
|
scope :subscribed_by, ->(subscriber) { where subscriber: subscriber }
|
16
18
|
|
17
|
-
include Unidom::Common::Concerns::ModelExtension
|
18
|
-
|
19
19
|
def self.subscribe(contact, subscriber, name: subscriber.name, primary: false, grade: 0, priority: 0, opened_at: Time.now)
|
20
20
|
contact_is(contact).subscribed_by(subscriber).valid_at.alive.first_or_create name: name, elemental: primary, grade: grade, priority: priority, opened_at: opened_at
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.subscribe!(contact, subscriber, name = subscriber.name, primary = false, grade = 0, priority = 0, opened_at = Time.now)
|
24
|
+
contact_is(contact).subscribed_by(subscriber).valid_at.alive.first_or_create! name: name, elemental: primary, grade: grade, priority: priority, opened_at: opened_at
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
deprecate subscribe: :subscribe!, deprecator: ActiveSupport::Deprecation.new('1.0', 'unidom-contact')
|
29
|
+
end
|
30
|
+
|
23
31
|
end
|
@@ -2,13 +2,14 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Unidom Contact</title>
|
5
|
-
<%= stylesheet_link_tag
|
6
|
-
<%= javascript_include_tag 'unidom/contact/application' %>
|
5
|
+
<%= stylesheet_link_tag 'unidom/contact/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 'unidom/contact/application' %>
|
13
|
+
|
13
14
|
</body>
|
14
15
|
</html>
|
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.4'
|
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-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.
|
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.
|
26
|
+
version: '0.9'
|
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 (统一领域对象模型)是一系列的领域模型引擎。联系方式领域模型引擎包括联系方式订阅和电子邮箱地址的模型。
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.4
|
73
|
+
rubygems_version: 2.6.4
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Unidom Contact Domain Model Engine 联系方式领域模型引擎
|