Sha256: 24593f94ba253771ebf23956269461e51a8e4b50de026d2e22b8a782cabc7290

Contents?: true

Size: 915 Bytes

Versions: 17

Compression:

Stored size: 915 Bytes

Contents

class TreasureData::API
module Import

  ####
  ## Import API
  ##

  # @param [String] db
  # @param [String] table
  # @param [String] format
  # @param [String, StringIO] stream
  # @param [Fixnum] size
  # @param [String] unique_id
  # @return [Float] elapsed time
  def import(db, table, format, stream, size, unique_id=nil)
    if unique_id
      path = "/v3/table/import_with_id/#{e db}/#{e table}/#{unique_id}/#{format}"
    else
      path = "/v3/table/import/#{e db}/#{e table}/#{format}"
    end
    opts = {}
    if @host == DEFAULT_ENDPOINT
      opts[:host] = DEFAULT_IMPORT_ENDPOINT
    elsif @host == NEW_DEFAULT_ENDPOINT
      opts[:host] = NEW_DEFAULT_IMPORT_ENDPOINT
    end
    code, body, res = put(path, stream, size, opts)
    if code[0] != ?2
      raise_error("Import failed", res)
    end
    js = checked_json(body, %w[])
    time = js['elapsed_time'].to_f
    return time
  end

end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
td-client-0.8.83 lib/td/client/api/import.rb
td-client-0.8.82 lib/td/client/api/import.rb
td-client-0.8.81 lib/td/client/api/import.rb
td-client-0.8.80 lib/td/client/api/import.rb
td-client-0.8.79 lib/td/client/api/import.rb
td-client-0.8.78 lib/td/client/api/import.rb
td-client-0.9.0dev2 lib/td/client/api/import.rb
td-client-0.9.0dev1 lib/td/client/api/import.rb
td-client-0.8.77 lib/td/client/api/import.rb
td-client-0.8.76 lib/td/client/api/import.rb
td-client-0.8.75 lib/td/client/api/import.rb
td-client-0.8.74 lib/td/client/api/import.rb
td-client-0.8.73 lib/td/client/api/import.rb
td-client-0.8.72 lib/td/client/api/import.rb
td-client-0.8.71 lib/td/client/api/import.rb
td-client-0.8.70 lib/td/client/api/import.rb
td-client-0.8.69 lib/td/client/api/import.rb