Class: Toptranslation::Resource::Upload
- Inherits:
-
Object
- Object
- Toptranslation::Resource::Upload
- Defined in:
- lib/toptranslation/resource/upload.rb
Instance Attribute Summary collapse
-
#document_store_id ⇒ Object
readonly
Returns the value of attribute document_store_id.
-
#document_token ⇒ Object
readonly
Returns the value of attribute document_token.
-
#sha1 ⇒ Object
readonly
Returns the value of attribute sha1.
Instance Method Summary collapse
-
#initialize(connection, options = {}) ⇒ Upload
constructor
A new instance of Upload.
- #upload(filepath, type = 'document', &block) ⇒ Object
Constructor Details
#initialize(connection, options = {}) ⇒ Upload
Returns a new instance of Upload.
5 6 7 8 |
# File 'lib/toptranslation/resource/upload.rb', line 5 def initialize(connection, = {}) @connection = connection @options = end |
Instance Attribute Details
#document_store_id ⇒ Object (readonly)
Returns the value of attribute document_store_id.
3 4 5 |
# File 'lib/toptranslation/resource/upload.rb', line 3 def document_store_id @document_store_id end |
#document_token ⇒ Object (readonly)
Returns the value of attribute document_token.
3 4 5 |
# File 'lib/toptranslation/resource/upload.rb', line 3 def document_token @document_token end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
3 4 5 |
# File 'lib/toptranslation/resource/upload.rb', line 3 def sha1 @sha1 end |
Instance Method Details
#upload(filepath, type = 'document', &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/toptranslation/resource/upload.rb', line 10 def upload(filepath, type = 'document', &block) puts "# Uploading: #{filepath}" if @connection.verbose response = @connection.upload(filepath, type, &block) @document_store_id = response['identifier'] @document_token = response['document_token'] @sha1 = response['sha1'] self end |