mirror of
https://github.com/wahyd4/ocelots.git
synced 2026-08-22 19:37:15 +10:00
added api method to post a new antechamber message
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user