module Yandex::Translator::Translate
Translate
module
Public Instance Methods
translate(args = {})
click to toggle source
Translate
text
# File lib/yandex/translator/translate.rb, line 6 def translate(args = {}) check_args(text: args[:text], to: args[:to]) translate_direction = args[:from].nil? ? args[:to] : "#{args[:from]}-#{args[:to]}" response = request('/translate', lang: translate_direction, text: args[:text]) response.parsed_response rescue YandexFailure => ex return { error: ex.message } end