This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
A Ruby wrapper for Douban(豆瓣) API, Rails 3 support only.
License
yzhang/douban
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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)
About
A Ruby wrapper for Douban(豆瓣) API, Rails 3 support only.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published