TOP4R封装了淘宝开发平台的接口,帮助你快速构建基于TOP的应用程序。
Ruby
Latest commit 2de26b8 Jan 9, 2013 @nowa 修改README
Permalink
Failed to load latest commit information.
bin - Nov 15, 2011
config/templates 开始config module的编码 Jun 30, 2009
lib 0.2.3 Jan 9, 2013
spec first commit Jun 22, 2009
tasks 0.0.1 Sep 22, 2009
test Add encoding Sep 21, 2011
.gitignore gemspec fix Sep 14, 2011
CHANGES Merged with master Jan 9, 2013
MIT-LICENSE first commit Jun 22, 2009
README.md 修改README Jan 9, 2013
Rakefile 开始config module的编码 Jun 30, 2009
TODO first commit Jun 22, 2009
pkg-info.yml 0.0.1 Sep 22, 2009
top4r.gemspec Merged with master Jan 9, 2013
top4r.tmproj - Aug 4, 2011

README.md

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