Module: Octokit::Client::Objects
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/objects.rb
Overview
Methods for the Git Data API
Instance Method Summary collapse
-
#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
61 62 63 |
# 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
77 78 79 80 81 82 83 84 85 |
# 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.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# 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.
40 41 42 43 |
# 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
95 96 97 |
# 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.
24 25 26 |
# File 'lib/octokit/client/objects.rb', line 24 def tree(repo, tree_sha, = {}) get "#{Repository.path repo}/git/trees/#{tree_sha}", end |