Class: UpdateDraftRelease::Github
- Inherits:
-
Object
- Object
- UpdateDraftRelease::Github
- Defined in:
- lib/github.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Class Method Summary collapse
Instance Method Summary collapse
- #commits ⇒ Object
- #draft_releases ⇒ Object
-
#initialize(repository) ⇒ Github
constructor
A new instance of Github.
- #releases ⇒ Object
- #update_release(release, body) ⇒ Object
- #user ⇒ Object
- #user_commits ⇒ Object
Constructor Details
#initialize(repository) ⇒ Github
Returns a new instance of Github.
11 12 13 14 |
# File 'lib/github.rb', line 11 def initialize(repository) @client = Octokit::Client.new(netrc: true) @repo = repository end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/github.rb', line 5 def client @client end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
5 6 7 |
# File 'lib/github.rb', line 5 def repo @repo end |
Class Method Details
.open(repository) ⇒ Object
7 8 9 |
# File 'lib/github.rb', line 7 def self.open(repository) Github.new(repository) end |
Instance Method Details
#commits ⇒ Object
33 34 35 36 |
# File 'lib/github.rb', line 33 def commits return @commits if defined?(@commits) @commits = @client.commits(@repo) end |
#draft_releases ⇒ Object
25 26 27 |
# File 'lib/github.rb', line 25 def draft_releases releases.select { |release| release.draft } end |
#releases ⇒ Object
20 21 22 23 |
# File 'lib/github.rb', line 20 def releases return @releases if defined?(@releases) @releases = @client.releases(@repo) end |
#update_release(release, body) ⇒ Object
29 30 31 |
# File 'lib/github.rb', line 29 def update_release(release, body) @client.update_release(release.url, body: body.to_s) end |
#user ⇒ Object
16 17 18 |
# File 'lib/github.rb', line 16 def user @user ||= @client.user end |
#user_commits ⇒ Object
38 39 40 41 42 |
# File 'lib/github.rb', line 38 def user_commits commits.select do |commit| commit.committer && commit.committer.login == user.login end end |