class KPM::NexusFacade::MavenCentralApiCalls

def pull_artifact(coordinates, destination)

def pull_artifact(coordinates, destination)
  artifact = parse_coordinates(coordinates)
  version = artifact[:version]
  version = fetch_latest_version(artifact) if version.casecmp('latest').zero?
  file_name = build_file_name(artifact[:artifact_id], version, artifact[:classifier], artifact[:extension])
  download_url = build_download_url(artifact, version, file_name)
  dest_path = File.join(File.expand_path(destination || '.'), file_name)
  File.open(dest_path, 'wb') do |io|
    io.write(Net::HTTP.get(URI(download_url)))
  end
  {
    file_name: file_name,
    file_path: File.expand_path(dest_path),
    version: version,
    size: File.size(File.expand_path(dest_path))
  }
end