Class: DeepL::Requests::SpokenTerms::Create

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/deepl/requests/spoken_terms/create.rb

Constant Summary

Constants inherited from Base

Base::MAX_GLOSSARY_IDS, Base::NETWORK_ERRORS, Base::RESPONSE_FORMAT_ERRORS, Base::RETRYABLE_NETWORK_ERRORS, Base::TECHNICAL_HEADERS

Instance Attribute Summary collapse

Attributes inherited from Base

#api, #options, #response

Instance Method Summary collapse

Methods inherited from Base

accepted_options, accepts_options, #details, inherited, validate_options!

Constructor Details

#initialize(api, name, term_lists, options = {}) ⇒ Create

Returns a new instance of Create.



14
15
16
17
18
# File 'lib/deepl/requests/spoken_terms/create.rb', line 14

def initialize(api, name, term_lists, options = {})
  super(api, options)
  @name = name
  @term_lists = term_lists
end

Instance Attribute Details

#name ⇒ Object (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/deepl/requests/spoken_terms/create.rb', line 12

def name
  @name
end

#term_lists ⇒ Object (readonly)

Returns the value of attribute term_lists.



12
13
14
# File 'lib/deepl/requests/spoken_terms/create.rb', line 12

def term_lists
  @term_lists
end

Instance Method Details

#request ⇒ Object



20
21
22
23
# File 'lib/deepl/requests/spoken_terms/create.rb', line 20

def request
  payload = { name: name, term_lists: term_lists_payload(term_lists) }
  build_spoken_terms(*execute_request_with_retries(post_request(payload)))
end

#to_s ⇒ Object



25
26
27
# File 'lib/deepl/requests/spoken_terms/create.rb', line 25

def to_s
  "POST #{uri.request_uri}"
end