Class: FoxycartHelpers::ProductVerification
- Inherits:
-
Object
- Object
- FoxycartHelpers::ProductVerification
- Defined in:
- lib/foxycart_helpers/product_verification.rb
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #encode ⇒ Object
- #encoded_name ⇒ Object
-
#initialize(code, name, value) ⇒ ProductVerification
constructor
A new instance of ProductVerification.
Constructor Details
#initialize(code, name, value) ⇒ ProductVerification
Returns a new instance of ProductVerification.
30 31 32 33 34 |
# File 'lib/foxycart_helpers/product_verification.rb', line 30 def initialize(code, name, value) @code = code @name = name @value = value end |
Class Method Details
.encode(*args) ⇒ Object
6 7 8 |
# File 'lib/foxycart_helpers/product_verification.rb', line 6 def self.encode(*args) new(*args).encode end |
.encoded_name(*args) ⇒ Object
10 11 12 |
# File 'lib/foxycart_helpers/product_verification.rb', line 10 def self.encoded_name(*args) new(*args).encoded_name end |
Instance Method Details
#config ⇒ Object
26 27 28 |
# File 'lib/foxycart_helpers/product_verification.rb', line 26 def config FoxycartHelpers.configuration end |
#encode ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/foxycart_helpers/product_verification.rb', line 14 def encode digest = OpenSSL::Digest.new 'sha256' key = config.api_key data = @code + @name + @value OpenSSL::HMAC.hexdigest digest, key, data end |
#encoded_name ⇒ Object
22 23 24 |
# File 'lib/foxycart_helpers/product_verification.rb', line 22 def encoded_name @value + '||' + encode end |