Module: Octokit::Client::Refs
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/refs.rb
Overview
Methods for References for Git Data API
Instance Method Summary collapse
-
#create_ref(repo, ref, sha, options = {}) ⇒ Array<Sawyer::Resource>
(also: #create_reference)
Create a reference.
-
#delete_ref(repo, ref, options = {}) ⇒ Boolean
(also: #delete_reference)
Delete a single reference.
-
#ref(repo, ref, options = {}) ⇒ Sawyer::Resource
(also: #reference)
Fetch a given reference.
-
#refs(repo, namespace = nil, options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_refs, #references, #list_references)
List all refs for a given user and repo.
-
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array<Sawyer::Resource>
(also: #update_reference)
Update a reference.
Instance Method Details
#create_ref(repo, ref, sha, options = {}) ⇒ Array<Sawyer::Resource> Also known as: create_reference
Create a reference
48 49 50 51 52 53 54 |
# File 'lib/octokit/client/refs.rb', line 48 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 = {}) ⇒ Boolean Also known as: delete_reference
Delete a single reference
84 85 86 |
# File 'lib/octokit/client/refs.rb', line 84 def delete_ref(repo, ref, = {}) boolean_from_response :delete, "repos/#{Repository.new(repo)}/git/refs/#{ref}", end |
#ref(repo, ref, options = {}) ⇒ Sawyer::Resource Also known as: reference
Fetch a given reference
34 35 36 |
# File 'lib/octokit/client/refs.rb', line 34 def ref(repo, ref, = {}) get "repos/#{Repository.new(repo)}/git/refs/#{ref}", end |
#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
17 18 19 20 21 |
# File 'lib/octokit/client/refs.rb', line 17 def refs(repo, namespace = nil, = {}) path = "repos/#{Repository.new(repo)}/git/refs" path += "/#{namespace}" unless namespace.nil? get path, end |
#update_ref(repo, ref, sha, force = true, options = {}) ⇒ Array<Sawyer::Resource> Also known as: update_reference
Update a reference
67 68 69 70 71 72 73 |
# File 'lib/octokit/client/refs.rb', line 67 def update_ref(repo, ref, sha, force = true, = {}) parameters = { :sha => sha, :force => force } patch "repos/#{Repository.new(repo)}/git/refs/#{ref}", .merge(parameters) end |