Sha256: e649122116ac09ba9222b1bde4223180c052c466936a0f4819f5baa1d02c190e
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
Douban ====== A Ruby wrapper for Douban(豆瓣) API, Rails 3 support only. Install ======= $ gem install douban Usage ======= 1. Add below lines to your Gemfile: gem 'douban', :require => 'oauth' require 'douban' 2. Run generator $ script/rails generate douban 3. Set you api key and secret in config/douban.yml, and include DoubanHelper in your ApplicationController: class ApplicationController include DoubanHelper end 4. Then you can insert below lines into your application layout <% if douban_authorized? %> <%= link_to 'Logout From Douban', douban_logout_path %> <% else %> <%= link_to "Login with douban", douban_login_path %> <% end %> Other available helpers: * douban_auth_or_login_required, it's useful if you use RESTFUL_AUTH. * douban_auth_required, you can add it to before_filter. 5. To access douban resources, you can simple call: douban.get('/people/ahbei') douban.post('/reviews', review) 6. To determine if your have authorized by user, simple call: douban.authorized? => true # if your access token is valid. Feedback are always welcome, Yuanyi Zhang(zhangyuanyi#gmail.com)
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
douban-rails2.3-0.7.0 | README |
douban-rails2.3-0.6.5 | README |
douban-rails2.3-0.6.4 | README |
douban-0.1.0 | README |