Class: OgoneRails::StringToHash
- Inherits:
-
Object
- Object
- OgoneRails::StringToHash
- Defined in:
- lib/ogone-rails/string-to-hash.rb
Instance Attribute Summary collapse
-
#sha_in_phrase ⇒ Object
Returns the value of attribute sha_in_phrase.
Instance Method Summary collapse
- #add_parameter(key, value) ⇒ Object
- #generate_sha_in ⇒ Object
- #generate_sha_out ⇒ Object
-
#initialize ⇒ StringToHash
constructor
A new instance of StringToHash.
-
#reset ⇒ Object
unused since Module transformed to Class.
Constructor Details
#initialize ⇒ StringToHash
Returns a new instance of StringToHash.
5 6 7 8 |
# File 'lib/ogone-rails/string-to-hash.rb', line 5 def initialize @params = {} @sha_in_phrase = "" end |
Instance Attribute Details
#sha_in_phrase ⇒ Object
Returns the value of attribute sha_in_phrase.
3 4 5 |
# File 'lib/ogone-rails/string-to-hash.rb', line 3 def sha_in_phrase @sha_in_phrase end |
Instance Method Details
#add_parameter(key, value) ⇒ Object
10 11 12 |
# File 'lib/ogone-rails/string-to-hash.rb', line 10 def add_parameter key, value @params[key.upcase] = value end |
#generate_sha_in ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ogone-rails/string-to-hash.rb', line 14 def generate_sha_in @params.sort.each do |key, value| @sha_in_phrase << "#{key.upcase}=#{value}#{OgoneRails::sha_in}" end Digest::SHA1.hexdigest(@sha_in_phrase).upcase end |
#generate_sha_out ⇒ Object
22 23 24 |
# File 'lib/ogone-rails/string-to-hash.rb', line 22 def generate_sha_out end |
#reset ⇒ Object
unused since Module transformed to Class
27 28 29 30 |
# File 'lib/ogone-rails/string-to-hash.rb', line 27 def reset @sha_in_phrase = "" @params = {} end |