Sha256: 55b08a91c368efa3dd1f78325f0b9ef8fbf4d491a168f2cffb8f03df7a95ce8b
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
# frozen_string_literal: true require 'universal-git-client/normalizers/github' require 'universal-git-client/normalizers/gitlab' require 'universal-git-client/normalizers/bitbucket' require 'universal-git-client/normalizers/bitbucket_server' module UniversalGitClient class Client attr_reader :provider, :http_client def initialize(provider, http_client) @provider = provider @http_client = http_client end def user response = http_client.user normalize(response, :User) end def organizations(**args) response = http_client.organizations(**args) normalize(response, :Organization) end def user_repos(**args) response = http_client.user_repos(**args) normalize(response, :Repository) end def orga_repos(**args) response = http_client.orga_repos(**args) normalize(response, :Repository) end def repository(**args) response = http_client.repository(**args) normalize(response, :Repository) end def branches(**args) response = http_client.branches(**args) normalize(response, :Branch) end def branch(**args) response = http_client.branch(**args) normalize(response, :Branch) end def download_repo_archive(**args) http_client.download_repo_archive(**args) end def setup_repo_webhook(**args) response = http_client.setup_repo_webhook(**args) normalize(response, :Webhook) end def delete_repo_webhook(**args) http_client.delete_repo_webhook(**args) end private def normalize(response, resource) normalizer = UniversalGitClient.const_get("Normalizers::#{http_client.class.name.demodulize}") normalized = normalizer.new(response, resource).normalize normalized.serializable_hash end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
universal-git-client-2.2.0 | lib/universal-git-client/client.rb |
universal-git-client-2.1.0 | lib/universal-git-client/client.rb |
universal-git-client-2.0.0 | lib/universal-git-client/client.rb |