问题
I'm looking at the Dropbox SDK for the Ruby platform http://www.dropbox.com/developers/start/setup#ruby, trying to figure out how to use APIs
from my Users/myname directory on my Mac, I did gem install dropbox-sdk
It's supposed to come with some example files to play around with
web_file_browser.rb is an example web app that lets you browse and upload files to Dropbox.
It also says
For ease of compatibility, these examples reference a local copy of the library you installed with RubyGems, located in lib/dropbox_sdk.rb.
1) What folder do I have to be to test these sample files?
2) After I get my app key, how do I run a sample file to test uploading?
3) should I in theory have been able to run this sample file from a Rails application?
回答1:
Solutions:
1) What folder do I have to be to test these sample files?
Soln: You have to be in the directory where these files are located.e.g On my machine, it is
jatin@silverSpoon:/media/silverSpoon/dropbox-app/dropbox-ruby-sdk-1.1$ ls
CHANGELOG cli_example.rb dropbox_controller.rb gemspec.rb lib LICENSE README web_file_browser.rb
So, you have to be in dropbox-ruby-sdk-1.1
folder to test these sample files.
2) After I get my app key, how do I run a sample file to test uploading?
Soln: Go through this Ruby Setup with Dropbox API again. It's written that:
To get these examples running, you'll need to edit each script(.rb file) to enter your app key and app secret where indicated. Also make sure that the access type is set to :app_folder or :dropbox as configured for your app. After this, simply run ruby script.rb and you are done.
3) should I in theory have been able to run this sample file from a Rails application?
Soln: Yes, why not. I'd advise you to play around with the sample Sinatra app, get used to the API and then move onto Rails.
来源:https://stackoverflow.com/questions/8516429/getting-started-with-dropbox-sdk