Class: DeepL::Requests::TranslationMemory::StorageBase

Inherits:
Base
  • Object
show all
Defined in:
lib/deepl/requests/translation_memory/storage_base.rb

Overview

Common behaviour of the requests to a pre-signed storage URL handed out by the API, such as a translation memory upload or download URL. Those URLs point outside of the DeepL API, so they are requested over their own connection and send only the User-Agent: neither the DeepL Authorization header nor other caller headers. That connection uses the same proxy, SSL and timeout options as the API connection. A non-2xx response raises a plain DeepL::Exceptions::Error.

Direct Known Subclasses

DownloadExport, UploadFile

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, #request, validate_options!

Constructor Details

#initialize(api, storage_url, options = {}, additional_headers = {}) ⇒ StorageBase

Returns a new instance of StorageBase.



20
21
22
23
24
25
26
27
# File 'lib/deepl/requests/translation_memory/storage_base.rb', line 20

def initialize(api, storage_url, options = {}, additional_headers = {})
  super(api, options, additional_headers)
  if storage_url.nil? || storage_url.empty?
    raise ArgumentError, 'Storage URL must not be empty'
  end

  @storage_url = storage_url
end

Instance Attribute Details

#storage_url ⇒ Object (readonly)

Returns the value of attribute storage_url.



18
19
20
# File 'lib/deepl/requests/translation_memory/storage_base.rb', line 18

def storage_url
  @storage_url
end