Sha256: 6e745f699278f6b05b1bbdc217373a1b6c9deb338c369c62681de46134b74313

Contents?: true

Size: 531 Bytes

Versions: 6

Compression:

Stored size: 531 Bytes

Contents

module PostmanMta
  class AttachmentsController < ApplicationController
    include ActionController::DataStreaming

    def show
      response = attachment.find(params[:uuid]).deep_symbolize_keys
      file = response.dig(:json, :attachment)
      file_data = Base64.decode64(file[:body])

      send_data(file_data, type: file[:content_type], filename: file[:filename], dispostion: 'attachment')
    end

    private

    def attachment
      @attachment ||= PostmanMta::Attachment.new(params[:message_token])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
postman_mta-0.1.9 app/controllers/postman_mta/attachments_controller.rb
postman_mta-0.1.8 app/controllers/postman_mta/attachments_controller.rb
postman_mta-0.1.7 app/controllers/postman_mta/attachments_controller.rb
postman_mta-0.1.6 app/controllers/postman_mta/attachments_controller.rb
postman_mta-0.1.5 app/controllers/postman_mta/attachments_controller.rb
postman_mta-0.1.4 app/controllers/postman_mta/attachments_controller.rb