Class: DeepL::Requests::SpokenTerms::Update

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/deepl/requests/spoken_terms/update.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, id, name, term_lists, options = {}) ⇒ Update

Returns a new instance of Update.



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

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

Instance Attribute Details

#id ⇒ Object (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/deepl/requests/spoken_terms/update.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/update.rb', line 12

def term_lists
  @term_lists
end

Instance Method Details

#request ⇒ Object



21
22
23
24
25
26
# File 'lib/deepl/requests/spoken_terms/update.rb', line 21

def request
  payload = {}
  payload[:name] = name unless name.nil?
  payload[:term_lists] = term_lists_payload(term_lists) unless term_lists.nil?
  build_spoken_terms(*execute_request_with_retries(patch_request(payload)))
end

#to_s ⇒ Object



28
29
30
# File 'lib/deepl/requests/spoken_terms/update.rb', line 28

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