lib/tbkapi/api_taobaoke.rb in tbkapi-1.0.4 vs lib/tbkapi/api_taobaoke.rb in tbkapi-1.1.0

- old
+ new

@@ -31,12 +31,27 @@ params = system_params("taobao.tbk.uatm.favorites.item.get",api_key).merge(action_params) my_sign = get_sign(params, secret).upcase Net::HTTP.get(URI(TBURI + '?' + build_query(params.merge({sign: my_sign})))) end + def taobao_tbk_item_get_new(keyword, cat, sort, is_tmall, start_price, end_price, api_key, secret, page_no = 1, page_size = 20) + action_params = { + fields: "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick", + page_no: page_no, + page_size: page_size + } + action_params[:q] = keyword unless keyword.nil? + action_params[:cat] = cat unless cat.nil? + action_params[:sort] = sort unless sort.nil? + action_params[:is_tmall] = is_tmall unless is_tmall.nil? + action_params[:start_price] = start_price unless start_price.nil? + action_params[:end_price] = end_price unless end_price.nil? + params = system_params("taobao.tbk.item.get",api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(URI.encode((TBURI + '?' + build_query(params.merge({sign: my_sign})))))) + end - def taobao_tbk_item_get(keyword, api_key, secret, page_no = 1, page_size = 20) action_params = { fields: "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick", q: keyword, page_no: page_no, @@ -100,10 +115,26 @@ params = system_params("taobao.tbk.shop.get",api_key).merge(action_params) my_sign = get_sign(params, secret).upcase Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) end + def taobao_tbk_shop_get_new(q, api_key, secret, is_tmall = false, start_credit = 1, end_credit = 20, page_no = 1, page_size= 20) + action_params ={ + fields: "user_id,shop_title,shop_type,seller_nick,pict_url,shop_url", + q: q, + is_tmall: is_tmall, + start_credit: start_credit, + end_credit: end_credit, + page_no: page_no, + page_size: page_size, + sort: "total_auction_des" + } + params = system_params("taobao.tbk.shop.get",api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) + end + def taobao_ju_items_search(q, pid, api_key, secret) action_params ={ param_top_item_query: { pid: pid, word: q @@ -172,7 +203,56 @@ } params = system_params("taobao.tbk.dg.optimus.material", api_key).merge(action_params) my_sign = get_sign(params, secret).upcase Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) end + + def taobao_tbk_content_get(adzone_id, api_key, secret, type, before_time, count, cid, content_set) + action_params = { + adzone_id: adzone_id + } + action_params[:type] = type if type && type > 0 + action_params[:before_timestamp] = before_time if before_time && before_time > 0 + action_params[:count] = count if count && count > 0 + action_params[:cid] = cid if cid && cid > 0 + action_params[:content_set] = content_set if content_set && content_set > 0 + + params = system_params("taobao.tbk.content.get", api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) + end + + def taobao_tbk_shop_convert(adzone_id, api_key, secret, shop_id) + action_params = { + adzone_id: adzone_id, + fields: "user_id,click_url", + user_ids: shop_id + } + params = system_params("taobao.tbk.shop.convert", api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) + end + + def taobao_tbk_item_convert(adzone_id, api_key, secret, item_id) + action_params = { + adzone_id: adzone_id, + fields: "num_iid,click_url", + num_iids: item_id + } + params = system_params("taobao.tbk.item.convert", api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) + end + + def taobao_itemcats_get(parent_cid, cids, api_key, secret) + action_params = { + parent_cid: parent_cid, + fields: "cid,parent_cid,name,is_parent", + cids: cids + } + params = system_params("taobao.itemcats.get", api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + Net::HTTP.get(URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign}))))) + end + end end