Class: Yandex::Translate::Client
- Inherits:
-
Object
- Object
- Yandex::Translate::Client
- Defined in:
- lib/yandex-translate.rb
Instance Method Summary collapse
- #detect(text) ⇒ Object
- #get_langs(lang = 'en') ⇒ Object
-
#initialize(key) ⇒ Client
constructor
A new instance of Client.
- #translate(text, lang = 'ru', format = 'plain') ⇒ Object
Constructor Details
Instance Method Details
#detect(text) ⇒ Object
15 16 17 18 |
# File 'lib/yandex-translate.rb', line 15 def detect(text) data = {"text" => text} return @connect.get('detect', data) end |
#get_langs(lang = 'en') ⇒ Object
10 11 12 13 |
# File 'lib/yandex-translate.rb', line 10 def get_langs(lang = 'en') data = {"ui" => lang} return @connect.get('getLangs', data) end |
#translate(text, lang = 'ru', format = 'plain') ⇒ Object
20 21 22 23 |
# File 'lib/yandex-translate.rb', line 20 def translate(text, lang = 'ru', format = 'plain') data = {"text" => text, "lang" => lang, "format" => format} return @connect.get('translate', data) end |