Sha256: 3711fe9d5d1168199f026dc6f746fb7552c57830cb8041d1002ecd8cd2140040

Contents?: true

Size: 586 Bytes

Versions: 8

Compression:

Stored size: 586 Bytes

Contents

require_relative 'we_transfer_client'
require 'dotenv'
Dotenv.load

client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY')) # , logger: Logger.new($stderr))
transfer = client.create_transfer(name: 'My amazing transfer', description: 'Hi there!') do |builder|
  builder.add_file(name: File.basename(__FILE__), io: File.open(__FILE__, 'rb'))
  builder.add_file(name: 'amazing.txt', io: StringIO.new('This is unbelievable'))
  builder.add_file(name: 'huge.bin', io: File.open('/path/to/local/file.jpg', 'rb'))
  builder.add_file_at(path: __FILE__)
end

puts transfer.shortened_url

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wetransfer-0.4.4 examples/create_transfer.rb
wetransfer-0.4.3 examples/create_transfer.rb
wetransfer-0.4.2 examples/create_transfer.rb
wetransfer-0.4.1 examples/create_transfer.rb
wetransfer-0.4.0 examples/create_transfer.rb
wetransfer-0.3.2 examples/create_transfer.rb
wetransfer-0.3.1 examples/create_transfer.rb
wetransfer-0.3.0 examples/create_transfer.rb