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.
-
#compare(repo, start, endd, options = {}) ⇒ Hashie::Mash
Compare two commits.
-
#create_commit(repo, message, tree, parents = nil, options = {}) ⇒ Hashie::Mash
Create a commit.
-
#list_commit_comments(repo, options = {}) ⇒ Array
List all commit comments.
-
#merge(repo, base, head, options = {}) ⇒ Hashie::Mash
Merge a branch or sha.
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
80 81 82 |
# File 'lib/octokit/client/commits.rb', line 80 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
70 71 72 |
# File 'lib/octokit/client/commits.rb', line 70 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", params.merge(), 3) end |
#compare(repo, start, endd, options = {}) ⇒ Hashie::Mash
Compare two commits
91 92 93 |
# File 'lib/octokit/client/commits.rb', line 91 def compare(repo, start, endd, ={}) get("repos/#{Repository.new(repo)}/compare/#{start}...#{endd}", , 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 |
# File 'lib/octokit/client/commits.rb', line 49 def create_commit(repo, , tree, parents=nil, ={}) params = { :message => , :tree => tree } params[:parents] = [parents].flatten if parents post("repos/#{Repository.new(repo)}/git/commits", .merge(params), 3) end |
#list_commit_comments(repo, options = {}) ⇒ Array
List all commit comments
60 61 62 |
# File 'lib/octokit/client/commits.rb', line 60 def list_commit_comments(repo, ={}) get("repos/#{Repository.new(repo)}/comments", , 3) end |
#merge(repo, base, head, options = {}) ⇒ Hashie::Mash
Merge a branch or sha
103 104 105 106 107 108 109 |
# File 'lib/octokit/client/commits.rb', line 103 def merge(repo, base, head, ={}) params = { :base => base, :head => head }.merge() post("repos/#{Repository.new(repo)}/merges", params, 3) end |