Method: Match::Storage::GitLab::Client#upload_file

Defined in:
match/lib/match/storage/gitlab/client.rb

#upload_file(current_file, target_file) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'match/lib/match/storage/gitlab/client.rb', line 64

def upload_file(current_file, target_file)
  url = URI.parse(base_url)

  File.open(current_file) do |file|
    request = Net::HTTP::Post::Multipart.new(
      url.path,
      "file" => UploadIO.new(file, "application/octet-stream"),
      "name" => target_file
    )

    execute_request(url, request, target_file)
  end
end