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

Updates rake to 12.3.3 #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/we_transfer_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def complete_file!(object:, file:)
end

def check_for_file_duplicates(files, new_file)
if files.select { |file| file.name == new_file.name }.size != 1
raise ArgumentError, 'Duplicate file entry'
end
raise ArgumentError, 'Duplicate file entry' if files.select { |file| file.name == new_file.name }.size != 1
end

def put_io_in_parts(object:, file:, io:)
Expand Down Expand Up @@ -76,9 +74,7 @@ def authorize_if_no_bearer_token!
response = faraday.post('/v2/authorize', '{}', 'Content-Type' => 'application/json', 'X-API-Key' => @api_key)
ensure_ok_status!(response)
@bearer_token = JSON.parse(response.body, symbolize_names: true)[:token]
if @bearer_token.nil? || @bearer_token.empty?
raise Error, "The authorization call returned #{response.body} and no usable :token key could be found there"
end
raise Error, "The authorization call returned #{response.body} and no usable :token key could be found there" if @bearer_token.nil? || @bearer_token.empty?
end

def auth_headers
Expand Down
4 changes: 1 addition & 3 deletions lib/we_transfer_client/remote_board.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ def links

def to_instances(items:)
items.map do |item|
begin
remote_class = "Remote#{item[:type].capitalize}"
Module.const_get(remote_class)
.new(item)
rescue NameError
rescue NameError
raise ItemTypeError, "Cannot instantiate item with type '#{item[:type]}' and id '#{item[:id]}'"
end
end
end
end
3 changes: 2 additions & 1 deletion spec/we_transfer_client/remote_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
chunk_size: RemoteBoard::CHUNK_SIZE,
},
type: 'file',
}}
}
}

describe '#initializer' do
it 'initialized when no url is given' do
Expand Down
8 changes: 4 additions & 4 deletions spec/we_transfer_client/remote_link_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
describe RemoteLink do
let(:params) {
{
id: SecureRandom.uuid,
url: 'http://www.wetransfer.com',
meta: {title: 'wetransfer.com'},
type: 'link',
id: SecureRandom.uuid,
url: 'http://www.wetransfer.com',
meta: {title: 'wetransfer.com'},
type: 'link',
}
}

Expand Down
4 changes: 2 additions & 2 deletions wetransfer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'dotenv', '~> 2.2'
spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'pry', '~> 0.11'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rake', '>= 12.3.3'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov', '~> 0.15'
spec.add_development_dependency 'wetransfer_style', '0.6.0'
spec.add_development_dependency 'wetransfer_style', '>= 0.6.0'
spec.add_development_dependency 'guard-rspec', '~> 4.7'
spec.add_development_dependency 'guard-rubocop', '~> 1.3'
end
Expand Down