Class: DropboxExt::ItemsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DropboxExt::ItemsController
- Defined in:
- app/controllers/dropbox_ext/items_controller.rb
Instance Method Summary collapse
Instance Method Details
#dropbox ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/controllers/dropbox_ext/items_controller.rb', line 6 def dropbox if @dropbox return @dropbox end require 'dropbox' @dropbox = Dropbox::Client.new(params[:dbt]) end |
#sync ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/dropbox_ext/items_controller.rb', line 15 def sync items = params[:items] if items && items.length > 0 items.each do |item| dropbox.upload("/data/#{item[:content_type]}-#{item[:uuid]}.txt", "#{JSON.pretty_generate(item.as_json)}", {:mode => "overwrite"}) end end render :json => {:success => true} end |