lib/tbkapi/api_taobaoke.rb in tbkapi-0.0.5 vs lib/tbkapi/api_taobaoke.rb in tbkapi-0.0.6

- old
+ new

@@ -21,11 +21,11 @@ def taobao_tbk_uatm_favorites_item_get(favorites_id, adzone_id, unid, api_key, secret, platform = 2,page_no = 1, page_size = 20) action_params = { adzone_id: adzone_id, unid: unid, favorites_id: favorites_id, - fields: "num_iid,title,pict_url,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick,shop_title,zk_final_price_wap,event_start_time,event_end_time,tk_rate,status,type,click_url", + fields: "num_iid,title,pict_url,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick,shop_title,zk_final_price_wap,event_start_time,event_end_time,tk_rate,status,type,click_url,status,category,coupon_click_url,coupon_end_time,coupon_info,coupon_start_time,coupon_total_count,coupon_remain_count", platform: platform, page_no: page_no, page_size: page_size } params = system_params("taobao.tbk.uatm.favorites.item.get",api_key).merge(action_params) @@ -35,11 +35,11 @@ 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", + fields: "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick,status,category,coupon_click_url,coupon_end_time,coupon_info,coupon_start_time,coupon_total_count,coupon_remain_count", q: keyword, page_no: page_no, page_size: page_size } params = system_params("taobao.tbk.item.get",api_key).merge(action_params) @@ -53,9 +53,24 @@ num_iids: ids.join(",") } params = system_params("taobao.tbk.items.detail.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_coupon_get(q, pid, api_key, secret) + action_params = { + q: q, + pid: pid + } + params = system_params("taobao.tbk.item.coupon.get",api_key).merge(action_params) + my_sign = get_sign(params, secret).upcase + if q.include?('//') + url = URI(TBURI + '?' + URI.escape(build_query(params.merge({sign: my_sign})),'/:?')) + else + url = URI(TBURI + '?' + URI.encode(build_query(params.merge({sign: my_sign})))) + end + Net::HTTP.get(url) end end end