wetransfer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/lib/we_transfer_client.rb +0 -1
- data/lib/we_transfer_client/version.rb +1 -1
- data/spec/integration_spec.rb +6 -12
- data/spec/spec_helper.rb +19 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdd9e1dde8effa9bce088e6339dd19213adbd865
|
4
|
+
data.tar.gz: 9b93c2b1712d70f3a127f8b78fd088cf9f9aaf38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6402e0660e1dab0fca754caae6634562cfc8fe029a05d3a590d481124fb5a04ecf311ce0cd6afdc23a25da9e8063b454105cb91bbe00a1d4b933bd28b2c2de
|
7
|
+
data.tar.gz: 7a70a9be5367f7f30adafe69b79fd18a197b1aeed22a2e14958352091b9444b0319bb0c1d77110cbba4e4f5c922eee0abcd92cc2814c82476a408b87db92ba3b
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Or install it yourself as:
|
|
34
34
|
|
35
35
|
## Usage
|
36
36
|
|
37
|
-
###
|
37
|
+
### Minimalist transfers
|
38
38
|
|
39
39
|
You'll need to retrieve an API key from [our developer portal](https://developers.wetransfer.com).
|
40
40
|
|
@@ -76,7 +76,7 @@ transfer.shortened_url => "https://we.tl/SSBsb3ZlIHJ1Ynk="
|
|
76
76
|
The upload will be performed at the end of the block.
|
77
77
|
|
78
78
|
## Development
|
79
|
-
You'll need to retrieve an API key from [our developer portal](https://developers.wetransfer.com), and store it in a local `.env` file. As always, do not commit this file to github! :)
|
79
|
+
You'll need to retrieve an API key from [our developer portal](https://developers.wetransfer.com), and as described above, store it in a local `.env` file. As always, do not commit this file to github! :)
|
80
80
|
|
81
81
|
After forking and cloning down the repo, run `bundle install` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
82
82
|
|
@@ -94,6 +94,16 @@ To execute to ruby specs, run:
|
|
94
94
|
$ bundle exec rspec
|
95
95
|
```
|
96
96
|
|
97
|
+
Please note that we use rubocop to lint this gem -- be sure to run it prior to submitting a PR for maximum mergeability.
|
98
|
+
|
99
|
+
$ bundle exec rubocop
|
100
|
+
|
101
|
+
If any violations can be handled by rubocop, you can run auto-fix and it'll handle them for you, though do run the tests again and make sure it hasn't done something ... unexpected.
|
102
|
+
|
103
|
+
$ bundle exec rubocop -a
|
104
|
+
|
105
|
+
Hooray!
|
106
|
+
|
97
107
|
## Contributing
|
98
108
|
|
99
109
|
Bug reports and pull requests are welcome on GitHub at https://github.com/wetransfer/wetransfer_ruby_sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. More extensive contribution guidelines can be found [here](https://github.com/WeTransfer/wetransfer_ruby_sdk/blob/master/.github/CONTRIBUTING.md).
|
data/lib/we_transfer_client.rb
CHANGED
@@ -86,7 +86,6 @@ class WeTransferClient
|
|
86
86
|
def create_transfer(name:, description:)
|
87
87
|
builder = TransferBuilder.new
|
88
88
|
yield(builder)
|
89
|
-
raise 'The transfer you have tried to create contains no items' if builder.items.empty?
|
90
89
|
future_transfer = FutureTransfer.new(name: name, description: description, items: builder.items)
|
91
90
|
create_and_upload(future_transfer)
|
92
91
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'bundler'
|
3
|
-
Bundler.setup
|
4
|
-
|
5
|
-
require 'dotenv'
|
6
|
-
Dotenv.load
|
1
|
+
require 'spec_helper'
|
7
2
|
|
8
3
|
require_relative '../lib/we_transfer_client.rb'
|
9
4
|
|
@@ -61,13 +56,12 @@ describe WeTransferClient do
|
|
61
56
|
expect(response['location']).to start_with('https://wetransfer')
|
62
57
|
end
|
63
58
|
|
64
|
-
it '
|
59
|
+
it 'is able to create a transfer with no items' do
|
65
60
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'), logger: test_logger)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}.to raise_error(/no items/)
|
61
|
+
response = client.create_transfer(name: 'My amazing board', description: 'Hi there!') do |builder|
|
62
|
+
end
|
63
|
+
expect(response[:size]).to eq(0)
|
64
|
+
expect(response[:items]).to eq([])
|
71
65
|
end
|
72
66
|
|
73
67
|
it 'refuses to create a transfer when reading an IO raises an error' do
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter '/spec/'
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'we_transfer_client'
|
7
|
+
require 'pry'
|
8
|
+
require 'rspec'
|
9
|
+
require 'bundler'
|
10
|
+
Bundler.setup
|
11
|
+
require 'tempfile'
|
12
|
+
require 'dotenv'
|
13
|
+
Dotenv.load
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |c|
|
17
|
+
c.syntax = :expect
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wetransfer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Berman
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/we_transfer_client.rb
|
167
167
|
- lib/we_transfer_client/version.rb
|
168
168
|
- spec/integration_spec.rb
|
169
|
+
- spec/spec_helper.rb
|
169
170
|
- wetransfer.gemspec
|
170
171
|
homepage: https://developers.wetransfer.com
|
171
172
|
licenses:
|