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.
Files changed (2) hide show
  1. data/lib/my_utils/toputils.rb +4 -3
  2. metadata +2 -2
@@ -9,8 +9,9 @@ require 'uri'
9
9
  module Toputils
10
10
 
11
11
  TOP_URL = 'http://gw.api.taobao.com/router/rest?'
12
- STREAM_URL = "http://stream.api.taobao.com/stream"
13
- SB_STREAM_URL = "http://stream.api.tbsandbox.com/stream"
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Quaranto