Module: Topsdk

Defined in:
lib/topsdk.rb,
lib/topsdk/client.rb,
lib/topsdk/version.rb

Defined Under Namespace

Classes: Client

Constant Summary collapse

VERSION =
'0.0.7'

Class Method Summary collapse

Class Method Details

.authorize_urlObject



53
54
55
# File 'lib/topsdk.rb', line 53

def authorize_url
  "#{ENV['TAOBAO_AUTH_URL']}?appkey=#{ENV['TAOBAO_APP_KEY']}&encode=utf-8"
end

.date(datetime) ⇒ Object



45
46
47
# File 'lib/topsdk.rb', line 45

def date(datetime)
  datetime.strftime("%Y-%m-%d 00:00:00")
end

.get_with(joined_params = {}) ⇒ Object



33
34
35
# File 'lib/topsdk.rb', line 33

def get_with(joined_params = {})
  Client.new(joined_params).get
end

.nowObject



41
42
43
# File 'lib/topsdk.rb', line 41

def now
  get_with({:method => 'taobao.time.get'})['time']
end

.post_with(joined_params = {}) ⇒ Object



37
38
39
# File 'lib/topsdk.rb', line 37

def post_with(joined_params = {})
  Client.new(joined_params).post
end

.time(datetime) ⇒ Object



49
50
51
# File 'lib/topsdk.rb', line 49

def time(datetime)
  datetime.strftime("%Y-%m-%d %H:%M:%S")
end