Class: Toptranslation::Resource::ReferenceDocument
- Inherits:
-
Object
- Object
- Toptranslation::Resource::ReferenceDocument
- Defined in:
- lib/toptranslation/resource/reference_document.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#filesize ⇒ Object
readonly
Returns the value of attribute filesize.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
Instance Method Summary collapse
- #download(options = {}) ⇒ Object
- #download_url ⇒ Object
-
#initialize(connection, options = {}) ⇒ ReferenceDocument
constructor
A new instance of ReferenceDocument.
Constructor Details
#initialize(connection, options = {}) ⇒ ReferenceDocument
Returns a new instance of ReferenceDocument.
5 6 7 8 9 |
# File 'lib/toptranslation/resource/reference_document.rb', line 5 def initialize(connection, = {}) @connection = connection @options = update_from_response() end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def comment @comment end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def created_at @created_at end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def filename @filename end |
#filesize ⇒ Object (readonly)
Returns the value of attribute filesize.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def filesize @filesize end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def identifier @identifier end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
3 4 5 |
# File 'lib/toptranslation/resource/reference_document.rb', line 3 def mime_type @mime_type end |
Instance Method Details
#download(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/toptranslation/resource/reference_document.rb', line 11 def download( = {}) download_path = if [:path] [:path] else tempfile = Tempfile.new temp_path = tempfile.path tempfile.close temp_path end @connection.download(download_url, download_path) end |
#download_url ⇒ Object
23 24 25 |
# File 'lib/toptranslation/resource/reference_document.rb', line 23 def download_url @download_url ||= @connection.get("/reference_documents/#{identifier}/download", version: 2)['download_url'] end |