identikey 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 17806b4e8996eac32014f37f34d9e698b4668e5fd196e1102e2a30c0eb349757
4
- data.tar.gz: 26e36da28a662d259e538ef2936d8b03a883c0e38e450a5350e548a336336ed7
3
+ metadata.gz: 4b55edf8d9a08412a4ce162b70b130f149a0ea1047c97a14a301056aa5c41350
4
+ data.tar.gz: eac60565c851f0ee3d100171a804d60e5804bb59539ad83b81c09d92b0a811f8
5
5
  SHA512:
6
- metadata.gz: cf8893d1ae7931194b59c54d0f3a6addd824869c116859ae534f36bb5a6619cebdb1f0e87bb6d8c74c4a67988470053abb2985b6d58e2011d59a0b16eeaf1eeb
7
- data.tar.gz: 0c4e3661f8b518f55382490c9af060580d1982f2762904afeef435e9c544e0309e6ced8230bbea0e4b3e23451a544828bd10dc486858d8fc3ca03b792e191437
6
+ metadata.gz: bdcc16f8fa44bc513e44b6ed6b2ef5c3259cdc251568e2719a410306b033c27a1cc7542f19707ce1ae4803b6d1a7b0466a549f1a7a1ef93812c3e6bf70f26160
7
+ data.tar.gz: f55cbd706367e52d32394c4e220146fec6ea0a0a881c3871d71a186b0857a58ecb19357e54837a67950b25647ad45a6125cdc7bf1f96ad83870734957e6f7394
data/lib/identikey.rb CHANGED
@@ -1,26 +1,7 @@
1
1
  require 'savon'
2
2
 
3
3
  require 'identikey/version'
4
+ require 'identikey/error'
4
5
  require 'identikey/unsigned'
5
6
  require 'identikey/authentication'
6
7
  require 'identikey/administration'
7
-
8
- module Identikey
9
- # Generic error class
10
- class Error < StandardError; end
11
-
12
- # Raised when the user is not doing things correctly
13
- class UsageError < Error; end
14
-
15
- # Raised when the received XML does not conform to documentation
16
- class ParseError < Error; end
17
-
18
- # Raised when something is "not found", such as an user or a digipass.
19
- class NotFound < Error; end
20
-
21
- # Raised when Admin logon failed
22
- class LogonFailed < Error; end
23
-
24
- # Raised when read/write operations fail
25
- class OperationFailed < Error; end
26
- end
@@ -7,8 +7,10 @@ module Identikey
7
7
  end
8
8
 
9
9
  def self.search(session:, query:, options: {})
10
- if query.key?(:has_digipass) && [true, false].include?(query[:has_digipass])
11
- query[:has_digipass] = query[:has_digipass] ? 'Assigned' : 'Unassigned'
10
+ [:has_digipass, :not_has_digipass].each do |funky_boolean|
11
+ if query.key?(funky_boolean) && [true, false].include?(query[funky_boolean])
12
+ query[funky_boolean] = query[funky_boolean] ? 'Assigned' : 'Unassigned'
13
+ end
12
14
  end
13
15
 
14
16
  query_keys = {
@@ -28,13 +28,13 @@ module Identikey
28
28
  end
29
29
 
30
30
  def self.validate!(user, domain, otp)
31
- status, result, _ = new.auth_user(user, domain, otp)
31
+ status, result, error_stack = new.auth_user(user, domain, otp)
32
32
 
33
33
  if otp_validated_ok?(status, result)
34
34
  return true
35
35
  else
36
36
  error_message = result['CREDFLD_STATUS_MESSAGE']
37
- raise Identikey::OperationFailed, "OTP Validation error (#{status}): #{error_message}"
37
+ raise Identikey::OperationFailed.new("OTP Validation error (#{status}): #{error_message}", error_stack)
38
38
  end
39
39
  end
40
40
 
@@ -0,0 +1,27 @@
1
+ module Identikey
2
+ # Generic error class
3
+ class Error < StandardError
4
+ def initialize(message, error_stack = nil)
5
+ super(message)
6
+
7
+ @error_stack = error_stack
8
+ end
9
+
10
+ attr_reader :error_stack
11
+ end
12
+
13
+ # Raised when the user is not doing things correctly
14
+ class UsageError < Error; end
15
+
16
+ # Raised when the received XML does not conform to documentation
17
+ class ParseError < Error; end
18
+
19
+ # Raised when something is "not found", such as an user or a digipass.
20
+ class NotFound < Error; end
21
+
22
+ # Raised when Admin logon failed
23
+ class LogonFailed < Error; end
24
+
25
+ # Raised when read/write operations fail
26
+ class OperationFailed < Error; end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module Identikey
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identikey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -160,6 +160,7 @@ files:
160
160
  - lib/identikey/administration/user.rb
161
161
  - lib/identikey/authentication.rb
162
162
  - lib/identikey/base.rb
163
+ - lib/identikey/error.rb
163
164
  - lib/identikey/unsigned.rb
164
165
  - lib/identikey/version.rb
165
166
  - log/.keep