unidom-visitor 0.2 → 0.3

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: e2b3c29d0f97c93570d70878efd1b80dbd832818
4
- data.tar.gz: 5f9fe521d0521eb34a52529554af276c65cfddf1
3
+ metadata.gz: ce5d6edb2f58298aecbf30d7e407ab2fa9d1cc63
4
+ data.tar.gz: feb06ef5566a15a2df60c10a931185cd0cd055f8
5
5
  SHA512:
6
- metadata.gz: 7cc4b94a0361e0f2962d3dbfd38048796de50dfaae2efe7cd8debfb7a494de5deef47819b0cf4d187ecc56a69b6b93a6001c6e10913e63371f8d4b4e512cdcfd
7
- data.tar.gz: 6acc52f6cf9f81217d9386cee725557389544dc773e20fb40aa8859be7583ebbe0c5c34a923cc675a698d01406c755701977a8d4c03c8d2adf7fe326a5c6fa75
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
- Unidom::Visitor::User.sign_up mobile_phone_number_entity, 'password'
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
- Unidom::Visitor::User.valid_at.alive.first.passwords.valid_at.alive.first.merge(Unidom::Visitor::Authenticating.valid_at.alive).first
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: true, opened_at: Time.now
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
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '0.2'.freeze
3
+ VERSION = '0.3'.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.2'
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-23 00:00:00.000000000 Z
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common