Class: TxghServer::Webhooks::Transifex::HookHandler
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Transifex::HookHandler
- Includes:
- Txgh::CategorySupport, ResponseHelpers
- Defined in:
- lib/txgh-server/webhooks/transifex/hook_handler.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#resource_slug ⇒ Object
readonly
Returns the value of attribute resource_slug.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ HookHandler
constructor
A new instance of HookHandler.
Constructor Details
#initialize(options = {}) ⇒ HookHandler
Returns a new instance of HookHandler.
14 15 16 17 18 19 20 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 14 def initialize( = {}) @project = .fetch(:project) @repo = .fetch(:repo) @resource_slug = .fetch(:resource_slug) @language = .fetch(:language) @logger = .fetch(:logger) { Logger.new(STDOUT) } end |
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
12 13 14 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 12 def language @language end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 12 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
12 13 14 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 12 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
12 13 14 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 12 def repo @repo end |
#resource_slug ⇒ Object (readonly)
Returns the value of attribute resource_slug.
12 13 14 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 12 def resource_slug @resource_slug end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/txgh-server/webhooks/transifex/hook_handler.rb', line 22 def execute logger.info(resource_slug) check_error_response || begin puller.pull_resource(tx_resource, [language]) update_github_status respond_with(200, true) end end |