Class: Pageflow::Panorama::S3Bucket

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

Defined Under Namespace

Classes: Factory, StreamWithSize

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket) ⇒ S3Bucket

Returns a new instance of S3Bucket.



6
7
8
# File 'lib/pageflow/panorama/s3_bucket.rb', line 6

def initialize(bucket)
  @bucket = bucket
end

Instance Attribute Details

#bucketObject (readonly)

Returns the value of attribute bucket.



4
5
6
# File 'lib/pageflow/panorama/s3_bucket.rb', line 4

def bucket
  @bucket
end

Instance Method Details

#write(name:, input_stream:, content_length:, content_type:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/pageflow/panorama/s3_bucket.rb', line 10

def write(name:, input_stream:, content_length:, content_type:)
  object = bucket.object(name)

  object.put(body: StreamWithSize.new(input_stream, content_length),
             acl: 'public-read',
             content_type: content_type,
             content_length: content_length)
end