Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Move file upload responsibility #44

Open
arnoFleming opened this issue Oct 5, 2018 · 0 comments
Open

Move file upload responsibility #44

arnoFleming opened this issue Oct 5, 2018 · 0 comments
Assignees
Labels
Ruby SDK v1 All API v2 functionality usable

Comments

@arnoFleming
Copy link
Contributor

arnoFleming commented Oct 5, 2018

At the moment we use the client object to add items to a board or transfer (here we'll use a board as an example):

@client = WeTransfer::Client.new(api_key: "foo")
board = @client.create_board( ... )
@client.add_items(board: board)  do |builder|
  builder.add_file(name: File.basename(__FILE__), io: File.open(__FILE__, 'rb'))
  builder.add_file_at(path: fixtures_dir + 'Japan-01.jpg')
  builder.add_web_url(url: 'http://www.google.com', title: 'google')
end

or file uploads but we should make the transfer or board responsible for file upload, not the client.

@client = WeTransfer::Client.new(api_key: "foo")
board = @client.create_board( ... )
board.add_items do |builder| 
  builder.add_file(name: File.basename(__FILE__), io: File.open(__FILE__, 'rb'))
  builder.add_file_at(path: fixtures_dir + 'Japan-01.jpg')
  builder.add_web_url(url: 'http://www.google.com', title: 'google')
end

Please note that there are tests that are skipped because we don't want the original behaviour -- you should change and then implement -- search for the string "this interface is still experimental" to see them.

@arnoFleming arnoFleming changed the title Ruby SDK: make the transfer or board responsible for file upload, not the client Move file upload responsibility Oct 5, 2018
@arnoFleming arnoFleming added the Ruby SDK v1 All API v2 functionality usable label Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ruby SDK v1 All API v2 functionality usable
Projects
None yet
Development

No branches or pull requests

2 participants