This repository was archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Proofer Gem
David Corwin edited this page Apr 16, 2018
·
1 revision
This gem provides a simple, straightforward interface to help vendors implement specific proofer logic within the requirements of the IdP.
The gem provides hooks so vendors can easily satisfy the interface by:
- specifying the required and optional applicant attributes (
first_name
,ssn
, etc...) - specifying the attributes that can be proofed, (
drivers_license_no
,bank_information
, etc...) - specifying the actual proofing logic
- returning a response in a predetermined format
# Inherit from the `Proofer::Base` class
class VendorProofer < Proofer::Base
# An array of symbols representing the applicant attributes needed by the vendor logic.
# These attributes are guaranteed to be present and not blank when provided to the proofer.
required_attributes :first_name, :last_name, :dob, :ssn
# An array of symbols representing the attributes to be proofed.
proofed_attributes :ssn
# The logic to actual perform the proofing. This can be provided as a block or a method name
# (as a symbol or string) that names an instance method. The logic will receive an applicant
# object containing the required attributes listed above.
#
# The logic **must** end by calling `completed` with the updated applicant or `error` with
# an error or description
proof do |applicant|
begin
modified_applicant = proofing_magic(applicant)
completed(modified_applicant)
# completed also accepts a second argument containing an array of information
# from the vendor ie:
# `completed(modified_applicant, 'first name is lame', 'dob is not valid')`
rescue Exception => e
error e
end
end
def proofing_magic(applicant) end;
end