Class: Frizz::Remote
- Inherits:
-
Object
- Object
- Frizz::Remote
- Defined in:
- lib/frizz/remote.rb
Instance Method Summary collapse
- #files ⇒ Object
-
#initialize(bucket_name) ⇒ Remote
constructor
A new instance of Remote.
- #upload(file, key) ⇒ Object
Constructor Details
#initialize(bucket_name) ⇒ Remote
Returns a new instance of Remote.
6 7 8 |
# File 'lib/frizz/remote.rb', line 6 def initialize(bucket_name) @bucket_name = bucket_name end |
Instance Method Details
#files ⇒ Object
10 11 12 |
# File 'lib/frizz/remote.rb', line 10 def files @files ||= bucket.objects end |
#upload(file, key) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/frizz/remote.rb', line 14 def upload(file, key) bucket.objects.build(key).tap do |obj| obj.acl = :public_read obj.content = file obj.content_type = MIME::Types.type_for(key).first.content_type end.save end |