Module: MasterCard::Security::Util

Extended by:
Util
Included in:
Util
Defined in:
lib/mastercard/security/util.rb

Instance Method Summary collapse

Instance Method Details

#getNonce(len = 16) ⇒ Object



38
39
40
41
42
# File 'lib/mastercard/security/util.rb', line 38

def getNonce(len = 16)
  # Returns a random string of length=len
  o = [('a'..'z'), ('A'..'Z'), (0..9)].map { |i| i.to_a }.flatten
  return (0...len).map { o[rand(o.length)] }.join
end

#getTimestampObject



32
33
34
35
36
# File 'lib/mastercard/security/util.rb', line 32

def getTimestamp()
  #
  # Returns the UTC timestamp (seconds passed since epoch)
  return Time.now.getutc.to_i
end