fun fromHookUrl()

in src/main/kotlin/org/jetbrains/teamcity/github/HookKey.kt [17:31]


        fun fromHookUrl(hookUrl: String): HookKey {
            val split = ArrayDeque(hookUrl.split('/'))
            assert(split.size >= 8)
            val id = split.pollLast().toLong()
            split.pollLast() // "hooks"
            val name = split.pollLast()
            val owner = split.pollLast()
            split.pollLast() // "repos"
            val serverOfV3 = split.pollLast()
            val server = if (serverOfV3 == "api.github.com")  "github.com" else {
                split.pollLast()
                split.pollLast()
            }
            return HookKey(server, owner, name, id)
        }