unidom-visitor 0.2 → 0.3
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 +4 -4
- data/README.md +9 -2
- data/app/models/unidom/visitor/recognization.rb +2 -2
- data/app/models/unidom/visitor/user.rb +1 -2
- data/lib/unidom/visitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce5d6edb2f58298aecbf30d7e407ab2fa9d1cc63
|
4
|
+
data.tar.gz: feb06ef5566a15a2df60c10a931185cd0cd055f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030dfc52fcf636fa54873a34841a12989eb5eb658d49daf5ffe784474368d76b8da5c230ba7920348a503408123a28e79faec0e71e5b000651213ac7218a181e
|
7
|
+
data.tar.gz: 28a805977df6d2094818d0fcbf8ae4e7533b05d807ca6c7d5b0b641871c6b3177139a1faf021cd78f8bf2d6c1b59598788f438740847e461939bee3f0729c0b1
|
data/README.md
CHANGED
@@ -18,7 +18,14 @@ rake db:migrate
|
|
18
18
|
|
19
19
|
## Call the Model
|
20
20
|
```ruby
|
21
|
-
|
21
|
+
phone = PhoneNumberIdentity.create phone_number: '13912345678'
|
22
|
+
Unidom::Visitor::User.sign_up phone, 'password', now: Time.now
|
23
|
+
# Sign up a user with given phone number and password
|
24
|
+
|
22
25
|
Unidom::Visitor::Guest.valid_at.alive.first
|
23
|
-
|
26
|
+
# Get the first guest
|
27
|
+
|
28
|
+
if Unidom::Visitor::User.valid_at.alive.first.passwords.valid_at.alive.first.merge(Unidom::Visitor::Authenticating.valid_at.alive).first.matched? 'password'
|
29
|
+
# Sign in
|
30
|
+
end
|
24
31
|
```
|
@@ -12,10 +12,10 @@ class Unidom::Visitor::Recognization < ActiveRecord::Base
|
|
12
12
|
|
13
13
|
include Unidom::Common::Concerns::ModelExtension
|
14
14
|
|
15
|
-
def self.cognize(visitor, party)
|
15
|
+
def self.cognize(visitor, party, elemental: true, opened_at: Time.now)
|
16
16
|
raise 'Visitor can not be null.' if visitor.blank?
|
17
17
|
raise 'Party can not be null.' if party.blank?
|
18
|
-
recognization = visitor_is(visitor).party_is(party).first_or_create elemental:
|
18
|
+
recognization = visitor_is(visitor).party_is(party).first_or_create elemental: elemental, opened_at: opened_at
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -15,11 +15,10 @@ class Unidom::Visitor::User < ActiveRecord::Base
|
|
15
15
|
|
16
16
|
include Unidom::Common::Concerns::ModelExtension
|
17
17
|
|
18
|
-
def self.sign_up(identity, password)
|
18
|
+
def self.sign_up(identity, password, now: Time.now)
|
19
19
|
|
20
20
|
return false if identified_by(identity).valid_at.alive.merge(::Unidom::Visitor::Identificating.valid_at.alive).count>0
|
21
21
|
|
22
|
-
now = Time.now
|
23
22
|
user = self.create! opened_at: now
|
24
23
|
credential = ::Unidom::Visitor::Password.create! clear_text: password, opened_at: now
|
25
24
|
|
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.
|
4
|
+
version: '0.3'
|
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-
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|