Sha256: 11add4fd775a09ccc050de10211173be0abe31b2ff9a1ee0239c2a2c8fecfd1a
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
module NightcrawlerSwift class Upload < Command def execute path, file content = file.read headers = {etag: etag(content), content_type: content_type(file)} headers.merge!(cache_control: "public, max-age=#{options.max_age}") if options.max_age response = put "#{connection.upload_url}/#{path}", body: content, headers: headers [200, 201].include?(response.code) end private def content_type file MultiMime.by_file(file).content_type end def etag content Digest::MD5.hexdigest(content) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nightcrawler_swift-0.5.0 | lib/nightcrawler_swift/commands/upload.rb |