Sha256: 8a0719bc96bae47f2a21215d8ed0447784cb644f4c580434d1583d31b7a7237a

Contents?: true

Size: 1.09 KB

Versions: 29

Compression:

Stored size: 1.09 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative 'base_middleware'

module GoodData
  module Bricks
    class FsProjectUploadMiddleware < Bricks::Middleware
      def initialize(options = {})
        super
        @destination = options[:destination]
      end

      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)
              puts "Uploaded local file \"#{path}\" to url \"#{url + path}\""
            end
          end
        end
      end
    end
    FsUploadMiddleware = FsProjectUploadMiddleware
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
gooddata-0.6.30 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.29 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.28 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.27 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.26 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.25 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.24 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.23 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.22 lib/gooddata/bricks/middleware/fs_upload_middleware.rb