Class: PostmanMta::AttachmentsController

Inherits:
ApplicationController show all
Includes:
ActionController::DataStreaming
Defined in:
app/controllers/postman_mta/attachments_controller.rb

Constant Summary

Constants inherited from ApplicationController

PostmanMta::ApplicationController::MODULES

Instance Method Summary collapse

Instance Method Details

#showObject



5
6
7
8
9
10
11
# File 'app/controllers/postman_mta/attachments_controller.rb', line 5

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