Class: Translator::TranslatorCoordinator
- Inherits:
-
Object
- Object
- Translator::TranslatorCoordinator
- Defined in:
- lib/nexmo_developer/app/services/translator/translator_coordinator.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #create_smartling_jobs! ⇒ Object
- #download_smartling_files! ⇒ Object
-
#initialize(paths:, frequency:) ⇒ TranslatorCoordinator
constructor
A new instance of TranslatorCoordinator.
- #requests ⇒ Object
- #requests_by_frequency ⇒ Object
Constructor Details
#initialize(paths:, frequency:) ⇒ TranslatorCoordinator
Returns a new instance of TranslatorCoordinator.
5 6 7 8 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 5 def initialize(paths:, frequency:) @paths = paths @frequency = frequency end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
3 4 5 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 3 def paths @paths end |
Instance Method Details
#create_smartling_jobs! ⇒ Object
20 21 22 23 24 25 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 20 def create_smartling_jobs! Translator::SmartlingCoordinator.call( requests: requests_by_frequency.fetch(@frequency, []), frequency: @frequency ) end |
#download_smartling_files! ⇒ Object
27 28 29 30 31 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 27 def download_smartling_files! Translator::SmartlingDownloader.call( paths: @paths ) end |
#requests ⇒ Object
10 11 12 13 14 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 10 def requests @requests ||= @paths.map do |path| Translator::FileTranslator.new(path).translation_requests end.flatten end |
#requests_by_frequency ⇒ Object
16 17 18 |
# File 'lib/nexmo_developer/app/services/translator/translator_coordinator.rb', line 16 def requests_by_frequency @requests_by_frequency ||= requests.group_by(&:frequency) end |