Class: Cloudinary::Downloader
Overview
Copyright Cloudinary
Class Method Summary collapse
Class Method Details
.download(source, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cloudinary/downloader.rb', line 4 def self.download(source, ={}) = .clone if !source.match(/^https?:\/\//i) source = Cloudinary::Utils.cloudinary_url(source, ) end url = URI.parse(source) http = Net::HTTP.new(url.host, url.port) req = Net::HTTP::Get.new(url.request_uri) if url.port == 443 http.use_ssl=true http.verify_mode = OpenSSL::SSL::VERIFY_NONE end res = http.start{|agent| agent.request(req) } return res.body end |