unidom-visitor 0.9 → 1.0

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: 01370e102c661bcadb06f064cd2567cf3c45829d
4
- data.tar.gz: 14fe8bd66d6d7686103d136374e35bfb0cf6804e
3
+ metadata.gz: 2b78681195ec68847b13f4464ff5f5209324413b
4
+ data.tar.gz: 184c37314a0cd2baf22b2c3d13bad94c1dd19e46
5
5
  SHA512:
6
- metadata.gz: b7b131561c9ebf76373240d1a2ea8e38ce45313e57dd7dbbd0861b53de56e667d4931e3ebfac642c5b6a9df380a6de1348f0724f21bbe0cb8b51cdb9501658da
7
- data.tar.gz: 016015bf45809e5bcfaaf91541e32e4778c0995658701aa89d94f193610bdd74644080f23fae030512d34b473f3760cf5d88d60ddcd6de87bf32cf87c015dd5d
6
+ metadata.gz: 145e2338a7bbba9654e3e905f1248fb369d916823f1e21d89aa4cf60860e99084be3806f324361a4fc08d096c15d3336faf8e05a3d54ee1610c6ca72b22704b9
7
+ data.tar.gz: eee33ac2f40db2896822446719118acd50fb8ab5a78a5fc0cb4978ef6b03e4ae307a778858002818e7f4a9b57d2161e6c78573fdccaf9e1fb7a1a9f3e58d80c7
data/README.md CHANGED
@@ -6,22 +6,34 @@
6
6
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Visitor domain model engine includes User, Guest, Administrator, and Password models.
7
7
  Unidom (统一领域对象模型)是一系列的领域模型引擎。访问者领域模型引擎包括用户、游客、管理员和密码的模型。
8
8
 
9
+
10
+
9
11
  ## Recent Update
12
+
10
13
  Check out the [Road Map](ROADMAP.md) to find out what's the next.
11
14
  Check out the [Change Log](CHANGELOG.md) to find out what's new.
12
15
 
16
+
17
+
13
18
  ## Usage in Gemfile
19
+
14
20
  ```ruby
15
21
  gem 'unidom-visitor'
16
22
  ```
17
23
 
24
+
25
+
18
26
  ## Run the Database Migration
27
+
19
28
  ```shell
20
29
  rake db:migrate
21
30
  ```
22
31
  The migration versions start with 200002.
23
32
 
33
+
34
+
24
35
  ## Call the Model
36
+
25
37
  ```ruby
26
38
  phone_1 = PhoneNumberIdentity.create phone_number: '13912345678'
27
39
  Unidom::Visitor::User.sign_up phone_1, password: 'password', opened_at: Time.now
@@ -43,7 +55,7 @@ end
43
55
  ```ruby
44
56
  user = Unidom::Visitor::User.create! opened_at: Time.now
45
57
  password = Unidom::Visitor::Password.create! clear_text: 'password', opened_at: Time.now
46
- Unidom::Visitor::Authenticating.authenticate! user, password
58
+ Unidom::Visitor::Authenticating.authenticate! user, with: password
47
59
  ```
48
60
 
49
61
  ### Identificating model
@@ -17,16 +17,8 @@ class Unidom::Visitor::Authenticating < ActiveRecord::Base
17
17
  scope :visitor_type_is, ->(visitor_type) { where visitor_type: visitor_type }
18
18
  scope :credential_type_is, ->(credential_type) { where credential_type: credential_type }
19
19
 
20
- def self.authenticate(visitor, credential, opened_at: Time.now)
21
- authenticate! visitor, credential, opened_at: opened_at
22
- end
23
-
24
- def self.authenticate!(visitor, credential, opened_at: Time.now)
25
- credential_is(credential).visitor_is(visitor).valid_at.alive.first_or_create! opened_at: opened_at
26
- end
27
-
28
- class << self
29
- deprecate authenticate: :authenticate!, deprecator: ActiveSupport::Deprecation.new('1.0', 'unidom-visitor')
20
+ def self.authenticate!(visitor, with: nil, opened_at: Time.now)
21
+ credential_is(with).visitor_is(visitor).valid_at.alive.first_or_create! opened_at: opened_at
30
22
  end
31
23
 
32
24
  end
@@ -4,10 +4,10 @@ class Unidom::Visitor::Guest < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_guests'
6
6
 
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
7
9
  validates :platform_specific_identification, presence: true, length: { in: 2..self.columns_hash['platform_specific_identification'].limit }
8
10
 
9
11
  scope :platform_specific_identification_is, ->(platform_specific_identification) { where platform_specific_identification: platform_specific_identification }
10
12
 
11
- include Unidom::Common::Concerns::ModelExtension
12
-
13
13
  end
@@ -16,16 +16,8 @@ class Unidom::Visitor::Identificating < ActiveRecord::Base
16
16
  visitor_is(visitor).first.try :identity
17
17
  end
18
18
 
19
- def self.identificate(visitor, identity, opened_at: Time.now)
20
- self.visitor_is(visitor).identity_is(identity).valid_at.alive.first_or_create opened_at: opened_at
21
- end
22
-
23
19
  def self.identificate!(visitor, as: nil, at: Time.now)
24
20
  self.visitor_is(visitor).identity_is(as).valid_at.alive.first_or_create! opened_at: at
25
21
  end
26
22
 
27
- class << self
28
- deprecate identificate: :identificate!, deprecator: ActiveSupport::Deprecation.new('1.0', 'unidom-visitor')
29
- end
30
-
31
23
  end
@@ -12,13 +12,6 @@ class Unidom::Visitor::Recognization < ActiveRecord::Base
12
12
 
13
13
  include Unidom::Common::Concerns::ModelExtension
14
14
 
15
- def self.cognize(visitor, party, elemental: true, opened_at: Time.now)
16
- warn "The Unidom::Visitor::Recognization.cognize method is deprecated, and will be removed since unidom-visitor v1.0. Please use the Unidom::Visitor::Recognization.cognize method instead."
17
- raise 'Visitor can not be null.' if visitor.blank?
18
- raise 'Party can not be null.' if party.blank?
19
- recognization = visitor_is(visitor).party_is(party).first_or_create elemental: elemental, opened_at: opened_at
20
- end
21
-
22
15
  def self.cognize!(visitor, as: nil, at: Time.now, primary: false)
23
16
  query = visitor_is(visitor).party_is(as).valid_at.alive
24
17
  recognization = query.first
@@ -31,8 +24,4 @@ class Unidom::Visitor::Recognization < ActiveRecord::Base
31
24
  end
32
25
  end
33
26
 
34
- class << self
35
- deprecate cognize: :cognize!, deprecator: ActiveSupport::Deprecation.new('1.0', 'unidom-visitor')
36
- end
37
-
38
27
  end
@@ -26,7 +26,7 @@ class Unidom::Visitor::User < ActiveRecord::Base
26
26
  Rails.logger.debug "Authenticate user #{user.id} with password: #{password.inspect}."
27
27
  if password.present?
28
28
  credential = Unidom::Visitor::Password.create! clear_text: password, opened_at: opened_at
29
- authenticating = Unidom::Visitor::Authenticating.authenticate! user, credential
29
+ authenticating = Unidom::Visitor::Authenticating.authenticate! user, with: credential
30
30
  end
31
31
 
32
32
  user
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '0.9'.freeze
3
+ VERSION = '1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-visitor
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: '1.0'
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-09-05 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common