Class: TxghServer::Webhooks::Transifex::RequestHandler
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Transifex::RequestHandler
- Includes:
- ResponseHelpers
- Defined in:
- lib/txgh-server/webhooks/transifex/request_handler.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
- #handle_request ⇒ Object
-
#initialize(request, logger) ⇒ RequestHandler
constructor
A new instance of RequestHandler.
Constructor Details
#initialize(request, logger) ⇒ RequestHandler
Returns a new instance of RequestHandler.
18 19 20 21 |
# File 'lib/txgh-server/webhooks/transifex/request_handler.rb', line 18 def initialize(request, logger) @request = request @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
16 17 18 |
# File 'lib/txgh-server/webhooks/transifex/request_handler.rb', line 16 def logger @logger end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
16 17 18 |
# File 'lib/txgh-server/webhooks/transifex/request_handler.rb', line 16 def request @request end |
Class Method Details
.handle_request(request, logger) ⇒ Object
9 10 11 |
# File 'lib/txgh-server/webhooks/transifex/request_handler.rb', line 9 def handle_request(request, logger) new(request, logger).handle_request end |
Instance Method Details
#handle_request ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/txgh-server/webhooks/transifex/request_handler.rb', line 23 def handle_request if publish_event # the event handled the request return respond_with(204, '') # no content end handle_safely do handler = TxghServer::Webhooks::Transifex::HookHandler.new( project: config.transifex_project, repo: config.git_repo, resource_slug: payload[:resource], language: payload[:language], logger: logger ) handler.execute end end |