Class: GoodData::Bricks::FsProjectUploadMiddleware
- Inherits:
-
Middleware
- Object
- Middleware
- GoodData::Bricks::FsProjectUploadMiddleware
- Defined in:
- lib/gooddata/bricks/middleware/fs_upload_middleware.rb
Instance Attribute Summary
Attributes inherited from Middleware
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(options = {}) ⇒ FsProjectUploadMiddleware
constructor
A new instance of FsProjectUploadMiddleware.
Methods inherited from Middleware
Methods included from Utils
Constructor Details
#initialize(options = {}) ⇒ FsProjectUploadMiddleware
Returns a new instance of FsProjectUploadMiddleware.
12 13 14 15 |
# File 'lib/gooddata/bricks/middleware/fs_upload_middleware.rb', line 12 def initialize( = {}) super @destination = [:destination] end |
Instance Method Details
#call(params) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gooddata/bricks/middleware/fs_upload_middleware.rb', line 17 def call(params) params = params.to_hash returning(@app.call(params)) do |_| destination = @destination (params['gdc_files_to_upload'] || []).each do |f| path = f[:path] case destination.to_sym when :staging GoodData.client.get '/gdc/account/token', dont_reauth: true url = GoodData.project_webdav_path GoodData.upload_to_project_webdav(path) GoodData.logger.info("Uploaded local file \"#{path}\" to url \"#{url + path}\"") end end end end |