Class: TxghServer::Webhooks::Github::StatusUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh-server/webhooks/github/status_updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, repo, branch) ⇒ StatusUpdater

Returns a new instance of StatusUpdater.



9
10
11
12
13
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 9

def initialize(project, repo, branch)
  @project = project
  @repo = repo
  @branch = branch
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



7
8
9
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 7

def branch
  @branch
end

#projectObject (readonly)

Returns the value of attribute project.



7
8
9
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 7

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo.



7
8
9
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 7

def repo
  @repo
end

Instance Method Details

#report_error_and_update_status(error) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 15

def report_error_and_update_status(error)
  error_params = Txgh.events.publish_error!(error)

  Txgh.events.publish_each('github.status.error', error_params) do |status_params|
    if status_params
      update_status_safely do
        Txgh::GithubStatus.error(project, repo, branch, status_params)
      end
    end
  end
end

#update_statusObject



27
28
29
30
31
# File 'lib/txgh-server/webhooks/github/status_updater.rb', line 27

def update_status
  update_status_safely do
    Txgh::GithubStatus.update(project, repo, branch)
  end
end