Sha256: f72ffce58d6d77eecb1eaf508277bad44ca37e5a7f22ae03d88cc723bd0304e1

Contents?: true

Size: 808 Bytes

Versions: 9

Compression:

Stored size: 808 Bytes

Contents

# encoding: UTF-8

require 'uri'
require 'net/http'
require 'pathname'

require_relative 'base_middleware'

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

      def call(params)
        returning(@app.call(params)) do |result|
          destination = @destination
          (params['gdc_files_to_upload'] || []).each do |f|
            path = f[:path]
            case destination.to_s
            when 'staging'
              url = GoodData.get_user_webdav_path(path)
              GoodData.upload_to_user_webdav(path)
              puts "Uploaded local file \"#{path}\" to url \"#{url + path}\""
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gooddata-0.6.10 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.9 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.8 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.7 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.6 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.5 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.4 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.3 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.2 lib/gooddata/bricks/middleware/fs_upload_middleware.rb