Class: Wayforpay::EncryptField
- Inherits:
-
Object
- Object
- Wayforpay::EncryptField
- Defined in:
- lib/wayforpay/encrypt_field.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(keys, attrs) ⇒ EncryptField
constructor
A new instance of EncryptField.
- #signature_string ⇒ Object
Constructor Details
#initialize(keys, attrs) ⇒ EncryptField
Returns a new instance of EncryptField.
7 8 9 |
# File 'lib/wayforpay/encrypt_field.rb', line 7 def initialize(keys, attrs) @keys, @attrs = keys, attrs end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
5 6 7 |
# File 'lib/wayforpay/encrypt_field.rb', line 5 def attrs @attrs end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
5 6 7 |
# File 'lib/wayforpay/encrypt_field.rb', line 5 def keys @keys end |
Class Method Details
.call(keys, attrs = {}) ⇒ Object
11 12 13 |
# File 'lib/wayforpay/encrypt_field.rb', line 11 def self.call(keys, attrs = {}) new(keys, attrs).call end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'lib/wayforpay/encrypt_field.rb', line 15 def call OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('md5'), Wayforpay.encrypt_secret_key, signature_string) end |
#signature_string ⇒ Object
19 20 21 |
# File 'lib/wayforpay/encrypt_field.rb', line 19 def signature_string attrs.values_at(*keys).compact.join(';') end |