Class: UpdateDraftRelease::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/github.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ 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

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/github.rb', line 5

def client
  @client
end

#repoObject (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

#commitsObject



33
34
35
36
# File 'lib/github.rb', line 33

def commits
  return @commits if defined?(@commits)
  @commits = @client.commits(@repo)
end

#draft_releasesObject



25
26
27
# File 'lib/github.rb', line 25

def draft_releases
  releases.select { |release| release.draft }
end

#releasesObject



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

#userObject



16
17
18
# File 'lib/github.rb', line 16

def user
  @user ||= @client.user
end

#user_commitsObject



38
39
40
41
42
# File 'lib/github.rb', line 38

def user_commits
  commits.select do |commit|
    commit.committer && commit.committer. == user.
  end
end