class Translator::TranslatorCoordinator

Attributes

paths[R]

Public Class Methods

new(paths:, frequency:) click to toggle source
# File lib/nexmo_developer/app/services/translator/translator_coordinator.rb, line 5
def initialize(paths:, frequency:)
  @paths     = paths
  @frequency = frequency
end

Public Instance Methods

create_smartling_jobs!() click to toggle source
# 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!() click to toggle source
# File lib/nexmo_developer/app/services/translator/translator_coordinator.rb, line 27
def download_smartling_files!
  Translator::SmartlingDownloader.call(
    paths: @paths
  )
end
requests() click to toggle source
# 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() click to toggle source
# File lib/nexmo_developer/app/services/translator/translator_coordinator.rb, line 16
def requests_by_frequency
  @requests_by_frequency ||= requests.group_by(&:frequency)
end