my_utils 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/my_utils/toputils.rb +4 -3
- metadata +2 -2
data/lib/my_utils/toputils.rb
CHANGED
@@ -9,8 +9,9 @@ require 'uri'
|
|
9
9
|
module Toputils
|
10
10
|
|
11
11
|
TOP_URL = 'http://gw.api.taobao.com/router/rest?'
|
12
|
-
|
13
|
-
|
12
|
+
SB_TOP_URL = "http://gw.api.tbsandbox.com/router/rest?"
|
13
|
+
STREAM_URL = "http://stream.api.taobao.com/stream"
|
14
|
+
SB_STREAM_URL = "http://stream.api.tbsandbox.com/stream"
|
14
15
|
|
15
16
|
def self.top_get(app_key, app_secret, opts = {})
|
16
17
|
params = {
|
@@ -30,7 +31,7 @@ module Toputils
|
|
30
31
|
params.each {
|
31
32
|
|k, v| params_str << k.to_s<<'='<<URI.escape(v.to_s).to_s<<'&'
|
32
33
|
}
|
33
|
-
target = TOP_URL + params_str
|
34
|
+
target = app_secret.start_with? "sandbox"? SB_TOP_URL : TOP_URL + params_str
|
34
35
|
|
35
36
|
res = Net::HTTP.get_response(URI.parse(target))
|
36
37
|
res.body
|