wetransfer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md} +0 -0
- data/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +4 -4
- data/.github/ISSUE_TEMPLATE/Bug_report.md +25 -0
- data/.github/ISSUE_TEMPLATE/Example_project.md +20 -0
- data/.github/ISSUE_TEMPLATE/Feature_request.md +17 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +26 -0
- data/README.md +41 -12
- data/examples/create_transfer.rb +1 -1
- data/lib/we_transfer_client.rb +2 -2
- data/lib/we_transfer_client/version.rb +1 -1
- data/spec/integration_spec.rb +4 -4
- data/wetransfer.gemspec +5 -0
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b127566b552bca3dc2cba123d42068d1da3d1207
|
4
|
+
data.tar.gz: a7a43758463d7b3843cca5dc9b63a725305626d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9c63a68dd28022d301f792f6e4e32c6dacb028a37977ae7da6bf84c0508aa2d4e1adf8a69aa70210114fdc92670b27f568f27acdbd64904949abe963c7cce2c
|
7
|
+
data.tar.gz: f32301712449dc9f4d7298356978d8802c4b82a2df9109a8222b18ac25555de568a2cd83ab371ee4a55a1d4bba8b280cd185aae6f344825c6dcb1363326b5eea
|
File without changes
|
@@ -106,11 +106,11 @@ project:
|
|
106
106
|
|
107
107
|
```bash
|
108
108
|
# Clone your fork of the repo into the current directory
|
109
|
-
git clone git@github.com:WeTransfer/
|
109
|
+
git clone git@github.com:WeTransfer/wetransfer_ruby_sdk.git
|
110
110
|
# Navigate to the newly cloned directory
|
111
|
-
cd
|
111
|
+
cd wetransfer_ruby_sdk
|
112
112
|
# Assign the original repo to a remote called "upstream"
|
113
|
-
git remote add upstream git@github.com:WeTransfer/
|
113
|
+
git remote add upstream git@github.com:WeTransfer/wetransfer_ruby_sdk.git
|
114
114
|
```
|
115
115
|
|
116
116
|
2. If you cloned a while ago, get the latest changes from upstream:
|
@@ -148,5 +148,5 @@ project:
|
|
148
148
|
|
149
149
|
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
|
150
150
|
license your work under the same license as that used by the project, which you
|
151
|
-
can see by clicking [here](https://github.com/WeTransfer/
|
151
|
+
can see by clicking [here](https://github.com/WeTransfer/wetransfer_ruby_sdk/blob/master/LICENSE.txt).
|
152
152
|
This provision also applies to the test files you include with the changed code as fixtures.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F41B Bug report"
|
3
|
+
about: "If something isn't working as expected \U0001F914"
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
**Describe the bug**
|
8
|
+
A clear and concise description of what the bug is.
|
9
|
+
|
10
|
+
**Input Code**
|
11
|
+
- REPL or Repo link if applicable, otherwise a sample of code that can help us reproduce the bug.
|
12
|
+
|
13
|
+
**Expected behavior**
|
14
|
+
A clear and concise description of what you expected to happen.
|
15
|
+
|
16
|
+
**Environment**
|
17
|
+
- SDK version(s): [e.g. v0.2.0, v1.0.0-beta.34]
|
18
|
+
- Ruby version: [e.g. 2.1.0, 2.4.3-patchXYZ, etc]
|
19
|
+
- OS: [e.g. OSX 10.13.4, Windows 10]
|
20
|
+
|
21
|
+
**Possible Solution**
|
22
|
+
<!--- Only if you have suggestions on a fix for the bug -->
|
23
|
+
|
24
|
+
**Additional context/Screenshots**
|
25
|
+
Add any other context about the problem here. If applicable, add screenshots to help explain.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F4AD Example project"
|
3
|
+
about: "I have an idea for an example project (and may want to implement it \U0001F62C)!"
|
4
|
+
|
5
|
+
---
|
6
|
+
**What's the "elevator pitch" for the project?**
|
7
|
+
A clear and concise - one sentence! - description of what the project is or could be.
|
8
|
+
|
9
|
+
**Describe a potential solution**
|
10
|
+
A clear and concise description of what could happen.
|
11
|
+
|
12
|
+
**Describe resources you've considered**
|
13
|
+
A clear and concise description of any resources you know of for making implementing your idea.
|
14
|
+
|
15
|
+
**Additional context**
|
16
|
+
Add any other context or screenshots about the project idea here.
|
17
|
+
|
18
|
+
**Boilerplate - leave this here to explain the intent of these kinds of issues**
|
19
|
+
Feel free to tackle this issue however you'd like - if you've got an idea for an example project, make the thing and let us know if we can help :-) - but this is also a good space for discussion and bouncing ideas off each other.
|
20
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
name: "\U0001F680 Feature request"
|
3
|
+
about: "I have a suggestion (and may want to implement it \U0001F642)!"
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
**Is your feature request related to a problem? Please describe.**
|
8
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
9
|
+
|
10
|
+
**Describe the solution you'd like**
|
11
|
+
A clear and concise description of what you want to happen.
|
12
|
+
|
13
|
+
**Describe alternatives you've considered**
|
14
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
15
|
+
|
16
|
+
**Additional context**
|
17
|
+
Add any other context or screenshots about the feature request here.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
## Proposed changes
|
2
|
+
|
3
|
+
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
|
4
|
+
|
5
|
+
## Types of changes
|
6
|
+
|
7
|
+
What types of changes does your code introduce to wetransfer_ruby_sdk?
|
8
|
+
_Put an `x` in the boxes that apply_
|
9
|
+
|
10
|
+
- [ ] Docs (missing or updated docs)
|
11
|
+
- [ ] Bugfix (non-breaking change which fixes an issue)
|
12
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
13
|
+
- [ ] Improvement / maintenance (removing technical debt, performance, tooling, etc...)
|
14
|
+
|
15
|
+
## Checklist
|
16
|
+
|
17
|
+
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
|
18
|
+
|
19
|
+
- [ ] I have read the [CONTRIBUTING](https://github.com/WeTransfer/wetransfer_ruby_sdk/blob/master/.github/CONTRIBUTING.md) doc
|
20
|
+
- [ ] I have added necessary documentation (if appropriate)
|
21
|
+
- [ ] Code changes are covered by unit tests.
|
22
|
+
- [ ] Any dependent changes have been merged and published in downstream modules
|
23
|
+
|
24
|
+
## Further comments
|
25
|
+
|
26
|
+
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
|
data/README.md
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
# WeTransfer
|
1
|
+
# WeTransfer Ruby SDK
|
2
2
|
|
3
|
-
An open source Ruby SDK for the WeTransfer
|
3
|
+
An open source Ruby SDK for the WeTransfer Public API
|
4
4
|
|
5
|
-
For your API key please visit our [developer portal](https://developers.wetransfer.com).
|
5
|
+
For your API key and additional info please visit our [developer portal](https://developers.wetransfer.com).
|
6
|
+
|
7
|
+
[![Build Status](https://travis-ci.com/WeTransfer/wetransfer_ruby_sdk.svg?token=fYsuJT8hjJt2hyWqaLsM&branch=master)](https://travis-ci.com/WeTransfer/wetransfer_ruby_sdk) [![Gem Version](https://badge.fury.io/rb/wetransfer.svg)](https://badge.fury.io/rb/wetransfer)
|
6
8
|
|
7
9
|
## Table of Contents
|
8
10
|
|
9
11
|
1. [Installation](#installation)
|
10
12
|
2. [Usage](#usage)
|
11
|
-
3. [
|
13
|
+
3. [Super simple transfers](#super-simple-transfers)
|
12
14
|
4. [Development](#development)
|
13
15
|
5. [Contributing](#contributing)
|
14
16
|
6. [License](#license)
|
@@ -19,7 +21,7 @@ For your API key please visit our [developer portal](https://developers.wetransf
|
|
19
21
|
Add this line to your application's Gemfile:
|
20
22
|
|
21
23
|
```ruby
|
22
|
-
gem '
|
24
|
+
gem 'wetransfer'
|
23
25
|
```
|
24
26
|
|
25
27
|
And then execute:
|
@@ -36,16 +38,30 @@ Or install it yourself as:
|
|
36
38
|
|
37
39
|
You'll need to retrieve an API key from [our developer portal](https://developers.wetransfer.com).
|
38
40
|
|
39
|
-
Be sure to not commit this key to Github! If you do though, no worries, you can always revoke & create a new key from within the portal.
|
41
|
+
Be sure to not commit this key to Github! If you do though, no worries, you can always revoke & create a new key from within the portal.
|
42
|
+
|
43
|
+
For configuring and storing secrets - like this API key - there are a variety of solutions. The smoothest here is creating a .env file:
|
44
|
+
|
45
|
+
Now that you've got a wonderful WeTransfer API key, create a .env file in your project folder:
|
46
|
+
|
47
|
+
$ touch .env
|
40
48
|
|
41
|
-
|
49
|
+
Check your `.gitignore` file and make sure it has `.env` listed!
|
50
|
+
|
51
|
+
Now, open the file in your text editor and add this line:
|
52
|
+
|
53
|
+
`WT_API_KEY=<your api key>` (without the <> brackets!)
|
54
|
+
|
55
|
+
Great! Now you can go to your project file and create the client:
|
42
56
|
|
43
57
|
```ruby
|
44
58
|
# In your project file:
|
59
|
+
require 'we_transfer_client'
|
60
|
+
|
45
61
|
@client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'))
|
46
62
|
```
|
47
63
|
|
48
|
-
Now that you've got the client set up you can use
|
64
|
+
Now that you've got the client set up you can use `create_transfer` to, well, create a transfer!
|
49
65
|
|
50
66
|
```ruby
|
51
67
|
transfer = @client.create_transfer(name: "My wonderful transfer", description: "I'm so excited to share this") do |upload|
|
@@ -60,19 +76,32 @@ transfer.shortened_url => "https://we.tl/SSBsb3ZlIHJ1Ynk="
|
|
60
76
|
The upload will be performed at the end of the block.
|
61
77
|
|
62
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! :)
|
63
80
|
|
64
|
-
After forking and cloning down the repo, run `
|
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
|
+
|
83
|
+
```
|
84
|
+
$ git clone <your fork>
|
85
|
+
$ cd wetransfer_ruby_sdk
|
86
|
+
$ bundle install
|
87
|
+
```
|
65
88
|
|
66
89
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
67
90
|
|
91
|
+
To execute to ruby specs, run:
|
92
|
+
|
93
|
+
```
|
94
|
+
$ bundle exec rspec
|
95
|
+
```
|
96
|
+
|
68
97
|
## Contributing
|
69
98
|
|
70
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/wetransfer/
|
99
|
+
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).
|
71
100
|
|
72
101
|
## License
|
73
102
|
|
74
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
103
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT) - the in-repo version of the license is [here](https://github.com/WeTransfer/wetransfer_ruby_sdk/blob/master/LICENSE.txt).
|
75
104
|
|
76
105
|
## Code of Conduct
|
77
106
|
|
78
|
-
Everyone interacting in the
|
107
|
+
Everyone interacting in the WeTransfer Ruby SDK project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/WeTransfer/wetransfer_ruby_sdk/blob/master/.github/CODE_OF_CONDUCT.md).
|
data/examples/create_transfer.rb
CHANGED
@@ -3,7 +3,7 @@ require 'dotenv'
|
|
3
3
|
Dotenv.load
|
4
4
|
|
5
5
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY')) # , logger: Logger.new($stderr))
|
6
|
-
transfer = client.create_transfer(
|
6
|
+
transfer = client.create_transfer(name: 'My amazing transfer', description: 'Hi there!') do |builder|
|
7
7
|
builder.add_file(name: File.basename(__FILE__), io: File.open(__FILE__, 'rb'))
|
8
8
|
builder.add_file(name: 'amazing.txt', io: StringIO.new('This is unbelievable'))
|
9
9
|
builder.add_file(name: 'huge.bin', io: File.open('/path/to/local/file.jpg', 'rb'))
|
data/lib/we_transfer_client.rb
CHANGED
@@ -83,11 +83,11 @@ class WeTransferClient
|
|
83
83
|
@logger = logger
|
84
84
|
end
|
85
85
|
|
86
|
-
def create_transfer(
|
86
|
+
def create_transfer(name:, description:)
|
87
87
|
builder = TransferBuilder.new
|
88
88
|
yield(builder)
|
89
89
|
raise 'The transfer you have tried to create contains no items' if builder.items.empty?
|
90
|
-
future_transfer = FutureTransfer.new(name:
|
90
|
+
future_transfer = FutureTransfer.new(name: name, description: description, items: builder.items)
|
91
91
|
create_and_upload(future_transfer)
|
92
92
|
end
|
93
93
|
|
data/spec/integration_spec.rb
CHANGED
@@ -26,7 +26,7 @@ describe WeTransferClient do
|
|
26
26
|
|
27
27
|
it 'is able to create a transfer start to finish, both with small and large files' do
|
28
28
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'), logger: test_logger)
|
29
|
-
transfer = client.create_transfer(
|
29
|
+
transfer = client.create_transfer(name: 'My amazing board', description: 'Hi there!') do |builder|
|
30
30
|
# Upload ourselves
|
31
31
|
add_result = builder.add_file(name: File.basename(__FILE__), io: File.open(__FILE__, 'rb'))
|
32
32
|
expect(add_result).to eq(true)
|
@@ -64,7 +64,7 @@ describe WeTransferClient do
|
|
64
64
|
it 'refuses to create a transfer with no items' do
|
65
65
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'), logger: test_logger)
|
66
66
|
expect {
|
67
|
-
client.create_transfer(
|
67
|
+
client.create_transfer(name: 'My amazing board', description: 'Hi there!') do |builder|
|
68
68
|
# ...do nothing
|
69
69
|
end
|
70
70
|
}.to raise_error(/no items/)
|
@@ -79,7 +79,7 @@ describe WeTransferClient do
|
|
79
79
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'), logger: test_logger)
|
80
80
|
expect(client).not_to receive(:faraday) # Since we will not be doing any requests - we fail earlier
|
81
81
|
expect {
|
82
|
-
client.create_transfer(
|
82
|
+
client.create_transfer(name: 'My amazing board', description: 'Hi there!') do |builder|
|
83
83
|
builder.add_file(name: 'broken', io: broken)
|
84
84
|
end
|
85
85
|
}.to raise_error(/failed somehow/)
|
@@ -90,7 +90,7 @@ describe WeTransferClient do
|
|
90
90
|
|
91
91
|
client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY'), logger: test_logger)
|
92
92
|
expect {
|
93
|
-
client.create_transfer(
|
93
|
+
client.create_transfer(name: 'My amazing board', description: 'Hi there!') do |builder|
|
94
94
|
builder.add_file(name: 'broken', io: broken)
|
95
95
|
end
|
96
96
|
}.to raise_error(/has a size of 0/)
|
data/wetransfer.gemspec
CHANGED
@@ -27,6 +27,11 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.bindir = 'exe'
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
|
+
spec.post_install_message = %q{
|
31
|
+
Warning: We have changed the syntax for the create_transfer method.
|
32
|
+
create_transfer(title:, message:) is now create_transfer(name:, description:)
|
33
|
+
Please update your usage accordingly. Thank you and our apologies for the disruption.
|
34
|
+
}
|
30
35
|
|
31
36
|
spec.add_dependency 'faraday', '~> 0.15'
|
32
37
|
spec.add_dependency 'ks', '~> 0.0.1'
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Berman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-05-
|
12
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -146,12 +146,16 @@ executables: []
|
|
146
146
|
extensions: []
|
147
147
|
extra_rdoc_files: []
|
148
148
|
files:
|
149
|
+
- ".github/CODE_OF_CONDUCT.md"
|
150
|
+
- ".github/CONTRIBUTING.md"
|
151
|
+
- ".github/ISSUE_TEMPLATE/Bug_report.md"
|
152
|
+
- ".github/ISSUE_TEMPLATE/Example_project.md"
|
153
|
+
- ".github/ISSUE_TEMPLATE/Feature_request.md"
|
154
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
149
155
|
- ".gitignore"
|
150
156
|
- ".rspec"
|
151
157
|
- ".rubocop.yml"
|
152
158
|
- ".travis.yml"
|
153
|
-
- CODE_OF_CONDUCT.md
|
154
|
-
- CONTRIBUTING.md
|
155
159
|
- Gemfile
|
156
160
|
- LICENSE.txt
|
157
161
|
- README.md
|
@@ -168,7 +172,10 @@ licenses:
|
|
168
172
|
- MIT
|
169
173
|
metadata:
|
170
174
|
allowed_push_host: https://rubygems.org
|
171
|
-
post_install_message:
|
175
|
+
post_install_message: "\n Warning: We have changed the syntax for the create_transfer
|
176
|
+
method.\n create_transfer(title:, message:) is now create_transfer(name:, description:)\n
|
177
|
+
\ Please update your usage accordingly. Thank you and our apologies for the disruption.\n
|
178
|
+
\ "
|
172
179
|
rdoc_options: []
|
173
180
|
require_paths:
|
174
181
|
- lib
|