Module: S3Browser::Store::StorePlugins::Base::InstanceMethods

Defined in:
lib/s3browser/store.rb

Instance Method Summary collapse

Instance Method Details

#add(bucket, object) ⇒ Object



74
75
76
# File 'lib/s3browser/store.rb', line 74

def add(bucket, object)
  nil
end

#bucketsObject



98
99
100
# File 'lib/s3browser/store.rb', line 98

def buckets
  s3.list_buckets.buckets.map {|val| val['name'] }
end

#delete(bucket, file) ⇒ Object



85
86
# File 'lib/s3browser/store.rb', line 85

def delete(bucket, file)
end

#object(bucket, key) ⇒ Object



94
95
96
# File 'lib/s3browser/store.rb', line 94

def object(bucket, key)
  s3.head_object(bucket: bucket, key: key)
end

#object_urlObject



102
103
104
105
106
107
# File 'lib/s3browser/store.rb', line 102

def object_url
  @object_url ||= begin
    return ENV['S3BROWSER_OBJECT_URL'] if ENV['S3BROWSER_OBJECT_URL']
    "http://s3-#{ENV['AWS_REGION']}.amazonaws.com"
  end
end

#objects(bucket, options) ⇒ Object



88
89
90
91
92
# File 'lib/s3browser/store.rb', line 88

def objects(bucket, options)
  s3.list_objects(bucket: bucket).contents.map do |object|
    object.to_h.merge(bucket: bucket, url: "#{object_url}/#{bucket}/#{object[:key]}")
  end
end

#remove(bucket, key) ⇒ Object



78
79
80
# File 'lib/s3browser/store.rb', line 78

def remove(bucket, key)
  nil
end

#upload(bucket, file) ⇒ Object



82
83
# File 'lib/s3browser/store.rb', line 82

def upload(bucket, file)
end