淘宝 SDK
Add this line to your application's Gemfile:
gem 'taobao', :git => "git:https://github.com/lg2046/taobao.git"
And then execute:
$ bundle or bundle update
Or install it yourself as:
$ gem install taobao
Rails设置
在Rails.root/config/taobao.yml进行配置
development:
key: '1012673352'
secret: 'sandbox0dc60e65912c69db3c1cff70f'
OAuth 2 认证
Taobao::TopAuth.container_url
OAuth 回调:
parse_hash = Taobao::TopAuth.parseTopResponse(params[:top_parameters], params[:top_session], params[:top_sign])
解析出如下hash值: { :visitor_id :visitor_nick :session_key :session_expire_in :refresh_token :refresh_token_expire_in }
如无法解析返回nil
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request