class Ruboty::Ss::Storage::Dropbox

Public Instance Methods

access_token() click to toggle source
# File lib/ruboty/ss/storage/dropbox.rb, line 22
def access_token
  ENV['RUBOTY_SS_DROPBOX_ACCESS_TOKEN']
end
client() click to toggle source
# File lib/ruboty/ss/storage/dropbox.rb, line 26
def client
  DropboxClient.new(access_token)
end
upload(image_file, options) click to toggle source
# File lib/ruboty/ss/storage/dropbox.rb, line 11
def upload(image_file, options)
  response = client.put_file(options[:path], image_file)
  sleep 0.5 # FIXME
  shares = client.shares(response['path'])
  sleep 0.5 # FIXME
  uri = OpenURI.open_uri(shares['url'])
  URI.join(uri.base_uri.to_s, '?dl=1').to_s
rescue => e
  e.message
end