class UniversalGitClient::Client

Attributes

http_client[R]
provider[R]

Public Class Methods

new(provider, http_client) click to toggle source
# File lib/universal-git-client/client.rb, line 12
def initialize(provider, http_client)
  @provider = provider
  @http_client = http_client
end

Public Instance Methods

branch(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 47
def branch(*args)
  response = http_client.branch(*args)
  normalize(response, :Branch)
end
branches(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 42
def branches(*args)
  response = http_client.branches(*args)
  normalize(response, :Branch)
end
delete_repo_webhook(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 61
def delete_repo_webhook(*args)
  http_client.delete_repo_webhook(*args)
end
download_repo_archive(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 52
def download_repo_archive(*args)
  http_client.download_repo_archive(*args)
end
orga_repos(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 32
def orga_repos(*args)
  response = http_client.orga_repos(*args)
  normalize(response, :Repository)
end
organizations(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 22
def organizations(*args)
  response = http_client.organizations(*args)
  normalize(response, :Organization)
end
repository(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 37
def repository(*args)
  response = http_client.repository(*args)
  normalize(response, :Repository)
end
setup_repo_webhook(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 56
def setup_repo_webhook(*args)
  response = http_client.setup_repo_webhook(*args)
  normalize(response, :Webhook)
end
user() click to toggle source
# File lib/universal-git-client/client.rb, line 17
def user
  response = http_client.user
  normalize(response, :User)
end
user_repos(*args) click to toggle source
# File lib/universal-git-client/client.rb, line 27
def user_repos(*args)
  response = http_client.user_repos(*args)
  normalize(response, :Repository)
end

Private Instance Methods

normalize(response, resource) click to toggle source
# File lib/universal-git-client/client.rb, line 67
def normalize(response, resource)
  normalizer = UniversalGitClient.const_get("Normalizers::#{http_client.class.name.demodulize}")
  normalized = normalizer.new(response, resource).normalize
  normalized.serializable_hash
end