5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/diversion/encode/params.rb', line 5
def get_url(attrs, options)
sig = Signing::sign_data(options[:sign_key], options[:sign_length], attrs.to_param)
sig_param = ""
unless sig.empty?
sig_param = "&s=#{sig}"
end
params = CGI::escape(attrs.to_param)
unless options[:port] == 80
url = "#{options[:host]}:#{options[:port]}#{options[:path]}?d=#{params}#{sig_param}"
else
url = "#{options[:host]}#{options[:path]}?d=#{params}#{sig_param}"
end
url
end
|