Sha256: b38b5e9f1d17361dbc618fba46d831cc7b7b4058abe418735aa65cc028cd56fa

Contents?: true

Size: 477 Bytes

Versions: 11

Compression:

Stored size: 477 Bytes

Contents

# -*- encoding : utf-8 -*-
module AbAdmin
  module I18nTools
    class TranslateApp
      def self.call(env)
        if env['warden'].user
          params = Rack::Request.new(env).params
          body = {text: AbAdmin::I18nTools::GoogleTranslate.t(params['q'], params['from'], params['to'])}
          [200, {'Content-Type' => 'application/json'}, body.to_json]
        else
          [401, {'Content-Type' => 'application/json'}, '']
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ab_admin-0.6.1 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.6.0 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.5.0 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.4.0 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.6 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.5 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.4 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.3 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.2 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.1 lib/ab_admin/i18n_tools/translate_app.rb
ab_admin-0.3.0 lib/ab_admin/i18n_tools/translate_app.rb