Module: Octokit::Client::Objects
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/objects.rb |
Overview
Methods for the Git Data API
Instance Method Summary
-
#blob(repo, blob_sha, options = {}) ⇒ Sawyer::Resource
Get a single blob, fetching its content and encoding.
-
#create_blob(repo, content, encoding = 'utf-8', options = {}) ⇒ String
Create a blob.
-
#create_tag(repo, tag, message, object_sha, type, tagger_name, tagger_email, tagger_date, options = {}) ⇒ Sawyer::Resource
Create a tag.
-
#create_tree(repo, tree, options = {}) ⇒ Sawyer::Resource
Create a tree.
-
#tag(repo, tag_sha, options = {}) ⇒ Sawyer::Resource
Get a tag.
-
#tree(repo, tree_sha, options = {}) ⇒ Sawyer::Resource
Get a single tree, fetching information about its root-level objects.
Instance Method Details
#blob(repo, blob_sha, options = {}) ⇒ Sawyer::Resource
Get a single blob, fetching its content and encoding
# File 'lib/octokit/client/objects.rb', line 61
def blob(repo, blob_sha, = {}) get "#{Repository.path repo}/git/blobs/#{blob_sha}", end
#create_blob(repo, content, encoding = 'utf-8', options = {}) ⇒ String
Create a blob
# File 'lib/octokit/client/objects.rb', line 77
def create_blob(repo, content, encoding = 'utf-8', = {}) parameters = { content: content, encoding: encoding } blob = post "#{Repository.path repo}/git/blobs", .merge(parameters) blob.sha end
#create_tag(repo, tag, message, object_sha, type, tagger_name, tagger_email, tagger_date, options = {}) ⇒ Sawyer::Resource
Create a tag
Requires authenticated client.
# File 'lib/octokit/client/objects.rb', line 125
def create_tag(repo, tag, , object_sha, type, tagger_name, tagger_email, tagger_date, = {}) .merge!( tag: tag, message: , object: object_sha, type: type, tagger: { name: tagger_name, email: tagger_email, date: tagger_date } ) post "#{Repository.path repo}/git/tags", end
#create_tree(repo, tree, options = {}) ⇒ Sawyer::Resource
Create a tree
Pass :base_tree => "827efc6..." in options to update an existing tree with new data.
# File 'lib/octokit/client/objects.rb', line 40
def create_tree(repo, tree, = {}) parameters = { tree: tree } post "#{Repository.path repo}/git/trees", .merge(parameters) end
#tag(repo, tag_sha, options = {}) ⇒ Sawyer::Resource
Get a tag
# File 'lib/octokit/client/objects.rb', line 95
def tag(repo, tag_sha, = {}) get "#{Repository.path repo}/git/tags/#{tag_sha}", end
#tree(repo, tree_sha, options = {}) ⇒ Sawyer::Resource
Get a single tree, fetching information about its root-level objects
Pass :recursive => true in options to fetch information about all of the tree's objects, including those in subdirectories.
# File 'lib/octokit/client/objects.rb', line 24
def tree(repo, tree_sha, = {}) get "#{Repository.path repo}/git/trees/#{tree_sha}", end