app/controllers/translations_controller.rb in autotolk-0.1.2 vs app/controllers/translations_controller.rb in autotolk-0.1.3
- old
+ new
@@ -1,9 +1,13 @@
+require 'bing_translator'
+
class TranslationsController < ApplicationController
skip_before_action :authenticate_user!, :validate_subdomain
def translate
- translated = AutoTranslator.new(original: params[:original], to: params[:to]).perform
+ translator = BingTranslator.new( Autotolk.bing_client_id, Autotolk.bing_client_secret,
+ false, Autotolk.azure_account_key)
+ translated = translator.translate params[:original], :to => params[:to]
render json: {status: 200, translated: translated}
rescue Exception => e
render json: {status: 500, error: e}
end