Class: Fakerclip::Writes::S3Request

Inherits:
Object
  • Object
show all
Defined in:
lib/fakerclip/writes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ S3Request

Returns a new instance of S3Request.



20
21
22
23
24
25
# File 'lib/fakerclip/writes.rb', line 20

def initialize(env)
  self.body      = env['rack.input'] && env['rack.input'].read || env[:body]
  self.s3_bucket = (env['HTTP_HOST'] || env[:host]).split('.').first
  self.s3_path   = env['PATH_INFO'] || CGI.unescape(env[:path])
  self.etag      = Digest::MD5::hexdigest(body)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



18
19
20
# File 'lib/fakerclip/writes.rb', line 18

def body
  @body
end

#etagObject

Returns the value of attribute etag.



18
19
20
# File 'lib/fakerclip/writes.rb', line 18

def etag
  @etag
end

#s3_bucketObject

Returns the value of attribute s3_bucket.



18
19
20
# File 'lib/fakerclip/writes.rb', line 18

def s3_bucket
  @s3_bucket
end

#s3_pathObject

Returns the value of attribute s3_path.



18
19
20
# File 'lib/fakerclip/writes.rb', line 18

def s3_path
  @s3_path
end