Class: TxghServer::Webhooks::Transifex::HookHandler

Inherits:
Object
  • Object
show all
Includes:
Txgh::CategorySupport, ResponseHelpers
Defined in:
lib/txgh-server/webhooks/transifex/hook_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  @project = options.fetch(:project)
  @repo = options.fetch(:repo)
  @resource_slug = options.fetch(:resource_slug)
  @language = options.fetch(:language)
  @logger = options.fetch(:logger) { Logger.new(STDOUT) }
end

Instance Attribute Details

#languageObject (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

#loggerObject (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

#projectObject (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

#repoObject (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_slugObject (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

#executeObject



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