Sha256: 61a0315c090e02665c0e1915ba8808da85cd95d2656b95360c8b78788ab90400

Contents?: true

Size: 791 Bytes

Versions: 27

Compression:

Stored size: 791 Bytes

Contents

class Marty::JobController < ActionController::Base
  def download
    job_id = params["job_id"]

    promise = Marty::Promise.find_by_id(job_id)

    if promise
      format = promise.cformat

      # Force result so finalized object is built
      data = promise.result(true)

      # somewhat hacky: if result has "result" key, it's used as the
      # content.
      data = data["result"] || data
      title = promise.title
    else
      format = "json"
      data = {error: "Job not found: #{job_id}"}
      title = "error"
    end

    res, type, disposition, filename =
      Marty::ContentHandler.export(data, format, title)

    send_data(res,
              type:        type,
              filename:    filename,
              disposition: disposition,
              )
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
marty-2.5.2 app/controllers/marty/job_controller.rb
marty-2.5.1 app/controllers/marty/job_controller.rb
marty-2.5.0 app/controllers/marty/job_controller.rb
marty-2.4.9 app/controllers/marty/job_controller.rb
marty-2.4.8 app/controllers/marty/job_controller.rb
marty-2.4.7 app/controllers/marty/job_controller.rb
marty-2.4.6 app/controllers/marty/job_controller.rb
marty-2.4.5 app/controllers/marty/job_controller.rb
marty-2.4.4 app/controllers/marty/job_controller.rb
marty-2.4.3 app/controllers/marty/job_controller.rb
marty-2.4.2 app/controllers/marty/job_controller.rb
marty-2.4.1 app/controllers/marty/job_controller.rb
marty-2.4.0 app/controllers/marty/job_controller.rb
marty-2.3.15 app/controllers/marty/job_controller.rb
marty-2.3.14 app/controllers/marty/job_controller.rb
marty-2.3.13 app/controllers/marty/job_controller.rb
marty-2.3.12 app/controllers/marty/job_controller.rb
marty-2.3.11 app/controllers/marty/job_controller.rb
marty-2.3.10 app/controllers/marty/job_controller.rb
marty-2.3.9 app/controllers/marty/job_controller.rb