Class: TxghServer::Webhooks::Github::StatusUpdater
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Github::StatusUpdater
- Defined in:
- lib/txgh-server/webhooks/github/status_updater.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(project, repo, branch) ⇒ StatusUpdater
constructor
A new instance of StatusUpdater.
- #report_error_and_update_status(error) ⇒ Object
- #update_status ⇒ Object
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
#branch ⇒ Object (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 |
#project ⇒ Object (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 |
#repo ⇒ Object (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_status ⇒ Object
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 |