Module: Octokit::Client::Commits
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/commits.rb
Instance Method Summary collapse
-
#commit(repo, sha, options = {}) ⇒ Hashie::Mash
Get a single commit.
-
#commit_comment(repo, id, options = {}) ⇒ Hashie::Mash
Get a single commit comment.
-
#commit_comments(repo, sha, options = {}) ⇒ Array
List comments for a single commit.
-
#commits(repo, sha_or_branch = "master", options = {}) ⇒ Array
(also: #list_commits)
List commits.
-
#create_commit(repo, message, tree, parents = nil, options = {}) ⇒ Hashie::Mash
Create a commit.
-
#list_commit_comments(repo, options = {}) ⇒ Array
List all commit comments.
Instance Method Details
#commit(repo, sha, options = {}) ⇒ Hashie::Mash
Get a single commit
26 27 28 |
# File 'lib/octokit/client/commits.rb', line 26 def commit(repo, sha, ={}) get("/repos/#{Repository.new(repo)}/commits/#{sha}", , 3) end |
#commit_comment(repo, id, options = {}) ⇒ Hashie::Mash
Get a single commit comment
81 82 83 |
# File 'lib/octokit/client/commits.rb', line 81 def commit_comment(repo, id, ={}) get("/repos/#{Repository.new(repo)}/comments/#{id}", , 3) end |
#commit_comments(repo, sha, options = {}) ⇒ Array
List comments for a single commit
71 72 73 |
# File 'lib/octokit/client/commits.rb', line 71 def commit_comments(repo, sha, ={}) get("/repos/#{Repository.new(repo)}/commits/#{sha}/comments", , 3) end |
#commits(repo, sha_or_branch = "master", options = {}) ⇒ Array Also known as: list_commits
List commits
Optionally pass path => "path/to/file.rb"
in options
to only return commits containing the given file path.
14 15 16 17 |
# File 'lib/octokit/client/commits.rb', line 14 def commits(repo, sha_or_branch="master", ={}) params = { :sha => sha_or_branch, :per_page => 35 } get("/repos/#{Repository.new(repo)}/commits", .merge(params), 3) end |
#create_commit(repo, message, tree, parents = nil, options = {}) ⇒ Hashie::Mash
Create a commit
Optionally pass author
and committer
hashes in options
if you’d like manual control over those parameters. If absent, details will be inferred from the authenticated user. See <a href=“developer.github.com/v3/git/commits/”>GitHub’s documentation</a> for details about how to format committer identities.
49 50 51 52 53 54 |
# File 'lib/octokit/client/commits.rb', line 49 def create_commit(repo, , tree, parents=nil, ={}) params = { :message => , :tree => tree }.tap do |params| params[:parents] = [parents].flatten if parents end post("/repos/#{Repository.new(repo)}/git/commits", .merge(params), 3) end |
#list_commit_comments(repo, options = {}) ⇒ Array
List all commit comments
61 62 63 |
# File 'lib/octokit/client/commits.rb', line 61 def list_commit_comments(repo, ={}) get("/repos/#{Repository.new(repo)}/comments", , 3) end |