Class: DeepL::Requests::TranslationMemory::UploadFile
- Inherits:
-
StorageBase
- Object
- Base
- StorageBase
- DeepL::Requests::TranslationMemory::UploadFile
- Defined in:
- lib/deepl/requests/translation_memory/upload_file.rb
Constant Summary collapse
- DEFAULT_CONTENT_TYPE =
'application/xml'
Constants inherited from Base
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#file_content ⇒ Object
readonly
Returns the value of attribute file_content.
Attributes inherited from StorageBase
Attributes inherited from Base
Instance Method Summary collapse
- #details ⇒ Object
-
#initialize(api, upload_url, file_content, content_type = DEFAULT_CONTENT_TYPE) ⇒ UploadFile
constructor
A new instance of UploadFile.
- #request ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(api, upload_url, file_content, content_type = DEFAULT_CONTENT_TYPE) ⇒ UploadFile
Returns a new instance of UploadFile.
14 15 16 17 18 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 14 def initialize(api, upload_url, file_content, content_type = DEFAULT_CONTENT_TYPE) super(api, upload_url) @file_content = file_content @content_type = content_type || DEFAULT_CONTENT_TYPE end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
12 13 14 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 12 def content_type @content_type end |
#file_content ⇒ Object (readonly)
Returns the value of attribute file_content.
12 13 14 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 12 def file_content @file_content end |
Instance Method Details
#details ⇒ Object
24 25 26 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 24 def details "HTTP Headers: #{headers}\nPayload #{file_content.bytesize} byte(s)" end |
#request ⇒ Object
20 21 22 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 20 def request build_response(*execute_request_with_retries(put_request)) end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/deepl/requests/translation_memory/upload_file.rb', line 28 def to_s "PUT #{uri.request_uri}" end |