Class: DeepL::Requests::StyleProfile::Create
- Defined in:
- lib/deepl/requests/style_profile/create.rb
Constant Summary
Constants inherited from Base
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
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(api, name, fields, options = {}) ⇒ Create
constructor
A new instance of Create.
- #request ⇒ Object
- #to_s ⇒ Object
Methods inherited from Base
accepted_options, accepts_options, #details, inherited, validate_options!
Constructor Details
#initialize(api, name, fields, options = {}) ⇒ Create
Returns a new instance of Create.
12 13 14 15 16 |
# File 'lib/deepl/requests/style_profile/create.rb', line 12 def initialize(api, name, fields, = {}) super(api, ) @name = name @fields = fields end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
10 11 12 |
# File 'lib/deepl/requests/style_profile/create.rb', line 10 def fields @fields end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/deepl/requests/style_profile/create.rb', line 10 def name @name end |
Instance Method Details
#request ⇒ Object
18 19 20 21 |
# File 'lib/deepl/requests/style_profile/create.rb', line 18 def request payload = { name: name }.merge(optional_fields_payload(fields)) build_style_profile(*execute_request_with_retries(post_request(payload))) end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/deepl/requests/style_profile/create.rb', line 23 def to_s "POST #{uri.request_uri}" end |