unidom-contact 0.3.1 → 0.4

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: 07f1b0835313aa8ca9a709a31cbe486da71c57c9
4
- data.tar.gz: 713db3fc0abd766caaaf9ee338bfadd5cee4db18
3
+ metadata.gz: fd78d306addda5897a851c79dea9b58c71c262c1
4
+ data.tar.gz: 5063ba74436f72e4bd44aadf5878aa4faf9686e8
5
5
  SHA512:
6
- metadata.gz: ca596562337dc54bfc82e1ff37de3775c7361b49253e41bf454eeccfdb4b0cba8e6d8838074d51bc5e313933c64e1d49927c629f213e21219568e8875b1e26a1
7
- data.tar.gz: 8540737f5f07e5e3f5caa99828eba87db2754031d4e775a8a440e33eaedd47ddbfc080e39d19bb82531bc898b93cf88b17413b3e98cb352de8239cf1fa3367fe
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.create phone_number: '13912345678'
26
- subscriber = Person.create name: 'John'
27
- subscription = Unidom::Contact::ContactSubscription.subscribe contact, subscriber, name: 'John Mobile', primary: true, grade: 0, priority: 0, opened_at: Time.now
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
  ```
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_self
@@ -10,6 +10,5 @@
10
10
  * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
11
  * file per style scope.
12
12
  *
13
- *= require_tree .
14
13
  *= require_self
15
14
  */
@@ -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 'unidom/contact/application', media: 'all' %>
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>
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Contact
3
- VERSION = '0.3.1'.freeze
3
+ VERSION = '0.4'.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.3.1
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-03-30 00:00:00.000000000 Z
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.5'
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.5'
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.5.1
73
+ rubygems_version: 2.6.4
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Unidom Contact Domain Model Engine 联系方式领域模型引擎