Class: Txgh::Handlers::Transifex::HookHandler
- Inherits:
-
Object
- Object
- Txgh::Handlers::Transifex::HookHandler
- Includes:
- CategorySupport, ResponseHelpers
- Defined in:
- lib/txgh/handlers/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.
Methods included from CategorySupport
#deserialize_categories, #escape_category, #join_categories, #serialize_categories
Constructor Details
#initialize(options = {}) ⇒ HookHandler
Returns a new instance of HookHandler.
12 13 14 15 16 17 18 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 12 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.
10 11 12 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 10 def language @language end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 10 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 10 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
10 11 12 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 10 def repo @repo end |
#resource_slug ⇒ Object (readonly)
Returns the value of attribute resource_slug.
10 11 12 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 10 def resource_slug @resource_slug end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/txgh/handlers/transifex/hook_handler.rb', line 20 def execute logger.info(resource_slug) check_error_response || begin committer = ResourceCommitter.new(project, repo, logger) committer.commit_resource(tx_resource, branch, language) respond_with(200, true) end end |