Class: Octopolo::GitHub::Commit
- Inherits:
-
Object
- Object
- Octopolo::GitHub::Commit
- Defined in:
- lib/octopolo/github/commit.rb
Instance Attribute Summary collapse
-
#commit_data ⇒ Object
Returns the value of attribute commit_data.
Class Method Summary collapse
-
.for_pull_request(pull_request) ⇒ Object
Public: Find commits for a given pull request.
Instance Method Summary collapse
-
#author ⇒ Object
Public: GitHub User that is the author of the commit.
-
#author_name ⇒ Object
Public: The name of the author of the commit.
-
#initialize(commit_data) ⇒ Commit
constructor
Public: Instantiate a new Commit wrapper object.
Constructor Details
#initialize(commit_data) ⇒ Commit
Public: Instantiate a new Commit wrapper object
commit_data - The GitHub API data about the commit
9 10 11 |
# File 'lib/octopolo/github/commit.rb', line 9 def initialize commit_data self.commit_data = commit_data end |
Instance Attribute Details
#commit_data ⇒ Object
Returns the value of attribute commit_data.
4 5 6 |
# File 'lib/octopolo/github/commit.rb', line 4 def commit_data @commit_data end |
Class Method Details
.for_pull_request(pull_request) ⇒ Object
Public: Find commits for a given pull request
pull_request - A PullRequest or other object responding to #repo_name
and #number
Returns an Array of Commit objects
19 20 21 22 23 |
# File 'lib/octopolo/github/commit.rb', line 19 def self.for_pull_request pull_request GitHub.pull_request_commits(pull_request.repo_name, pull_request.number).map do |c| Commit.new c end end |
Instance Method Details
#author ⇒ Object
Public: GitHub User that is the author of the commit
Returns a Hashie::Mash object of the GitHub User
28 29 30 31 32 |
# File 'lib/octopolo/github/commit.rb', line 28 def GitHub::User.new(commit_data..login) rescue NoMethodError GitHub::User.new(GitHub::UNKNOWN_USER) end |
#author_name ⇒ Object
Public: The name of the author of the commit
Returns a String containing the author’s name
37 38 39 |
# File 'lib/octopolo/github/commit.rb', line 37 def . end |