Sha256: 0ed123eb98fcdb8510da503f95acc1439ab2faf5b0f7ae5629fda40b30abbd0c
Contents?: true
Size: 894 Bytes
Versions: 2
Compression:
Stored size: 894 Bytes
Contents
require "fog" module Gyazo module UploadAdapters class Fog attr_reader :image def initialize(image) @image = image end def upload connection.put_object(bucket, image.name, image.data, { 'Content-Type' => "image/jpeg", 'x-amz-acl' => 'public-read' } ) public_url end def public_url ["http://#{host}", image.name].compact.join('/') end protected def host configuration.cname.nil? ? "#{bucket}.s3.amazonaws.com" : configuration.cname end def path "/" end def connection @connection ||= ::Fog::Storage.new(configuration[:adapter_options]) end def bucket configuration[:bucket] end def configuration Rack::Gyazo.configuration end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack_gyazo-0.1.2 | lib/gyazo/upload_adapters/fog.rb |
rack_gyazo-0.1.1 | lib/gyazo/upload_adapters/fog.rb |