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: ea4579af975e5dcd34776237b863977e4cacda0a
4
- data.tar.gz: a712ee47b545723c2877d7dcf601d64996194a8a
3
+ metadata.gz: c763c992d58b86e7d7535122572868fe7e07613d
4
+ data.tar.gz: 3296ec7134c93ce575234f426656ef1a3a13707c
5
5
  SHA512:
6
- metadata.gz: ad4bbdaceb92a74348e1da5fcd8c6caa9a04e91a8e3ee9e6bcba4d17aa6194b6a471afc5e8daab991bd4e56e0c28eadb706b234091d30547f4acd2c72d192354
7
- data.tar.gz: d0775f148c4029d695639823dbace58ee532ee06d04d8d53135bd225bb384a92f63e0cfc4d8fdd31293e1b0186c89f8291fa5d62057ccf67599a67d6800af6e3
6
+ metadata.gz: cde7d434e1145aa8bf53844cb98218bcbca72a866f1b1700565b863172a5ccac4e650c35df73e72745c7991074ba00b5f8fe3d2bb04196dbfb17e832f513a110
7
+ data.tar.gz: e0a7de6b199856c6c2a09bed507e065870c6787f6162fe2544e275d37abaa3ea1fe9dd0d934524f84ad833ad5bcf9f200706f3db85fac709ca7e362b9af76fef
@@ -1,23 +1,32 @@
1
1
  module Unidom::Visitor::Concerns::AsCredential
2
2
 
3
- extend ActiveSupport::Concern
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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Visitor
3
- VERSION = '1.13.7'.freeze
3
+ VERSION = '1.13.8'.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.13.7
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-07 00:00:00.000000000 Z
11
+ date: 2017-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common