unepwcmc/SAPI

View on GitHub
app/services/checklist/json/document.rb

Summary

Maintainability
A
0 mins
Test Coverage
# == Schema Information
#
# Table name: documents
#
#  id            :integer          not null, primary key
#  title         :text             not null
#  filename      :text             not null
#  date          :date             not null
#  type          :string(255)      not null
#  is_public     :boolean          default(FALSE), not null
#  event_id      :integer
#  language_id   :integer
#  legacy_id     :integer
#  created_by_id :integer
#  updated_by_id :integer
#  created_at    :datetime         not null
#  updated_at    :datetime         not null
#  number        :string(255)
#

module Checklist::Json::Document

  def ext
    'json'
  end

  def document
    File.open(@download_path, "wb") do |json|
      yield json
    end

    @download_path
  end

end