Class: Moneybookers::Signature::Base
- Inherits:
-
Object
- Object
- Moneybookers::Signature::Base
- Defined in:
- lib/moneybookers/signature/base.rb
Instance Attribute Summary collapse
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#secret_word_md5 ⇒ Object
Returns the value of attribute secret_word_md5.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #match?(signature) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 |
# File 'lib/moneybookers/signature/base.rb', line 7 def initialize(params={}) self.merchant_id = params.fetch(:merchant_id, Moneybookers.merchant_id) || raise(ArgumentError, "No merchant_id given") self.secret_word_md5 = params.fetch(:secret_word_md5, Moneybookers.secret_word_md5) || raise(ArgumentError, "No secret_word_md5 given") self.transaction_id = params[:transaction_id] || raise(ArgumentError, "No transaction_id given") end |
Instance Attribute Details
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
5 6 7 |
# File 'lib/moneybookers/signature/base.rb', line 5 def merchant_id @merchant_id end |
#secret_word_md5 ⇒ Object
Returns the value of attribute secret_word_md5.
5 6 7 |
# File 'lib/moneybookers/signature/base.rb', line 5 def secret_word_md5 @secret_word_md5 end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
5 6 7 |
# File 'lib/moneybookers/signature/base.rb', line 5 def transaction_id @transaction_id end |
Instance Method Details
#match?(signature) ⇒ Boolean
17 18 19 |
# File 'lib/moneybookers/signature/base.rb', line 17 def match?(signature) to_s == signature end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/moneybookers/signature/base.rb', line 13 def to_s Digest::MD5.hexdigest(params.join).upcase end |