Class: Opsicle::S3Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/opsicle/s3_bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, bucket_name) ⇒ S3Bucket

Returns a new instance of S3Bucket.

Raises:



7
8
9
10
# File 'lib/opsicle/s3_bucket.rb', line 7

def initialize(client, bucket_name)
  @bucket = Aws::S3::Bucket.new(name: bucket_name, client: client.s3)
  raise UnknownBucket unless @bucket.exists?
end

Instance Attribute Details

#bucketObject (readonly)

Returns the value of attribute bucket.



5
6
7
# File 'lib/opsicle/s3_bucket.rb', line 5

def bucket
  @bucket
end

Instance Method Details

#update(object) ⇒ Object



12
13
14
15
# File 'lib/opsicle/s3_bucket.rb', line 12

def update(object)
  obj = bucket.object(object)
  obj.upload_file(Pathname.new(object))
end