Sha256: fff678973abd3e0ddeeb2b154e86dbfcaed2c71d12891e8b280bc4c94dd84266
Contents?: true
Size: 634 Bytes
Versions: 2
Compression:
Stored size: 634 Bytes
Contents
class TranslationEngine::ScreenshotsMiddleware URL_PATH = /\A\/translation_engine\/screenshots/ def initialize(app) @app = app end def call(env) if TranslationEngine.use_screenshots && env['PATH_INFO'] =~ URL_PATH handle_translation_request(env) else @app.call(env) end end private def handle_translation_request(env) data = JSON.parse(env["rack.input"].read) TranslationEngine::Connection.new .send_images(data.merge(locale: I18n.locale)) [ 200, { 'Content-Type' => 'application/json' }, [{ message: 'translations saved' }.to_json] ] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
translation_engine-0.0.2 | app/middlewares/translation_engine/screenshots_middleware.rb |
translation_engine-0.0.1 | app/middlewares/translation_engine/screenshots_middleware.rb |