initial commit from appmail

This commit is contained in:
Adam Cooke
2017-04-19 13:07:25 +01:00
parent a3eff53792
commit 2fdba0ceb5
474 changed files with 51228 additions and 0 deletions
@@ -0,0 +1,40 @@
controller :messages do
friendly_name "Messages API"
description "This API allows you to access message details"
authenticator :server
action :message do
title "Return message details"
description "Returns all details about a message"
param :id, "The ID of the message", :type => Integer, :required => true
returns Hash, :structure => :message, :structure_opts => {:paramable => {:expansions => false}}
error 'MessageNotFound', "No message found matching provided ID", :attributes => {:id => "The ID of the message"}
action do
begin
message = identity.server.message(params.id)
rescue Postal::MessageDB::Message::NotFound => e
error 'MessageNotFound', :id => params.id
end
structure :message, message, :return => true
end
end
action :deliveries do
title "Return deliveries for a message"
description "Returns an array of deliveries which have been attempted for this message"
param :id, "The ID of the message", :type => Integer, :required => true
returns Array, :structure => :delivery, :structure_opts => {:full => true}
error 'MessageNotFound', "No message found matching provided ID", :attributes => {:id => "The ID of the message"}
action do
begin
message = identity.server.message(params.id)
rescue Postal::MessageDB::Message::NotFound => e
error 'MessageNotFound', :id => params.id
end
message.deliveries.map do |d|
structure :delivery, d
end
end
end
end