Class: Moneybookers::Signature::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/moneybookers/signature/base.rb

Direct Known Subclasses

SecureUrl, Status

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject

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_md5Object

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_idObject

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/moneybookers/signature/base.rb', line 17

def match?(signature)
  to_s == signature
end

#to_sObject



13
14
15
# File 'lib/moneybookers/signature/base.rb', line 13

def to_s
  Digest::MD5.hexdigest(params.join).upcase
end