Class: Cybersourcery::SignatureChecker
- Inherits:
-
Object
- Object
- Cybersourcery::SignatureChecker
- Defined in:
- lib/cybersourcery/signature_checker.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ SignatureChecker
constructor
A new instance of SignatureChecker.
-
#post_initialize(args) ⇒ Object
subclasses can override.
- #run ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ SignatureChecker
Returns a new instance of SignatureChecker.
5 6 7 8 9 |
# File 'lib/cybersourcery/signature_checker.rb', line 5 def initialize(args = {}) @profile = args[:profile] @params = args[:params] post_initialize(args) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/cybersourcery/signature_checker.rb', line 3 def params @params end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
3 4 5 |
# File 'lib/cybersourcery/signature_checker.rb', line 3 def profile @profile end |
Instance Method Details
#post_initialize(args) ⇒ Object
subclasses can override
12 13 14 |
# File 'lib/cybersourcery/signature_checker.rb', line 12 def post_initialize(args) nil end |
#run ⇒ Object
16 17 18 |
# File 'lib/cybersourcery/signature_checker.rb', line 16 def run signature == Cybersourcery::CybersourceSigner::Signer.signature(, @profile.secret_key) end |
#run! ⇒ Object
20 21 22 |
# File 'lib/cybersourcery/signature_checker.rb', line 20 def run! raise Cybersourcery::CybersourceryError, 'Detected possible data tampering. Signatures do not match.' unless run end |