class RequestTokenGenerator

The main RequestTokenGenerator driver

Public Class Methods

generate(hash = {}) click to toggle source

Generates token and appends to current hash.

@param hash [Hash] the hash with request parameters. @return [Hash] the hash parameter with added token string.

# 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) click to toggle source

Set secret key

@param secret_key [String] the secret key string. @return nil

# File lib/request_token_generator.rb, line 19
def self.set_secret(secret_key)
        @secret_key = secret_key
end