Sha256: 6a57c71842e12ddbb10217772b5334dcd5ff5ab30c9766fb931a118ea60032d6
Contents?: true
Size: 971 Bytes
Versions: 2
Compression:
Stored size: 971 Bytes
Contents
module DropboxUtility module Session def self.retrieve File.open(DropboxUtility::Config::AUTH_FILE, 'r') do |f| DropboxSession::deserialize(f.read) end end def self.save(session) File.open(DropboxUtility::Config::AUTH_FILE, 'w') do |f| f.write session.serialize end end def self.exists? File.exists?(DropboxUtility::Config::AUTH_FILE) end def self.create session = DropboxSession.new(DropboxUtility::Config::APP_KEY, DropboxUtility::Config::APP_SECRET) session.get_request_token authorize_url = session.get_authorize_url("") Launchy.open(authorize_url) puts "After authorizing the application, press the 'Enter' key." STDIN.gets begin session.get_access_token puts "Authorization successful. Saving session..." save(session) session rescue Exception => e abort e.message end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dropbox-utility-0.0.5 | lib/dropbox_utility/session.rb |
dropbox-utility-0.0.4 | lib/dropbox_utility/session.rb |