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
12
13
14
15
# 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)
  raise(PostmanMta::RecordNotFound, "Attachment via id #{params[:uuid]} not found") unless file

  if file[:body].present?
    send_attachment(file)
  else
    proxy_attachment(file)
  end
end