lib/minitel/client.rb in minitel-0.2.0 vs lib/minitel/client.rb in minitel-0.3.0

- old
+ new

@@ -24,23 +24,35 @@ def notify_user(args) StrictArgs.enforce(args, [:user_uuid, :body, :title], :user_uuid) post_message('user', args[:user_uuid], args[:title], args[:body]) end + def add_followup(args) + StrictArgs.enforce(args, [:message_uuid, :body], :message_uuid) + followup = { body: args[:body] } + + post("/producer/messages/#{args[:message_uuid]}/followups", followup) + end + private def post_message(type, id, title, body) message = { title: title, body: body, target: {type: type, id: id} } + post("/producer/messages", message) + end + + def post(path, body) response = connection.post( - path: "/producer/messages", - body: MultiJson.dump(message), + path: path, + body: MultiJson.dump(body), expects: 201) MultiJson.load(response.body) end + end end