Class: Frizz::Remote

Inherits:
Object
  • Object
show all
Defined in:
lib/frizz/remote.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name, ignorance) ⇒ Remote

Returns a new instance of Remote.



6
7
8
9
# File 'lib/frizz/remote.rb', line 6

def initialize(bucket_name, ignorance)
  @bucket_name = bucket_name
  @ignorance = ignorance
end

Instance Method Details

#filesObject



11
12
13
# File 'lib/frizz/remote.rb', line 11

def files
  @files ||= bucket.objects.reject { |o| ignore?(o) }
end

#upload(file, key) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/frizz/remote.rb', line 15

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