class Toptranslation::Resource::Upload

Attributes

document_store_id[R]
document_token[R]
sha1[R]

Public Class Methods

new(connection, options = {}) click to toggle source
# File lib/toptranslation/resource/upload.rb, line 5
def initialize(connection, options = {})
  @connection = connection
  @options = options
end

Public Instance Methods

upload(filepath, type = 'document', &block) click to toggle source
# 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