Class: OgoneRails::StringToHash

Inherits:
Object
  • Object
show all
Defined in:
lib/ogone-rails/string-to-hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStringToHash

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_phraseObject

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_inObject



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_outObject



22
23
24
# File 'lib/ogone-rails/string-to-hash.rb', line 22

def generate_sha_out
  
end

#resetObject

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