Project

top4r

0.04
No commit activity in last 3 years
No release in over 3 years
TOP4R is a library that can help you build plugin for TaoBao.com quickly in pure Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.1.1
 Project Readme

Top4R

Top4R封装了 淘宝开放平台 的接口,帮助你快速构建基于TOP的应用程序。 目前支持了以下API:

  • 商品
  • 物流
  • 店铺
  • 收费
  • 淘宝客
  • 交易
  • 用户

Get Started

配置:

Top4R::Client.configure do |conf|
	conf.application_name = 'App Name'
	conf.application_version = "1.0.0"
	conf.application_url = 'http//www.example.com'
	conf.test_host = "api.daily.taobao.net"
	conf.env = ((ENV['RAILS_ENV'] != 'development' or force_production) ? :production : :test)
	conf.logger = Rails.logger
	conf.trace = (ENV['RAILS_ENV'] != 'production')
end

创建一个Top4r::Client:

$top = Top4R::Client.new(
      :app_key => 'api_key',
      :app_secret => 'api_secret',
      :parameters => nil,
      :session => nil
    )

获取指定id的商品信息:

item = $top.item(item_id)

自定义返回字段:

item = $top.item(item_id, {:fields => [:title, :price, :cid].join(',))

更多文档请到这里查看:

http://rubydoc.info/gems/top4r/0.2.3/frames

BY

Nowa Zhu (nowazhu@gmail.com)

http://nowa.me

Thanks Twitter4R <http://twitter4r.rubyforge.org>.

2009-06-22