Class: Frizz::Remote
- Inherits:
-
Object
- Object
- Frizz::Remote
- Defined in:
- lib/frizz/remote.rb
Instance Method Summary collapse
- #delete(remote_file) ⇒ Object
- #files ⇒ Object
-
#initialize(bucket_name, ignorance, options = {}) ⇒ Remote
constructor
A new instance of Remote.
- #upload(file, key, options = {}) ⇒ Object
Constructor Details
#initialize(bucket_name, ignorance, options = {}) ⇒ Remote
Returns a new instance of Remote.
6 7 8 9 10 |
# File 'lib/frizz/remote.rb', line 6 def initialize(bucket_name, ignorance, = {}) @options = @bucket_name = bucket_name @ignorance = ignorance end |
Instance Method Details
#delete(remote_file) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/frizz/remote.rb', line 30 def delete(remote_file) client.delete_object( bucket: bucket_name, key: remote_file.key ) end |
#files ⇒ Object
12 13 14 |
# File 'lib/frizz/remote.rb', line 12 def files @files ||= objects.reject { |o| ignore?(o) } end |
#upload(file, key, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/frizz/remote.rb', line 16 def upload(file, key, = {}) = { bucket: bucket_name, body: file, acl: 'public-read', content_type: MIME::Types.type_for(key).first.content_type, key: key } [:website_redirect_location] = [:redirect_to] if [:redirect_to] client.put_object end |