# This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
  robot.hear /who owns (.*)\?/i, (res) ->
    # Best guess of the intended application.
    application = res.match[1].replace(/\s/g, '-').toLowerCase()
    console.log("Fetching owner for #{application}")

    robot.http("https://docs.publishing.service.gov.uk/apps/#{application}.json")
      .get() (err, response, body) ->
        if response.statusCode == 200
          data = JSON.parse(body)
          res.reply "#{data.app_name} is owned by #{data.team}"

# This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
  robot.hear /who owns (.*)\?/i, (res) ->
    # Best guess of the intended application.
    application = res.match[1].replace(/\s/g, '-').toLowerCase()
    console.log("Fetching owner for #{application}")

    robot.http("https://docs.publishing.service.gov.uk/apps/#{application}.json")
      .get() (err, response, body) ->
        if response.statusCode == 200
          data = JSON.parse(body)
          res.reply "#{data.app_name} is owned by #{data.product_manager} (#{data.team})"

Update product ownership to refer to Product Manager
Update product ownership to refer to Product Manager

The current state of affairs is that products are owned by product owners, and products follow them when they change team.
The team information still seems useful so we leave it in.
