Sha256: ae36560aa1ce0fe1f3ccb5c76e79b0d6c946627758dab81392b3071091df8f19
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
universal-git-client-1.2.4 | lib/universal-git-client/client.rb |