unidom-visitor 1.1 → 1.2

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: 3282315f8bd1fe0a2f2880d46d5530c86325a0bf
4
- data.tar.gz: 54927a4887ae4770fbf92313929b5b50828bb38a
3
+ metadata.gz: a04ab37eb00f37113ccd0f040ee2274c0b0f4e07
4
+ data.tar.gz: 831caea39439818ded903fac9b01df871192aa59
5
5
  SHA512:
6
- metadata.gz: 98c604a2ab5e767806c16a26535140d12aeddeebcc67eafa06e07fbd0abc6e5b365c8e9440ac9ec6589165f4e089acdebb023ee9aca4260926f02d9da3887b95
7
- data.tar.gz: 6d72101039d892581ec4443ab8e62aa435e5947c381dda51a4caa280f09535ccea4d6086c464c686e540bc1f888b367129c751ed7ab3be863a2d77c1aece92f5
6
+ metadata.gz: b2c0e2fdc34366a948e95735e331ebedc92539301027e0e342bf7859844133160c97f6788942bbb5569e9ce0239a50b4ac40e606c2c3d179f541ab28d1fef243
7
+ data.tar.gz: ad1059566f9d92acd833310e92d3bb20d0b0b311c28ca7e885474962e4e7a273f5fb7e02383af42d40aba9456b35976b2fced22802a3e4a7ef646d0964f36af4
data/README.md CHANGED
@@ -2,6 +2,7 @@
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-visitor.svg)](https://badge.fury.io/rb/unidom-visitor)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-visitor.svg)](https://gemnasium.com/github.com/topbitdu/unidom-visitor)
5
6
 
6
7
  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
8
  Unidom (统一领域对象模型)是一系列的领域模型引擎。访问者领域模型引擎包括用户、游客、管理员和密码的模型。
@@ -77,6 +78,7 @@ Unidom::Visitor::Recognization.cognize! user, as: person
77
78
  ## Inlcude the Concerns
78
79
  ```ruby
79
80
  include Unidom::Visitor::Concerns::AsVisitor
81
+ include Unidom::Visitor::Concerns::AsCredential
80
82
  ```
81
83
 
82
84
  ### As Visitor concern
@@ -86,3 +88,7 @@ The As Visitor concern do the following tasks for the includer automatically:
86
88
  3. Define the has_many :recognizations macro as: ``has_many :recognizations, class_name: 'Unidom::Visitor::Recognization', as: :visitor``
87
89
  4. Define the .identified_by scope as: ``scope :identified_by, ->(identity) { joins(:identificatings).merge(Unidom::Visitor::Identificating.identity_is identity) }``
88
90
  5. Define the .sign_up method as: ``sign_up(identity, password: nil, opened_at: Time.now)``
91
+
92
+ ### As Credential concern
93
+ The As Credential concern do the following tasks for the includer automatically:
94
+ 1. Define the has_one :authenticatings macro as: ``has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential``
@@ -0,0 +1,14 @@
1
+ module Unidom::Visitor::Concerns::AsCredential
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -7,7 +7,6 @@ module Unidom::Visitor::Concerns::AsVisitor
7
7
  has_many :identificatings, class_name: 'Unidom::Visitor::Identificating', as: :visitor
8
8
 
9
9
  has_many :authenticatings, class_name: 'Unidom::Visitor::Authenticating', as: :visitor
10
- #has_many :passwords, through: :authenticatings, source: :credential, source_type: 'Unidom::Visitor::Password'
11
10
 
12
11
  has_many :recognizations, class_name: 'Unidom::Visitor::Recognization', as: :visitor
13
12
 
@@ -5,12 +5,11 @@ class Unidom::Visitor::Password < ActiveRecord::Base
5
5
  self.table_name = 'unidom_passwords'
6
6
 
7
7
  include Unidom::Common::Concerns::ModelExtension
8
+ include Unidom::Visitor::Concerns::AsCredential
8
9
 
9
10
  validates :clear_text, presence: true, length: { in: 6..200 }
10
11
  validates :pepper_content, presence: true, length: { is: columns_hash['pepper_content'].limit }
11
12
 
12
- has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential
13
-
14
13
  before_validation :generate_pepper_content
15
14
 
16
15
  def generate_pepper_content
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.2'.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: '1.1'
4
+ version: '1.2'
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-29 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -41,6 +41,7 @@ files:
41
41
  - app/controllers/unidom/visitor/application_controller.rb
42
42
  - app/helpers/unidom/visitor/application_helper.rb
43
43
  - app/models/unidom/visitor/authenticating.rb
44
+ - app/models/unidom/visitor/concerns/as_credential.rb
44
45
  - app/models/unidom/visitor/concerns/as_visitor.rb
45
46
  - app/models/unidom/visitor/guest.rb
46
47
  - app/models/unidom/visitor/identificating.rb