354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
# File 'lib/cnvrg/files.rb', line 354
def download_image(file_path_to_store, image_slug, owner)
download_resp = Cnvrg::API.request("users/#{owner}/images/#{image_slug}/" + "download", 'GET')
path = download_resp["result"]["path"]
if Cnvrg::CLI.is_response_success(download_resp, false)
begin
open(file_path_to_store, 'wb') do |file|
file << open(path).read
end
return true
rescue => e
return false
end
return true
else
return false
end
end
|