class UniversalGitClient::Http::Github
Public Instance Methods
branch(owner:, repo:, branch:)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 76 def branch(owner:, repo:, branch:) encoded_branch = URI.encode_www_form_component(branch) with_response_validation! do self.class.get( "/repos/#{owner}/#{repo}/branches/#{encoded_branch}", default_options ) end end
branches(owner:, repo:, page: 1, per_page: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 62 def branches(owner:, repo:, page: 1, per_page: nil) with_response_validation! do self.class.get( "/repos/#{owner}/#{repo}/branches", default_options.merge( query: { page: page, per_page: per_page || default_elements_per_page, }, ) ) end end
delete_repo_webhook(owner:, repo:, webhook_id:)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 114 def delete_repo_webhook(owner:, repo:, webhook_id:) with_response_validation! do self.class.delete( "/repos/#{owner}/#{repo}/hooks/#{webhook_id}", default_options ) end end
download_repo_archive(owner:, repo:, branch: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 86 def download_repo_archive(owner:, repo:, branch: nil) path = "#{base_url}/repos/#{owner}/#{repo}/zipball" path << "/#{branch}" if branch Down.download(path, down_default_options) end
orga_repos(organization:, page: 1, per_page: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 41 def orga_repos(organization:, page: 1, per_page: nil) # TODO: Handle permissions with_response_validation! do self.class.get( "/orgs/#{organization}/repos", default_options.merge( query: { page: page, per_page: per_page || default_elements_per_page, }, ) ) end end
organizations(page: 1, per_page: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 12 def organizations(page: 1, per_page: nil) with_response_validation! do self.class.get( '/user/orgs', default_options.merge( query: { page: page, per_page: per_page || default_elements_per_page, }, ) ) end end
repository(owner:, repo:)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 56 def repository(owner:, repo:) with_response_validation! do self.class.get("/repos/#{owner}/#{repo}", default_options) end end
setup_repo_webhook(owner:, repo:, webhook_url:, webhook_secret: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 92 def setup_repo_webhook(owner:, repo:, webhook_url:, webhook_secret: nil) with_response_validation! do self.class.post( "/repos/#{owner}/#{repo}/hooks", default_options.merge( body: { name: 'web', active: true, events: [ 'push', ], config: { url: webhook_url, secret: webhook_secret, content_type: 'json', }.compact, }.to_json, ) ) end end
user()
click to toggle source
# File lib/universal-git-client/http/github.rb, line 6 def user with_response_validation! do self.class.get('/user', default_options) end end
user_repos(page: 1, per_page: nil)
click to toggle source
# File lib/universal-git-client/http/github.rb, line 26 def user_repos(page: 1, per_page: nil) with_response_validation! do self.class.get( '/user/repos', default_options.merge( query: { affiliation: 'owner', page: page, per_page: per_page || default_elements_per_page, }, ) ) end end