unidom-visitor 0.3 → 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: ce5d6edb2f58298aecbf30d7e407ab2fa9d1cc63
4
- data.tar.gz: feb06ef5566a15a2df60c10a931185cd0cd055f8
3
+ metadata.gz: 491067fb998268e5617f760e85cf50d5952b8a53
4
+ data.tar.gz: c4f5bb60ad59a119f846aa30b23da1536b5a0b9b
5
5
  SHA512:
6
- metadata.gz: 030dfc52fcf636fa54873a34841a12989eb5eb658d49daf5ffe784474368d76b8da5c230ba7920348a503408123a28e79faec0e71e5b000651213ac7218a181e
7
- data.tar.gz: 28a805977df6d2094818d0fcbf8ae4e7533b05d807ca6c7d5b0b641871c6b3177139a1faf021cd78f8bf2d6c1b59598788f438740847e461939bee3f0729c0b1
6
+ metadata.gz: b84f6c06b982f91fcdbbfeedc6f3e930385bbccc214426f908ce98667b7645140591770170a7f1e56c36760df3372ba0e1c01e0092bc964c60484aafe74b1b24
7
+ data.tar.gz: bcadf0497db1c7f90214f4218b272f80f3bb0497be5d7b42c29f9b98f60650f7a6d8e8110406f6d66640efc43e25523beefc9d0a0d0b25d0dbd123daf6ddd76f
data/README.md CHANGED
@@ -19,7 +19,7 @@ rake db:migrate
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
22
+ Unidom::Visitor::User.sign_up phone, 'password', opened_at: Time.now
23
23
  # Sign up a user with given phone number and password
24
24
 
25
25
  Unidom::Visitor::Guest.valid_at.alive.first
@@ -17,8 +17,8 @@ class Unidom::Visitor::Authenticating < ActiveRecord::Base
17
17
 
18
18
  include Unidom::Common::Concerns::ModelExtension
19
19
 
20
- def self.authenticate(visitor, credential)
21
- self.create! visitor: visitor, credential: credential, opened_at: Time.now
20
+ def self.authenticate(visitor, credential, opened_at: Time.now)
21
+ self.create! visitor: visitor, credential: credential, opened_at: opened_at
22
22
  end
23
23
 
24
24
  end
@@ -16,8 +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)
20
- self.visitor_is(visitor).identity_is(identity).valid_at.alive.first_or_create opened_at: Time.now
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
21
  end
22
22
 
23
23
  end
@@ -15,12 +15,12 @@ class Unidom::Visitor::User < ActiveRecord::Base
15
15
 
16
16
  include Unidom::Common::Concerns::ModelExtension
17
17
 
18
- def self.sign_up(identity, password, now: Time.now)
18
+ def self.sign_up(identity, password, opened_at: 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
- user = self.create! opened_at: now
23
- credential = ::Unidom::Visitor::Password.create! clear_text: password, opened_at: now
22
+ user = self.create! opened_at: opened_at
23
+ credential = ::Unidom::Visitor::Password.create! clear_text: password, opened_at: opened_at
24
24
 
25
25
  identificating = ::Unidom::Visitor::Identificating.identificate user, identity
26
26
  authenticating = ::Unidom::Visitor::Authenticating.authenticate user, credential
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '0.3'.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-visitor
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
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-25 00:00:00.000000000 Z
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common