Class: Interapp::MessagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/interapp/messages_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/interapp/messages_controller.rb', line 3

def create
  service = Interapp::ReceiveMessageService.new(
    payload: request.body.read,
    peer_identifier: request.headers["X-Interapp-Identifier"],
    signature: request.headers["X-Interapp-Signature"]
  )
  service.perform
  output = service.return_value || { received_at: Time.now.to_i }
  render json: output
end