added api method to post a new antechamber message

This commit is contained in:
Mark Ryall
2012-11-06 18:23:14 +10:00
parent 11915d2849
commit 3859360afc
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -82,3 +82,8 @@ To request the message contents of the antechamber for a team (with an optional
export TEAM_SLUG=ateam
curl "$OCELOTS_URL/api/antechamber/$TEAM_SLUG?auth_token=$OCELOTS_AUTH_TOKEN"
curl "$OCELOTS_URL/api/antechamber/$TEAM_SLUG?auth_token=$OCELOTS_AUTH_TOKEN&from=23"
To add a new message:
export TEAM_SLUG=ateam
curl -d '{"content":"message"}' "$OCELOTS_URL/api/antechamber/$TEAM_SLUG?auth_token=$OCELOTS_AUTH_TOKEN"
@@ -12,5 +12,17 @@ module Api
end
render json: messages.map(&:api_attributes)
end
def create
message = nil
with_team do |team|
message = Message.create team: team, person: current_person, content: params[:content]
end
if message and message
render status: :created, json: message.api_attributes
else
render status: :unprocessable_entity
end
end
end
end