Class: DeepL::Requests::StyleRule::Update

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/deepl/requests/style_rule/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

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, style_id, name, options = {}) ⇒ Update

Returns a new instance of Update.



12
13
14
15
16
17
# File 'lib/deepl/requests/style_rule/update.rb', line 12

def initialize(api, style_id, name, options = {})
  super(api, options)
  @style_id = style_rule_id(style_id)
  check_non_empty!(name: name)
  @name = name
end

Instance Method Details

#request ⇒ Object



19
20
21
22
# File 'lib/deepl/requests/style_rule/update.rb', line 19

def request
  payload = { name: @name }
  build_style_rule(*execute_request_with_retries(patch_request(payload)))
end

#to_s ⇒ Object



24
25
26
# File 'lib/deepl/requests/style_rule/update.rb', line 24

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