Class: Artifactory::GemImport::Gems::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/artifactory/gem_import/gems/uploader.rb

Instance Method Summary collapse

Instance Method Details

#call(url, headers, file_path) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/artifactory/gem_import/gems/uploader.rb', line 8

def call(url, headers, file_path)
  file = File.open file_path, "r"

  [:ok, upload(url, headers, file)]
rescue Net::HTTPClientException, Net::HTTPFatalError, Net::OpenTimeout, SocketError => err # TODO handle File errors, JSON parse errors
  [:error, err.message]
end