Class: Gyazo::UploadAdapters::Fog
- Inherits:
-
Object
- Object
- Gyazo::UploadAdapters::Fog
- Defined in:
- lib/gyazo/upload_adapters/fog.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
-
#initialize(image) ⇒ Fog
constructor
A new instance of Fog.
- #public_url ⇒ Object
- #upload ⇒ Object
Constructor Details
#initialize(image) ⇒ Fog
Returns a new instance of Fog.
8 9 10 |
# File 'lib/gyazo/upload_adapters/fog.rb', line 8 def initialize(image) @image = image end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
6 7 8 |
# File 'lib/gyazo/upload_adapters/fog.rb', line 6 def image @image end |
Instance Method Details
#public_url ⇒ Object
22 23 24 |
# File 'lib/gyazo/upload_adapters/fog.rb', line 22 def public_url ["http://#{host}", image.name].compact.join('/') end |
#upload ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/gyazo/upload_adapters/fog.rb', line 12 def upload connection.put_object(bucket, image.name, image.data, { 'Content-Type' => "image/jpeg", 'x-amz-acl' => 'public-read' } ) public_url end |