Class: GitHub::Commit
Instance Attribute Summary collapse
-
#added ⇒ Object
Returns the value of attribute added.
-
#author ⇒ Object
Returns the value of attribute author.
-
#authored ⇒ Object
Returns the value of attribute authored.
-
#committed ⇒ Object
Returns the value of attribute committed.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#removed ⇒ Object
Returns the value of attribute removed.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#tree ⇒ Object
Returns the value of attribute tree.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
-
.find(*args) ⇒ Object
(also: show)
- Find commits, accepts Hash with keys: :user/:owner/:username
- Github user name :repo/:repository/:project
- Repo name :branch
- Only commits for specific branch - default ‘master’ :path
- Only commits for specific path :sha/:id
-
Only one commit with specific id (sha).
Instance Method Summary collapse
-
#initialize(opts) ⇒ Commit
constructor
A new instance of Commit.
Methods inherited from Base
aliases_for, base_uri, #get, get, post, #post, request, #set_attributes, set_resource, #to_s
Constructor Details
#initialize(opts) ⇒ Commit
Returns a new instance of Commit.
14 15 16 17 18 19 |
# File 'lib/git_hub/commit.rb', line 14 def initialize(opts) super raise "Unable to initialize #{self.class} without id(sha)" unless sha @committed = Time.parse(@committed) unless @committed.is_a?(Time) = Time.parse() unless .is_a?(Time) end |
Instance Attribute Details
#added ⇒ Object
Returns the value of attribute added.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def added @added end |
#author ⇒ Object
Returns the value of attribute author.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def end |
#authored ⇒ Object
Returns the value of attribute authored.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def end |
#committed ⇒ Object
Returns the value of attribute committed.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def committed @committed end |
#committer ⇒ Object
Returns the value of attribute committer.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def committer @committer end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def end |
#modified ⇒ Object
Returns the value of attribute modified.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def modified @modified end |
#parents ⇒ Object
Returns the value of attribute parents.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def parents @parents end |
#removed ⇒ Object
Returns the value of attribute removed.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def removed @removed end |
#repo ⇒ Object
Returns the value of attribute repo.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def repo @repo end |
#tree ⇒ Object
Returns the value of attribute tree.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def tree @tree end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def url @url end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/git_hub/commit.rb', line 6 def user @user end |
Class Method Details
.find(*args) ⇒ Object Also known as: show
Find commits, accepts Hash with keys:
- :user/:owner/:username
-
Github user name
- :repo/:repository/:project
-
Repo name
- :branch
-
Only commits for specific branch - default ‘master’
- :path
-
Only commits for specific path
- :sha/:id
-
Only one commit with specific id (sha)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/git_hub/commit.rb', line 28 def find( *args ) user, repo, branch, sha, path = extract args, :user, :repo, :branch, :sha, :path repo_given = branch && user && repo path = if sha && repo_given "/show/#{user}/#{repo}/#{sha}" elsif path && repo_given "/list/#{user}/#{repo}/#{branch}/#{path}" elsif repo_given "/list/#{user}/#{repo}/#{branch}" else raise "Unable to find #{self.class}(s) for #{opts}" end instantiate get(path), :user=>user, :repo=>repo end |