Module: Octokit::Client::Refs
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/refs.rb |
Overview
Methods for References for Git Data API
Instance Method Summary
-
#create_ref(repo, ref, sha, options = {}) ⇒ Array<Sawyer::Resource>
(also: #create_reference)
Create a reference.
-
#create_reference(repo, ref, sha, options = {})
Alias for #create_ref.
-
#delete_branch(repo, branch, options = {}) ⇒ Boolean
Delete a single branch.
-
#delete_ref(repo, ref, options = {}) ⇒ Boolean
(also: #delete_reference)
Delete a single reference.
-
#delete_reference(repo, ref, options = {})
Alias for #delete_ref.
-
#list_references(repo, namespace = nil, options = {})
Alias for #refs.
-
#list_refs(repo, namespace = nil, options = {})
Alias for #refs.
-
#matching_refs(repo, ref, options = {}) ⇒ Array<Sawyer::Resource>
Fetch matching refs.
-
#ref(repo, ref, options = {}) ⇒ Sawyer::Resource
(also: #reference)
Fetch a given reference.
-
#reference(repo, ref, options = {})
Alias for #ref.
-
#references(repo, namespace = nil, options = {})
Alias for #refs.
-
#refs(repo, namespace = nil, options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_refs, #references, #list_references)
List all refs for a given user and repo.
-
#update_branch(repo, branch, sha, force = true, options = {}) ⇒ Array<Sawyer::Resource>
Update a branch.
-
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array<Sawyer::Resource>
(also: #update_reference)
Update a reference.
-
#update_reference(repo, ref, sha, force = true, options = {})
Alias for #update_ref.
Instance Method Details
#create_ref(repo, ref, sha, options = {}) ⇒ Array
<Sawyer::Resource
>
Also known as: #create_reference
Create a reference
#create_reference(repo, ref, sha, options = {})
Alias for #create_ref.
# File 'lib/octokit/client/refs.rb', line 68
alias create_reference create_ref
#delete_branch(repo, branch, options = {}) ⇒ Boolean
Delete a single branch
# File 'lib/octokit/client/refs.rb', line 115
def delete_branch(repo, branch, = {}) delete_ref repo, "heads/#{branch}", end
#delete_ref(repo, ref, options = {}) ⇒ Boolean
Also known as: #delete_reference
Delete a single reference
# File 'lib/octokit/client/refs.rb', line 127
def delete_ref(repo, ref, = {}) boolean_from_response :delete, "#{Repository.path repo}/git/refs/#{ref}", end
#delete_reference(repo, ref, options = {})
Alias for #delete_ref.
# File 'lib/octokit/client/refs.rb', line 130
alias delete_reference delete_ref
#list_references(repo, namespace = nil, options = {})
Alias for #refs.
# File 'lib/octokit/client/refs.rb', line 24
alias list_references refs
#list_refs(repo, namespace = nil, options = {})
Alias for #refs.
# File 'lib/octokit/client/refs.rb', line 22
alias list_refs refs
#matching_refs(repo, ref, options = {}) ⇒ Array
<Sawyer::Resource
>
Fetch matching refs
# File 'lib/octokit/client/refs.rb', line 34
def matching_refs(repo, ref, = {}) paginate "#{Repository.path repo}/git/matching-refs/#{ref}", end
#ref(repo, ref, options = {}) ⇒ Sawyer::Resource
Also known as: #reference
Fetch a given reference
# File 'lib/octokit/client/refs.rb', line 46
def ref(repo, ref, = {}) get "#{Repository.path repo}/git/refs/#{ref}", end
#reference(repo, ref, options = {})
Alias for #ref.
# File 'lib/octokit/client/refs.rb', line 49
alias reference ref
#references(repo, namespace = nil, options = {})
Alias for #refs.
# File 'lib/octokit/client/refs.rb', line 23
alias references refs
#refs(repo, namespace = nil, options = {}) ⇒ Array
<Sawyer::Resource
>
Also known as: #list_refs, #references, #list_references
List all refs for a given user and repo
# File 'lib/octokit/client/refs.rb', line 17
def refs(repo, namespace = nil, = {}) path = "#{Repository.path repo}/git/refs" path += "/#{namespace}" unless namespace.nil? paginate path, end
#update_branch(repo, branch, sha, force = true, options = {}) ⇒ Array
<Sawyer::Resource
>
Update a branch
# File 'lib/octokit/client/refs.rb', line 103
def update_branch(repo, branch, sha, force = true, = {}) update_ref repo, "heads/#{branch}", sha, force, end
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array
<Sawyer::Resource
>
Also known as: #update_reference
Update a reference
# File 'lib/octokit/client/refs.rb', line 82
def update_ref(repo, ref, sha, force = true, = {}) parameters = { sha: sha, force: force } patch "#{Repository.path repo}/git/refs/#{ref}", .merge(parameters) end
#update_reference(repo, ref, sha, force = true, options = {})
Alias for #update_ref.
# File 'lib/octokit/client/refs.rb', line 89
alias update_reference update_ref