unidom-visitor 1.13.7 → 1.13.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c763c992d58b86e7d7535122572868fe7e07613d
|
4
|
+
data.tar.gz: 3296ec7134c93ce575234f426656ef1a3a13707c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde7d434e1145aa8bf53844cb98218bcbca72a866f1b1700565b863172a5ccac4e650c35df73e72745c7991074ba00b5f8fe3d2bb04196dbfb17e832f513a110
|
7
|
+
data.tar.gz: e0a7de6b199856c6c2a09bed507e065870c6787f6162fe2544e275d37abaa3ea1fe9dd0d934524f84ad833ad5bcf9f200706f3db85fac709ca7e362b9af76fef
|
@@ -1,23 +1,32 @@
|
|
1
1
|
module Unidom::Visitor::Concerns::AsCredential
|
2
2
|
|
3
|
-
extend
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include Unidom::Common::Concerns::ArgumentValidation
|
4
5
|
|
5
6
|
included do |includer|
|
6
7
|
|
7
8
|
has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential
|
8
9
|
|
9
10
|
def authenticate!(it, at: Time.now, flag_code: 'RQRD')
|
11
|
+
|
12
|
+
assert_present! :it, it
|
13
|
+
assert_present! :at, at
|
14
|
+
assert_present! :flag_code, flag_code
|
15
|
+
|
10
16
|
return authenticating if authenticating.present?
|
11
17
|
create_authenticating! visitor: it, flag_code: flag_code, opened_at: at
|
18
|
+
|
12
19
|
end
|
13
20
|
|
14
21
|
def authenticate?(it, at: Time.now, flag_code: 'RQRD')
|
22
|
+
|
15
23
|
return false if authenticating.blank?
|
16
24
|
result = true
|
17
25
|
result &&= it==authenticating.visitor if it.present?
|
18
26
|
result &&= at<=authenticating.closed_at&&at>=authenticating.opened_at if at.present?
|
19
27
|
result &&= flag_code==authenticating.flag_code if flag_code.present?
|
20
28
|
result
|
29
|
+
|
21
30
|
end
|
22
31
|
|
23
32
|
end
|
@@ -10,6 +10,10 @@ shared_examples 'Unidom::Visitor::Concerns::AsCredential' do |model_attributes|
|
|
10
10
|
|
11
11
|
it_behaves_like 'has_one', model_attributes, :authenticating, Unidom::Visitor::Authenticating, authenticating_attributes
|
12
12
|
|
13
|
+
model = described_class.create! model_attributes
|
14
|
+
visitor = Unidom::Visitor::User.create!
|
15
|
+
it_behaves_like 'assert_present!', model, :authenticate!, [ visitor, at: Time.now, flag_code: 'RQRD' ], [ { 0 => :it }, :at, :flag_code ]
|
16
|
+
|
13
17
|
end
|
14
18
|
|
15
19
|
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.13.
|
4
|
+
version: 1.13.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|