Sha256: eccaadc7d8b0b504b802c77a2c2649b63ff5d7db50a7b13f6779c0c7f0e0f749

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

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

require_relative 'base_middleware'

module GoodData::Bricks
  class FsUploadMiddleware < GoodData::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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gooddata-0.6.0 lib/gooddata/bricks/middleware/fs_upload_middleware.rb