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
60 61 62 |
# File 'lib/octokit/client/objects.rb', line 60 def blob(repo, blob_sha, = {}) get "repos/#{Repository.new(repo)}/git/blobs/#{blob_sha}", end |
#create_blob(repo, content, encoding = "utf-8", options = {}) ⇒ String
Create a blob
76 77 78 79 80 81 82 83 84 |
# File 'lib/octokit/client/objects.rb', line 76 def create_blob(repo, content, encoding="utf-8", = {}) parameters = { :content => content, :encoding => encoding } blob = post "repos/#{Repository.new(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.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/octokit/client/objects.rb', line 124 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 "repos/#{Repository.new 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.
39 40 41 42 |
# File 'lib/octokit/client/objects.rb', line 39 def create_tree(repo, tree, = {}) parameters = { :tree => tree } post "repos/#{Repository.new(repo)}/git/trees", .merge(parameters) end |
#tag(repo, tag_sha, options = {}) ⇒ Sawyer::Resource
Get a tag
94 95 96 |
# File 'lib/octokit/client/objects.rb', line 94 def tag(repo, tag_sha, = {}) get "repos/#{Repository.new 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.
23 24 25 |
# File 'lib/octokit/client/objects.rb', line 23 def tree(repo, tree_sha, = {}) get "repos/#{Repository.new(repo)}/git/trees/#{tree_sha}", end |