~/Dropbox/a.txt
に相当するファイルを、APIを使って読み出す手順です。
- https://www.dropbox.com/developers/apps にアクセスして create app クリック
- dropbox API app 選択
- Can your app be limited to its own folder? (アプリ専用フォルダを作るか?) → No
- What type of files does your app need access to? (アクセスしたいファイル) → All file types
- アプリ名入力
- create クリック
- OAuth2 の Generate access token の Generate をクリックして表示されたのをコピー
-
gem install dropbox-sdk
実行 (dropbox-sdkは公式のgem) - 以下実行
require "dropbox_sdk"
client = DropboxClient.new("7でコピーしたトークン")
p client.get_file("/a.txt")