Dropbox Ruby API
我想使用 Dropbox Ruby API,我安装了 gem,当我想创建 Dropbox 会话时,我收到此消息:
未初始化常量 DropboxController::Dropbox
如果我想使用此 api,除了安装 gem 之外,还有什么要做吗?
代码是:
def authorize
if params[:oauth_token] then
dropbox_session = Dropbox::Session.deserialize(session[:dropbox_session])
dropbox_session.authorize(params)
session[:dropbox_session] = dropbox_session.serialize # re-serialize the authenticated session
redirect_to :action => 'upload'
else
dropbox_session = Dropbox::Session.new('your_consumer_key', 'your_consumer_secret')
session[:dropbox_session] = dropbox_session.serialize
redirect_to dropbox_session.authorize_url(:oauth_callback => url_for(:action => 'authorize'))
end
end
I want to use Dropbox Ruby API, I installed the gem and when I want to create a dropbox session I got this message:
uninitialized constant DropboxController::Dropbox
Is there anything to do if I want to use this api except install the gem?
The code is:
def authorize
if params[:oauth_token] then
dropbox_session = Dropbox::Session.deserialize(session[:dropbox_session])
dropbox_session.authorize(params)
session[:dropbox_session] = dropbox_session.serialize # re-serialize the authenticated session
redirect_to :action => 'upload'
else
dropbox_session = Dropbox::Session.new('your_consumer_key', 'your_consumer_secret')
session[:dropbox_session] = dropbox_session.serialize
redirect_to dropbox_session.authorize_url(:oauth_callback => url_for(:action => 'authorize'))
end
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个不适合 ruby 的 Rails 控制器。
对于 ruby,您可以参考此教程,这里是Ruby 的文档
This is a rails controller not for ruby.
For ruby you may refer to this tutorial and here is the DOCs for Ruby
需要当前文件中的 dropbox 文件。
Require the dropbox file in your current file.