Class: DeepL::Resources::TranslationMemoryJob
- Defined in:
- lib/deepl/resources/translation_memory_job.rb
Overview
Status of a translation memory import or export job. The API returns exactly one result.
Constant Summary collapse
- OPERATION_IMPORT =
'import'- OPERATION_EXPORT =
'export'
Instance Attribute Summary collapse
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#product ⇒ Object
readonly
Returns the value of attribute product.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#source_content_length ⇒ Object
readonly
Returns the value of attribute source_content_length.
-
#source_content_type ⇒ Object
readonly
Returns the value of attribute source_content_type.
-
#translation_memory_id ⇒ Object
readonly
Returns the value of attribute translation_memory_id.
-
#updated_time ⇒ Object
readonly
Returns the value of attribute updated_time.
Attributes inherited from Base
Instance Method Summary collapse
- #awaiting_input? ⇒ Boolean
- #error? ⇒ Boolean
- #error_message ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(job, *args) ⇒ TranslationMemoryJob
constructor
A new instance of TranslationMemoryJob.
-
#result ⇒ DeepL::Resources::TranslationMemoryJobResult?
The single result of the job, or nil if the API returned none.
- #status ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(job, *args) ⇒ TranslationMemoryJob
Returns a new instance of TranslationMemoryJob.
81 82 83 84 85 86 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 81 def initialize(job, *args) super(*args) extract_basic_fields(job) extract_parameters(job) @results = (job['results'] || []).map { |result| TranslationMemoryJobResult.new(result) } end |
Instance Attribute Details
#creation_time ⇒ Object (readonly)
Returns the value of attribute creation_time.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def creation_time @creation_time end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def display_name @display_name end |
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def job_id @job_id end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def operation @operation end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def product @product end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def results @results end |
#source_content_length ⇒ Object (readonly)
Returns the value of attribute source_content_length.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def source_content_length @source_content_length end |
#source_content_type ⇒ Object (readonly)
Returns the value of attribute source_content_type.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def source_content_type @source_content_type end |
#translation_memory_id ⇒ Object (readonly)
Returns the value of attribute translation_memory_id.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def translation_memory_id @translation_memory_id end |
#updated_time ⇒ Object (readonly)
Returns the value of attribute updated_time.
77 78 79 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 77 def updated_time @updated_time end |
Instance Method Details
#awaiting_input? ⇒ Boolean
105 106 107 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 105 def awaiting_input? result ? result.awaiting_input? : false end |
#error? ⇒ Boolean
109 110 111 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 109 def error? result ? result.error? : false end |
#error_message ⇒ Object
113 114 115 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 113 def result&. end |
#finished? ⇒ Boolean
101 102 103 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 101 def finished? result ? result.finished? : false end |
#result ⇒ DeepL::Resources::TranslationMemoryJobResult?
The single result of the job, or nil if the API returned none.
93 94 95 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 93 def result results.first end |
#status ⇒ Object
97 98 99 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 97 def status result&.status end |
#to_s ⇒ Object
117 118 119 |
# File 'lib/deepl/resources/translation_memory_job.rb', line 117 def to_s "TranslationMemoryJob: #{operation} - ID: #{job_id} - Status: #{status}" end |