Class: Txgh::Handlers::Github::RequestHandler
- Inherits:
-
Object
- Object
- Txgh::Handlers::Github::RequestHandler
- Extended by:
- ResponseHelpers
- Includes:
- ResponseHelpers
- Defined in:
- lib/txgh/handlers/github/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(klass) ⇒ Object
-
#initialize(request, logger) ⇒ RequestHandler
constructor
A new instance of RequestHandler.
Constructor Details
#initialize(request, logger) ⇒ RequestHandler
Returns a new instance of RequestHandler.
51 52 53 54 |
# File 'lib/txgh/handlers/github/request_handler.rb', line 51 def initialize(request, logger) @request = request @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
49 50 51 |
# File 'lib/txgh/handlers/github/request_handler.rb', line 49 def logger @logger end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
49 50 51 |
# File 'lib/txgh/handlers/github/request_handler.rb', line 49 def request @request end |
Class Method Details
.handle_request(request, logger) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/txgh/handlers/github/request_handler.rb', line 11 def handle_request(request, logger) case request.env['HTTP_X_GITHUB_EVENT'] when 'push' handle_push(request, logger) when 'delete' handle_delete(request, logger) when 'ping' handle_ping(request, logger) else handle_unexpected end end |
Instance Method Details
#handle(klass) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/txgh/handlers/github/request_handler.rb', line 56 def handle(klass) handle_safely do handler = klass.new( project: config.transifex_project, repo: config.github_repo, payload: payload, logger: logger ) handler.execute end end |