Class: DeepL::Requests::TranslateText
- Defined in:
- lib/deepl/requests/translate_text.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#source_lang ⇒ Object
readonly
Returns the value of attribute source_lang.
-
#target_lang ⇒ Object
readonly
Returns the value of attribute target_lang.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(api, text, source_lang, target_lang) ⇒ TranslateText
constructor
A new instance of TranslateText.
- #request ⇒ Object
Constructor Details
#initialize(api, text, source_lang, target_lang) ⇒ TranslateText
Returns a new instance of TranslateText.
6 7 8 9 10 11 |
# File 'lib/deepl/requests/translate_text.rb', line 6 def initialize(api, text, source_lang, target_lang) super(api) @text = text @source_lang = source_lang @target_lang = target_lang end |
Instance Attribute Details
#source_lang ⇒ Object (readonly)
Returns the value of attribute source_lang.
4 5 6 |
# File 'lib/deepl/requests/translate_text.rb', line 4 def source_lang @source_lang end |
#target_lang ⇒ Object (readonly)
Returns the value of attribute target_lang.
4 5 6 |
# File 'lib/deepl/requests/translate_text.rb', line 4 def target_lang @target_lang end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/deepl/requests/translate_text.rb', line 4 def text @text end |
Instance Method Details
#request ⇒ Object
13 14 15 16 |
# File 'lib/deepl/requests/translate_text.rb', line 13 def request payload = { text: text, source_lang: source_lang, target_lang: target_lang } build_texts(*post(payload)) end |