lexis_nexis_instant_authenticate 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +23 -0
- data/lib/lexis_nexis_instant_authenticate/client.rb +14 -0
- data/lib/lexis_nexis_instant_authenticate/requests/base.rb +12 -2
- data/lib/lexis_nexis_instant_authenticate/requests/create_quiz.rb +16 -3
- data/lib/lexis_nexis_instant_authenticate/resources/base.rb +9 -3
- data/lib/lexis_nexis_instant_authenticate/resources/quiz.rb +2 -2
- data/lib/lexis_nexis_instant_authenticate/resources/score.rb +3 -3
- data/lib/lexis_nexis_instant_authenticate/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f834cd2390d9348140a92b6960b9f926baedd77
|
4
|
+
data.tar.gz: 68dcf36491121bda5f794bf97e4e18a8532d0028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cf1184ab5c38bc05b84f699e130e3f553263089950ee17f385b32f67b52e03944a4c5655f35b2d717d6049ddcfffa5eee2d4197576e4ca3f2cea3bc2041717c
|
7
|
+
data.tar.gz: ab250dfda90dc25574f51c3cc149b4b5cff16c3d403de6f0515ed576f6c2bf9f613f03e9e8abd51307a78aa186d87687294c01df663ef9d6c36340ad5763a96e
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -47,8 +47,30 @@ Response will have:
|
|
47
47
|
* `response.id`
|
48
48
|
* `response.transaction_id`
|
49
49
|
|
50
|
+
###Scoring Responses
|
51
|
+
The `score_quiz` method expects the following arguments:
|
52
|
+
* `transaction_id` This is the GUID that you called the `create_quiz` method with or the GUID that was generated for you.
|
53
|
+
* `responses` This is an array of hashes in the form of `{question_id: 1234, choice_id: 4321}`
|
50
54
|
|
55
|
+
```ruby
|
56
|
+
response = @client.score_quiz(transaction_id, Array(@responses).map(&:with_indifferent_access))
|
57
|
+
if response.success? && response.pass?
|
58
|
+
return true
|
59
|
+
else
|
60
|
+
return response.status
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
Response will have:
|
65
|
+
* `response.success?`
|
66
|
+
* `response.pass?`
|
67
|
+
* `response.score`
|
68
|
+
* `response.proofing_response`
|
51
69
|
|
70
|
+
## To-Do
|
71
|
+
* Write Tests
|
72
|
+
* Transition to actual WSDL from LN.
|
73
|
+
* Refactor `Response` Object.
|
52
74
|
|
53
75
|
## Development
|
54
76
|
|
@@ -56,6 +78,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
56
78
|
|
57
79
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
80
|
|
81
|
+
|
59
82
|
## Contributing
|
60
83
|
|
61
84
|
Bug reports and pull requests are welcome on GitHub at https://github.com/RepPro/lexis_nexis_instant_authenticate.
|
@@ -19,6 +19,7 @@ module LexisNexisInstantAuthenticate
|
|
19
19
|
config.env_namespace :soapenv
|
20
20
|
config.raise_errors @options[:production]
|
21
21
|
config.log !@options[:production]
|
22
|
+
config.log_level @options[:log_level] || :warn
|
22
23
|
config.namespace_identifier "ws"
|
23
24
|
|
24
25
|
config.wsse_auth(@options[:username], @options[:password], :digest)
|
@@ -53,10 +54,23 @@ module LexisNexisInstantAuthenticate
|
|
53
54
|
savon.build_request(:invoke_identity_service)
|
54
55
|
end
|
55
56
|
|
57
|
+
def debug?
|
58
|
+
savon.globals[:logger].debug?
|
59
|
+
end
|
60
|
+
|
56
61
|
def call_service(request_body, locals = {})
|
57
62
|
request = build_request
|
58
63
|
request.body = request_body
|
64
|
+
if debug?
|
65
|
+
savon.globals[:logger].debug request.body
|
66
|
+
end
|
59
67
|
response = Savon::Response.new(HTTPI.post(request), savon.globals, locals)
|
68
|
+
if response.http_error
|
69
|
+
fail "Bad HTTP response: #{response.http_error}"
|
70
|
+
end
|
71
|
+
if debug?
|
72
|
+
savon.globals[:logger].debug response.hash.pretty_inspect
|
73
|
+
end
|
60
74
|
response
|
61
75
|
end
|
62
76
|
|
@@ -31,8 +31,18 @@ module LexisNexisInstantAuthenticate
|
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
34
|
+
def camelize(term)
|
35
|
+
term.to_s.split('_').each_with_index.map do |w,idx|
|
36
|
+
if idx == 0
|
37
|
+
next w
|
38
|
+
else
|
39
|
+
next w.capitalize
|
40
|
+
end
|
41
|
+
end.join()
|
42
|
+
end
|
43
|
+
|
34
44
|
def to_xml
|
35
|
-
Gyoku.xml(request_body, key_converter: -> key { [NAMESPACE,
|
45
|
+
Gyoku.xml(request_body, key_converter: -> key { [NAMESPACE, camelize(key)].join(':') })
|
36
46
|
end
|
37
47
|
|
38
48
|
def request_body
|
@@ -50,4 +60,4 @@ module LexisNexisInstantAuthenticate
|
|
50
60
|
|
51
61
|
end
|
52
62
|
end
|
53
|
-
end
|
63
|
+
end
|
@@ -15,7 +15,9 @@ module LexisNexisInstantAuthenticate
|
|
15
15
|
age: nil_to_string(age),
|
16
16
|
gender: nil_to_string(gender),
|
17
17
|
ssn: nil_to_string(ssn),
|
18
|
-
address: nil_to_string(address)
|
18
|
+
address: nil_to_string(address),
|
19
|
+
email: nil_to_string(email),
|
20
|
+
license: nil_to_string(drivers_license)
|
19
21
|
}
|
20
22
|
}
|
21
23
|
}
|
@@ -23,7 +25,7 @@ module LexisNexisInstantAuthenticate
|
|
23
25
|
|
24
26
|
private
|
25
27
|
def name
|
26
|
-
{prefix:
|
28
|
+
{prefix: @person[:prefix], first: @person[:first_name], middle: @person[:middle_name], last: @person[:last_name], suffix: @person[:suffix]}
|
27
29
|
end
|
28
30
|
|
29
31
|
def date_of_birth
|
@@ -54,7 +56,18 @@ module LexisNexisInstantAuthenticate
|
|
54
56
|
}
|
55
57
|
end
|
56
58
|
|
59
|
+
def email
|
60
|
+
@person[:email]
|
61
|
+
end
|
57
62
|
|
63
|
+
def drivers_license
|
64
|
+
return "" unless @person[:drivers_license].present?
|
65
|
+
{
|
66
|
+
:@type => 'DRIVERS_LICENSE',
|
67
|
+
license_number: @person[:drivers_license][:number],
|
68
|
+
issuer: @person[:drivers_license][:state]
|
69
|
+
}
|
70
|
+
end
|
58
71
|
end
|
59
72
|
end
|
60
|
-
end
|
73
|
+
end
|
@@ -12,7 +12,7 @@ module LexisNexisInstantAuthenticate
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def proofing_response
|
15
|
-
@response.hash
|
15
|
+
h_dig(@response.hash, :envelope, :body, :invoke_identity_service_response, :identity_proofing_response)
|
16
16
|
end
|
17
17
|
|
18
18
|
def success?
|
@@ -23,11 +23,17 @@ module LexisNexisInstantAuthenticate
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def status
|
26
|
-
proofing_response
|
26
|
+
h_dig(proofing_response, :status)
|
27
27
|
end
|
28
28
|
|
29
29
|
def product_response
|
30
|
-
proofing_response
|
30
|
+
h_dig(proofing_response, :product_response)
|
31
|
+
end
|
32
|
+
|
33
|
+
def h_dig(hash, *path)
|
34
|
+
Array(path).inject(hash) do |location, key|
|
35
|
+
location.respond_to?(:keys) ? location[key] : nil
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
end
|
@@ -2,11 +2,11 @@ module LexisNexisInstantAuthenticate
|
|
2
2
|
module Resources
|
3
3
|
class Quiz < Base
|
4
4
|
def questions
|
5
|
-
product_response
|
5
|
+
h_dig(product_response, :questions, :question)
|
6
6
|
end
|
7
7
|
|
8
8
|
def id
|
9
|
-
product_response
|
9
|
+
h_dig(product_response, :questions, :"@ns:quiz_id")
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
@@ -6,15 +6,15 @@ module LexisNexisInstantAuthenticate
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def score
|
9
|
-
product_response
|
9
|
+
h_dig(product_response, :quiz_score)
|
10
10
|
end
|
11
11
|
|
12
12
|
def quiz_id
|
13
|
-
product_response
|
13
|
+
h_dig(product_response, :quiz_score, :"@ns:quiz_id")
|
14
14
|
end
|
15
15
|
|
16
16
|
def lex_id
|
17
|
-
product_response
|
17
|
+
h_dig(product_response, :"@ns:lex_id")
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lexis_nexis_instant_authenticate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Ostrowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
106
|
- ".travis.yml"
|
107
|
+
- CHANGELOG.md
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE.txt
|
109
110
|
- README.md
|