class OmniAuth::Strategies::Jd

Public Instance Methods

raw_info() click to toggle source
# File lib/omniauth/strategies/jd.rb, line 32
def raw_info
  access_token.options[:mode] = :query
  @raw_info ||= access_token.get('http://gw.api.360buy.com/routerjson', params: signed_params, parse: :json).parsed['jingdong_vender_shop_query_responce']['shop_jos_result'] rescue {}
end

Private Instance Methods

params() click to toggle source
# File lib/omniauth/strategies/jd.rb, line 39
def params
  {
    method: 'jingdong.vender.shop.query',
    access_token: access_token.token,
    app_key: client.id,
    timestamp: timestamp,
    v: '2.0'
  }
end
signed_params() click to toggle source
# File lib/omniauth/strategies/jd.rb, line 49
def signed_params
   rand = client.secret + params.sort.flatten.join + client.secret
  token = Digest::MD5.hexdigest(rand).upcase
  params.merge(sign: token)# 數字簽名
end
timestamp() click to toggle source
# File lib/omniauth/strategies/jd.rb, line 55
def timestamp # 时间戳
  Time.now.strftime("%Y-%m-%d %H:%M:%S")
end