Class: Swa::S3::Object
Instance Attribute Summary
Attributes inherited from Resource
#aws_resource
Instance Method Summary
collapse
Methods inherited from Resource
#data, delegate, #initialize, list
Constructor Details
This class inherits a constructor from Swa::Resource
Instance Method Details
45
46
47
|
# File 'lib/swa/s3/object.rb', line 45
def delete
object.delete
end
|
#download_into(file_name, &progress_callback) ⇒ Object
33
34
35
|
# File 'lib/swa/s3/object.rb', line 33
def download_into(file_name, &progress_callback)
object.download_file(file_name, progress_callback: progress_callback)
end
|
29
30
31
|
# File 'lib/swa/s3/object.rb', line 29
def get_body
object.get.body
end
|
17
18
19
|
# File 'lib/swa/s3/object.rb', line 17
def key
object.key
end
|
#put(io, options = {}) ⇒ Object
37
38
39
|
# File 'lib/swa/s3/object.rb', line 37
def put(io, options = {})
object.put(options.merge(:body => io))
end
|
9
10
11
12
13
14
15
|
# File 'lib/swa/s3/object.rb', line 9
def summary
[
object.last_modified.iso8601,
rpad(object.size, 10),
uri
].join(" ")
end
|
25
26
27
|
# File 'lib/swa/s3/object.rb', line 25
def to_s
uri
end
|
#upload_from(file_name) ⇒ Object
41
42
43
|
# File 'lib/swa/s3/object.rb', line 41
def upload_from(file_name)
object.upload_file(file_name)
end
|
21
22
23
|
# File 'lib/swa/s3/object.rb', line 21
def uri
"s3://#{object.bucket.name}/#{object.key}"
end
|
#version(version_id) ⇒ Object
49
50
51
|
# File 'lib/swa/s3/object.rb', line 49
def version(version_id)
Swa::S3::ObjectVersion.new(object.version(version_id))
end
|