This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# key is payfort passphrase request or response | |
def sign_with_key(params, key) | |
string_to_digest = params.sort { |a, b| a[0].upcase <=> b[0].upcase }.map { |k, v| "#{k}=#{v}" }.join() | |
string_to_digest = "#{key}#{string_to_digest}#{key}" | |
Digest::SHA256.hexdigest(string_to_digest) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alien | |
def can_talk_to?(character) | |
character.is_a?(Human) || character.is_a?(Alien) | |
end | |
end |