Module: YandexCloud::Translate::Translate
- Included in:
- YandexCloud::Translate
- Defined in:
- lib/yandex_cloud/translate/translate.rb
Overview
Module for translation for text or phrase
Instance Method Summary collapse
-
#translate(args = {}) ⇒ Object
Translate.
Instance Method Details
#translate(args = {}) ⇒ Object
Translate
6 7 8 9 10 11 12 |
# File 'lib/yandex_cloud/translate/translate.rb', line 6 def translate(args = {}) # define params for request body = { 'folderId' => folder_id, 'text' => args[:text], 'source' => args[:source], 'target' => args[:target], 'format' => args[:format] } headers = { 'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => "Bearer #{iam_token}" } # make request self.class.post('/translate', query: body, headers: headers).parsed_response end |