class GitApiHelper {

  public URI buildDownloadURI(final URI gitRepositoryUri, @Nullable final String ref)
  {
    GitArtifactInfo info = GitRepoUriParser.parseGitRepoUri(gitRepositoryUri, ref);

    GitProviderConfig config = prepareConfig(info.getHost());

    String downloadLink = String.format(
        config.template,
        config.apiUri,
        info.getVendor(),
        info.getRepository(),
        info.getRef() != null ? info.getRef() : config.defaultBranch);

    return URI.create(downloadLink);
  }

  @Inject public  GitApiHelper(
      @Named("${nexus.cocoapods.gitHubApiUri:-https://api.github.com}") final String githubApiUri,
      @Named("${nexus.cocoapods.bitbucketApiUri:-https://bitbucket.org}") final String bitbucketApiUri,
      @Named("${nexus.cocoapods.gitlabApiUri:-https://gitlab.com}") final String gitlabApiUri);

}