181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
# File 'lib/cnvrg/files.rb', line 181
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
|