Sha256: 2ae25eec5bead8375b1927507ede7e7c4ac8114028a1c021aa3a322174d2c945

Contents?: true

Size: 498 Bytes

Versions: 3

Compression:

Stored size: 498 Bytes

Contents

require 'bing_translator'

class TranslationsController < ApplicationController
  skip_before_action :authenticate_user!, :validate_subdomain

  def translate
    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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
autotolk-0.1.3 app/controllers/translations_controller.rb
autotolk-0.1.1 app/controllers/translations_controller.rb
autotolk-0.1.0 app/controllers/translations_controller.rb