Class: TxghServer::DownloadHandler
- Inherits:
-
Object
- Object
- TxghServer::DownloadHandler
- Includes:
- ResponseHelpers
- Defined in:
- lib/txgh-server/download_handler.rb
Constant Summary collapse
- DEFAULT_FORMAT =
'.zip'
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, repo, params, logger) ⇒ DownloadHandler
constructor
A new instance of DownloadHandler.
Constructor Details
#initialize(project, repo, params, logger) ⇒ DownloadHandler
Returns a new instance of DownloadHandler.
48 49 50 51 52 53 |
# File 'lib/txgh-server/download_handler.rb', line 48 def initialize(project, repo, params, logger) @project = project @repo = repo @params = params @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
46 47 48 |
# File 'lib/txgh-server/download_handler.rb', line 46 def logger @logger end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
46 47 48 |
# File 'lib/txgh-server/download_handler.rb', line 46 def params @params end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
46 47 48 |
# File 'lib/txgh-server/download_handler.rb', line 46 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
46 47 48 |
# File 'lib/txgh-server/download_handler.rb', line 46 def repo @repo end |
Class Method Details
.handle_request(request, logger = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/txgh-server/download_handler.rb', line 9 def handle_request(request, logger = nil) handle_safely do config = config_from(request) project, repo = [config.transifex_project, config.git_repo] params = params_from(request) handler = new(project, repo, params, logger) handler.execute end end |
Instance Method Details
#execute ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/txgh-server/download_handler.rb', line 55 def execute downloader = Txgh::ResourceDownloader.new( project, repo, params['branch'], languages: project.languages ) response_class.new(, downloader.each) end |