Class: DeepL::Requests::StyleRule::UpdateCustomInstruction
- Includes:
- Helpers
- Defined in:
- lib/deepl/requests/style_rule/update_custom_instruction.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
Instance Method Summary collapse
-
#initialize(api, style_id, instruction_id, label, prompt, source_language = nil, options = {}) ⇒ UpdateCustomInstruction
constructor
rubocop:disable Metrics/ParameterLists.
- #request ⇒ Object
- #to_s ⇒ Object
Methods inherited from Base
accepted_options, accepts_options, #details, inherited, validate_options!
Constructor Details
#initialize(api, style_id, instruction_id, label, prompt, source_language = nil, options = {}) ⇒ UpdateCustomInstruction
rubocop:disable Metrics/ParameterLists
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/deepl/requests/style_rule/update_custom_instruction.rb', line 12 def initialize(api, style_id, instruction_id, label, prompt, # rubocop:disable Metrics/ParameterLists source_language = nil, = {}) super(api, ) @style_id = style_rule_id(style_id) @instruction_id = custom_instruction_id(instruction_id) check_non_empty!(label: label, prompt: prompt) @label = label @prompt = prompt validate_language!('source_language', source_language, optional: true) @source_language = source_language end |
Instance Method Details
#request ⇒ Object
24 25 26 27 28 |
# File 'lib/deepl/requests/style_rule/update_custom_instruction.rb', line 24 def request payload = { label: @label, prompt: @prompt } payload[:source_language] = @source_language if @source_language build_custom_instruction(*execute_request_with_retries(put_request(payload))) end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/deepl/requests/style_rule/update_custom_instruction.rb', line 30 def to_s "PUT #{uri.request_uri}" end |