Class: GitReporting::Source::Github
- Inherits:
-
Object
- Object
- GitReporting::Source::Github
- Defined in:
- lib/git_reporting/source/github.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #fetch(period) ⇒ Object
- #fetch_all ⇒ Object
-
#initialize(options = {}) ⇒ Github
constructor
A new instance of Github.
Constructor Details
#initialize(options = {}) ⇒ Github
Returns a new instance of Github.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/git_reporting/source/github.rb', line 9 def initialize( = {}) if [:repo] @repo = .delete(:repo) else raise ArgumentError, "You must specify repo for GitHub source" end @branch = .delete(:branch) || :master [:auto_paginate] ||= true @client = Octokit::Client.new() end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
7 8 9 |
# File 'lib/git_reporting/source/github.rb', line 7 def branch @branch end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/git_reporting/source/github.rb', line 7 def client @client end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/git_reporting/source/github.rb', line 7 def repo @repo end |
Instance Method Details
#fetch(period) ⇒ Object
24 25 26 |
# File 'lib/git_reporting/source/github.rb', line 24 def fetch(period) extract_commits_from_array client.commits_between(repo, period.begin, period.end, sha: branch) end |
#fetch_all ⇒ Object
20 21 22 |
# File 'lib/git_reporting/source/github.rb', line 20 def fetch_all extract_commits_from_array client.commits(repo, branch) end |