Class: RequestTokenGenerator
- Inherits:
-
Object
- Object
- RequestTokenGenerator
- Defined in:
- lib/request_token_generator.rb
Overview
The main RequestTokenGenerator driver
Class Method Summary collapse
-
.generate(hash = {}) ⇒ Hash
Generates token and appends to current hash.
-
.set_secret(secret_key) ⇒ Object
Set secret key.
Class Method Details
.generate(hash = {}) ⇒ Hash
Generates token and appends to current hash.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/request_token_generator.rb', line 28 def self.generate(hash = {}) hash.each { |key, value| @post_string << "#{key}" << @kv_symbol << "#{value}" << @concat_symbol; } @post_string << "secret_key" + @kv_symbol << @secret_key @request_token = Digest::SHA1.hexdigest @post_string request_token_hash = Hash.new request_token_hash["request_token"] = @request_token return hash.merge(request_token_hash) end |
.set_secret(secret_key) ⇒ Object
Set secret key
19 20 21 |
# File 'lib/request_token_generator.rb', line 19 def self.set_secret(secret_key) @secret_key = secret_key end |