my_utils 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/my_utils/toputils.rb +8 -2
- metadata +2 -2
data/lib/my_utils/toputils.rb
CHANGED
@@ -9,7 +9,7 @@ require 'uri'
|
|
9
9
|
module Toputils
|
10
10
|
|
11
11
|
TOP_URL = 'http://gw.api.taobao.com/router/rest?'
|
12
|
-
SB_TOP_URL =
|
12
|
+
SB_TOP_URL = 'http://gw.api.tbsandbox.com/router/rest?'
|
13
13
|
STREAM_URL = "http://stream.api.taobao.com/stream"
|
14
14
|
SB_STREAM_URL = "http://stream.api.tbsandbox.com/stream"
|
15
15
|
|
@@ -31,7 +31,13 @@ module Toputils
|
|
31
31
|
params.each {
|
32
32
|
|k, v| params_str << k.to_s<<'='<<URI.escape(v.to_s).to_s<<'&'
|
33
33
|
}
|
34
|
-
|
34
|
+
if app_secret.start_with? "sandbox"
|
35
|
+
target = SB_TOP_URL
|
36
|
+
else
|
37
|
+
target = TOP_URL
|
38
|
+
end
|
39
|
+
target = target + params_str
|
40
|
+
#target = (app_secret.start_with?("sandbox") ? SB_TOP_URL : TOP_URL)+ params_str
|
35
41
|
|
36
42
|
res = Net::HTTP.get_response(URI.parse(target))
|
37
43
|
res.body
|