Module: Octokit::Client::Objects
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/objects.rb
Instance Method Summary collapse
-
#blob(repo, blob_sha, options = {}) ⇒ Hashie::Mash
Get a single blob, fetching its content and encoding.
-
#create_blob(repo, content, encoding = "utf-8", options = {}) ⇒ String
Create a blob.
-
#create_tree(repo, tree, options = {}) ⇒ Hashie::Mash
Create a tree.
-
#tree(repo, tree_sha, options = {}) ⇒ Hashie::Mash
Get a single tree, fetching information about its root-level objects.
Instance Method Details
#blob(repo, blob_sha, options = {}) ⇒ Hashie::Mash
Get a single blob, fetching its content and encoding
55 56 57 |
# File 'lib/octokit/client/objects.rb', line 55 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
71 72 73 74 75 76 77 |
# File 'lib/octokit/client/objects.rb', line 71 def create_blob(repo, content, encoding="utf-8", ={}) parameters = { :content => content, :encoding => encoding } post("repos/#{Repository.new(repo)}/git/blobs", .merge(parameters), 3).sha end |
#create_tree(repo, tree, options = {}) ⇒ Hashie::Mash
Create a tree
Pass :base_tree => "827efc6..."
in options
to update an existing tree with new data.
34 35 36 37 |
# File 'lib/octokit/client/objects.rb', line 34 def create_tree(repo, tree, ={}) parameters = { :tree => tree } post("repos/#{Repository.new(repo)}/git/trees", .merge(parameters), 3) end |
#tree(repo, tree_sha, options = {}) ⇒ Hashie::Mash
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.
18 19 20 |
# File 'lib/octokit/client/objects.rb', line 18 def tree(repo, tree_sha, ={}) get("repos/#{Repository.new(repo)}/git/trees/#{tree_sha}", ) end |