Class: DeepL::Requests::Glossary::Create
- Defined in:
- lib/deepl/requests/glossary/create.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#entries_format ⇒ Object
readonly
Returns the value of attribute entries_format.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_lang ⇒ Object
readonly
Returns the value of attribute source_lang.
-
#target_lang ⇒ Object
readonly
Returns the value of attribute target_lang.
Attributes inherited from Base
Instance Method Summary collapse
- #details ⇒ Object
-
#initialize(api, name, source_lang, target_lang, entries, options = {}) ⇒ Create
constructor
A new instance of Create.
- #request ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(api, name, source_lang, target_lang, entries, options = {}) ⇒ Create
Returns a new instance of Create.
12 13 14 15 16 17 18 19 |
# File 'lib/deepl/requests/glossary/create.rb', line 12 def initialize(api, name, source_lang, target_lang, entries, = {}) super(api, ) @name = name @source_lang = source_lang @target_lang = target_lang @entries = entries @entries_format = delete_option(:entries_format) || 'tsv' end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
10 11 12 |
# File 'lib/deepl/requests/glossary/create.rb', line 10 def entries @entries end |
#entries_format ⇒ Object (readonly)
Returns the value of attribute entries_format.
10 11 12 |
# File 'lib/deepl/requests/glossary/create.rb', line 10 def entries_format @entries_format end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/deepl/requests/glossary/create.rb', line 10 def name @name end |
#source_lang ⇒ Object (readonly)
Returns the value of attribute source_lang.
10 11 12 |
# File 'lib/deepl/requests/glossary/create.rb', line 10 def source_lang @source_lang end |
#target_lang ⇒ Object (readonly)
Returns the value of attribute target_lang.
10 11 12 |
# File 'lib/deepl/requests/glossary/create.rb', line 10 def target_lang @target_lang end |
Instance Method Details
#details ⇒ Object
29 30 31 32 33 34 |
# File 'lib/deepl/requests/glossary/create.rb', line 29 def details "HTTP Headers: #{headers}\nPayload #{{ name: name, source_lang: source_lang, target_lang: target_lang, entries: entries_to_tsv, entries_format: entries_format }}" end |
#request ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/deepl/requests/glossary/create.rb', line 21 def request payload = { name: name, source_lang: source_lang, target_lang: target_lang, entries: entries_to_tsv, entries_format: entries_format } build_glossary(*execute_request_with_retries(post_request(payload))) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/deepl/requests/glossary/create.rb', line 36 def to_s "POST #{uri.request_uri}" end |