Class: Toptranslation::Resource::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/toptranslation/resource/translation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, options = {}) ⇒ Translation

Returns a new instance of Translation.



6
7
8
9
10
# File 'lib/toptranslation/resource/translation.rb', line 6

def initialize(connection, options = {})
  @connection = connection
  @options = options
  update_from_response(options)
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def created_at
  @created_at
end

#external_checksumObject (readonly)

Returns the value of attribute external_checksum.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def external_checksum
  @external_checksum
end

#filenameObject (readonly)

Returns the value of attribute filename.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def filename
  @filename
end

#filesizeObject (readonly)

Returns the value of attribute filesize.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def filesize
  @filesize
end

#identifierObject (readonly)

Returns the value of attribute identifier.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def identifier
  @identifier
end

#localeObject (readonly)

Returns the value of attribute locale.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def locale
  @locale
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def mime_type
  @mime_type
end

#progressObject (readonly)

Returns the value of attribute progress.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def progress
  @progress
end

#segments_sha1Object (readonly)

Returns the value of attribute segments_sha1.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def segments_sha1
  @segments_sha1
end

#sha1Object (readonly)

Returns the value of attribute sha1.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def sha1
  @sha1
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



3
4
5
# File 'lib/toptranslation/resource/translation.rb', line 3

def updated_at
  @updated_at
end

Instance Method Details

#downloadObject



18
19
20
# File 'lib/toptranslation/resource/translation.rb', line 18

def download
  @connection.download(download_url, @filename)
end

#reference_documentsObject



12
13
14
15
16
# File 'lib/toptranslation/resource/translation.rb', line 12

def reference_documents
  @reference_documents ||= @options['reference_documents'].inject([]) do |accu, reference_document|
    accu << ReferenceDocument.new(@connection, reference_document)
  end
end