Module: Octokit::Client::Refs
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/refs.rb
Instance Method Summary collapse
-
#create_ref(repo, ref, sha, options = {}) ⇒ Array
(also: #create_reference)
Create a reference.
-
#delete_ref(repo, ref, options = {}) ⇒ Response
(also: #delete_reference)
Delete a single reference.
-
#ref(repo, ref, options = {}) ⇒ Reference
(also: #reference)
Fetch a given reference.
-
#refs(repo, namespace = "", options = {}) ⇒ Array
(also: #list_refs, #references, #list_references)
List all refs for a given user and repo.
-
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array
(also: #update_reference)
Update a reference.
Instance Method Details
#create_ref(repo, ref, sha, options = {}) ⇒ Array Also known as: create_reference
Create a reference
42 43 44 45 46 47 48 |
# File 'lib/octokit/client/refs.rb', line 42 def create_ref(repo, ref, sha, ={}) parameters = { :ref => "refs/#{ref}", :sha => sha } post("repos/#{Repository.new(repo)}/git/refs", .merge(parameters)) end |
#delete_ref(repo, ref, options = {}) ⇒ Response Also known as: delete_reference
Delete a single reference
78 79 80 |
# File 'lib/octokit/client/refs.rb', line 78 def delete_ref(repo, ref, ={}) delete("repos/#{Repository.new(repo)}/git/refs/#{ref}", , 3, true, true) end |
#ref(repo, ref, options = {}) ⇒ Reference Also known as: reference
Fetch a given reference
28 29 30 |
# File 'lib/octokit/client/refs.rb', line 28 def ref(repo, ref, ={}) get("repos/#{Repository.new(repo)}/git/refs/#{ref}", , 3) end |
#refs(repo, namespace = "", options = {}) ⇒ Array Also known as: list_refs, references, list_references
List all refs for a given user and repo
13 14 15 |
# File 'lib/octokit/client/refs.rb', line 13 def refs(repo, namespace="", ={}) get("repos/#{Repository.new(repo)}/git/refs/#{namespace}", , 3) end |
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array Also known as: update_reference
Update a reference
61 62 63 64 65 66 67 |
# File 'lib/octokit/client/refs.rb', line 61 def update_ref(repo, ref, sha, force=true, ={}) parameters = { :sha => sha, :force => force } patch("repos/#{Repository.new(repo)}/git/refs/#{ref}", .merge(parameters)) end |