Classes:Branches,Collaborators,Comments,Commits,Contents,Deployments,Downloads,Forks,Hooks,Invitations,Keys,Merging,Pages,Projects,PubSubHubbub,Releases,Statistics,Statuses
%w[ name ]%w[ name description homepage private has_issues has_projects has_wiki has_downloads team_id auto_init gitignore_template default_branch].freeze
%w[ all public private member ].freeze
Github::Constants::ACCEPT,Github::Constants::ACCEPTED_OAUTH_SCOPES,Github::Constants::ACCEPT_CHARSET,Github::Constants::CACHE_CONTROL,Github::Constants::CONTENT_LENGTH,Github::Constants::CONTENT_TYPE,Github::Constants::DATE,Github::Constants::ETAG,Github::Constants::HEADER_LAST,Github::Constants::HEADER_LINK,Github::Constants::HEADER_NEXT,Github::Constants::LOCATION,Github::Constants::META_FIRST,Github::Constants::META_LAST,Github::Constants::META_NEXT,Github::Constants::META_PREV,Github::Constants::META_REL,Github::Constants::OAUTH_SCOPES,Github::Constants::PARAM_PAGE,Github::Constants::PARAM_PER_PAGE,Github::Constants::PARAM_START_PAGE,Github::Constants::RATELIMIT_LIMIT,Github::Constants::RATELIMIT_REMAINING,Github::Constants::RATELIMIT_RESET,Github::Constants::SERVER,Github::Constants::USER_AGENT
List contributors.
Create a new repository for the authenticated user.
Delete a repository.
Edit a repository.
Get a repository.
Get a repository.
List languages.
List repositories for the authenticated user.
List tags.
List teams.
after_callbacks,after_request,#api_methods_in,#arguments,before_callbacks,before_request,clear_request_methods!,#disable_redirects,#execute,extend_with_actions,extra_methods,#extract_basic_auth,extract_class_name,#filter_callbacks,inherited,#initialize,internal_methods,method_added,#method_missing,#module_methods_in,namespace,request_methods,require_all,#respond_to?,root!,#run_callbacks,#set,#yield_or_eval
#delete_request,#get_request,#head_request,#options_request,#patch_request,#post_request,#put_request
#ratelimit,#ratelimit_remaining,#ratelimit_reset
#auth_code,#authenticated?,#authentication,#authorize_url,#basic_authed?,#client,#get_token
This class inherits a constructor fromGithub::API
This class handles dynamic methods through themethod_missing method in the classGithub::API
List contributors
github=Github.newgithub.repos.contributors'user-name','repo-name'github.repos.contributors'user-name','repo-name'{|cont|...}288289290291292293294295296 | # File 'lib/github_api/client/repos.rb', line 288defcontributors(*args)arguments(args,required:[:user,:repo])dopermit%w[ anon ]endresponse=get_request("/repos/#{arguments.user}/#{arguments.repo}/contributors",arguments.params)returnresponseunlessblock_given?response.each{|el|yieldel}end |
Create a new repository for the authenticated user.
Create a new repository in this organisation. The authenticated user must be a member of this organisation
github=Github.newgithub.repos.create"name":'repo-name'"description":"This is your first repo","homepage":"https://github.com","private":false,"has_issues":true,"has_wiki":true,"has_downloads":truegithub=Github.newoauth_token:'...'github.repos.createname:'repo-name',org:'organisation-name'245246247248249250251252253254255256257 | # File 'lib/github_api/client/repos.rb', line 245defcreate(*args)arguments(args)doassert_required%w[ name ]endparams=arguments.params# Requires authenticated userif(org=params.delete('org')||org)post_request("/orgs/#{org}/repos",params)elsepost_request("/user/repos",params)endend |
Delete a repository
Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.
github=Github.newoauth_token:'...'github.repos.delete'user-name','repo-name'269270271272273 | # File 'lib/github_api/client/repos.rb', line 269defdelete(*args)arguments(args,required:[:user,:repo])delete_request("/repos/#{arguments.user}/#{arguments.repo}",arguments.params)end |
Edit a repository
github=Github.newgithub.repos.edit'user-name','repo-name',name:'hello-world',description:'This is your first repo',homepage:"https://github.com",public:true,has_issues:true330331332333334335336337 | # File 'lib/github_api/client/repos.rb', line 330defedit(*args)arguments(args,required:[:user,:repo])dopermitVALID_REPO_OPTIONSassert_required%w[ name ]endpatch_request("/repos/#{arguments.user}/#{arguments.repo}",arguments.params)end |
Get a repository
github=Github.newgithub.repos.get'user-name','repo-name'github.repos.getuser:'user-name',repo:'repo-name'github.repos(user:'user-name',repo:'repo-name').get169170171172173 | # File 'lib/github_api/client/repos.rb', line 169defget(*args)arguments(args,required:[:user,:repo])get_request("/repos/#{arguments.user}/#{arguments.repo}",arguments.params)end |
Get a repository
github=Github.newgithub.repos.get_by_id'repo-id'github.repos.get_by_idid:'repo-id'github.repos(id:'repo-id').get_by_id184185186187188 | # File 'lib/github_api/client/repos.rb', line 184defget_by_id(*args)arguments(args,required:[:id])get_request("/repositories/#{arguments.id}",arguments.params)end |
List languages
423424425426427428429 | # File 'lib/github_api/client/repos.rb', line 423deflanguages(*args)arguments(args,required:[:user,:repo])response=get_request("/repos/#{arguments.user}/#{arguments.repo}/languages",arguments.params)returnresponseunlessblock_given?response.each{|el|yieldel}end |
List repositories for the authenticated user
List all repositories
This provides a dump of every repository, in the order that they were created.
List public repositories for the specified user.
List repositories for the specified organisation.
github=Github.newoauth_token:'...'github.repos.listgithub.repos.list{|repo|...}github=Github.newgithub.repos.list:everygithub.repos.list:every{|repo|...}github=Github.newgithub.repos.listuser:'user-name'github.repos.listuser:'user-name',{|repo|...}github=Github.newgithub.repos.listorg:'org-name'github.repos.listorg:'org-name',{|repo|...}137138139140141142143144145146147148149150151152153154155156157158 | # File 'lib/github_api/client/repos.rb', line 137deflist(*args)arguments(args)dopermit%w[ user org type sort direction since ]endparams=arguments.paramsunlessparams.symbolize_keys[:per_page]params.merge!(Pagination.per_page_as_param([:per_page]))endresponse=if(user_name=params.delete('user')||user)get_request("/users/#{user_name}/repos",params)elsif(org_name=params.delete('org')||org)get_request("/orgs/#{org_name}/repos",params)elsifargs.map(&:to_s).include?('every')get_request('/repositories',params)else# For authenticated userget_request('/user/repos',params)endreturnresponseunlessblock_given?response.each{|el|yieldel}end |
List tags
github=Github.newgithub.repos.'user-name','repo-name'github.repos.'user-name','repo-name'{|tag|...}440441442443444445446 | # File 'lib/github_api/client/repos.rb', line 440def(*args)arguments(args,required:[:user,:repo])response=get_request("/repos/#{arguments.user}/#{arguments.repo}/tags",arguments.params)returnresponseunlessblock_given?response.each{|el|yieldel}end |
List teams
github=Github.newgithub.repos.teams'user-name','repo-name'github.repos.teams'user-name','repo-name'{|team|...}github.repos(user:'user-name, repo: 'repo-name').teams462463464465466467468 | # File 'lib/github_api/client/repos.rb', line 462defteams(*args)arguments(args,required:[:user,:repo])response=get_request("/repos/#{arguments.user}/#{arguments.repo}/teams",arguments.params)returnresponseunlessblock_given?response.each{|el|yieldel}end |