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_tag(repo, tag, message, object_sha, type, tagger_name, tagger_email, tagger_date, options = {}) ⇒ Hashie::Mash
Create a tag.
-
#create_tree(repo, tree, options = {}) ⇒ Hashie::Mash
Create a tree.
-
#tag(repo, tag_sha, options = {}) ⇒ Hashie::Mash
Get a tag.
-
#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)).sha end |
#create_tag(repo, tag, message, object_sha, type, tagger_name, tagger_email, tagger_date, options = {}) ⇒ Hashie::Mash
Create a tag
Requires authenticated client.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/octokit/client/objects.rb', line 118 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 = {}) ⇒ 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)) end |
#tag(repo, tag_sha, options = {}) ⇒ Hashie::Mash
Get a tag
87 88 89 |
# File 'lib/octokit/client/objects.rb', line 87 def tag(repo, tag_sha, ={}) get("repos/#{Repository.new repo}/git/tags/#{tag_sha}", ) 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 |