Module: S33r::InBucket
- Defined in:
- lib/s33r/s3_obj.rb
Instance Method Summary collapse
-
#delete(options = {}) ⇒ Object
Delete the object from S3.
-
#fetch(options = {}) ⇒ Object
Fetch an object’s metadata and content from S3.
-
#rename(new_key, options = {}) ⇒ Object
(also: #mv)
Change the object’s name on S3.
-
#request_defaults ⇒ Object
Send requests using the bucket’s options.
-
#save(options = {}) ⇒ Object
Save an object to S3.
Instance Method Details
#delete(options = {}) ⇒ Object
Delete the object from S3.
219 220 221 |
# File 'lib/s33r/s3_obj.rb', line 219 def delete(={}) bucket.delete(key, ) end |
#fetch(options = {}) ⇒ Object
Fetch an object’s metadata and content from S3.
203 204 205 206 207 208 209 210 211 |
# File 'lib/s33r/s3_obj.rb', line 203 def fetch(={}) resp = do_get() , , data = S3Object.parse_response(resp) @amz_meta = @value = data set_properties() true end |
#rename(new_key, options = {}) ⇒ Object Also known as: mv
Change the object’s name on S3.
224 225 226 227 228 229 230 231 232 233 |
# File 'lib/s33r/s3_obj.rb', line 224 def rename(new_key, ={}) # Delete the object from S3. bucket.delete(key, ) # Set the new key. self.key = new_key [:key] = new_key save() end |
#request_defaults ⇒ Object
Send requests using the bucket’s options.
198 199 200 |
# File 'lib/s33r/s3_obj.rb', line 198 def request_defaults bucket.request_defaults.merge(:key => key) end |
#save(options = {}) ⇒ Object
Save an object to S3.
214 215 216 |
# File 'lib/s33r/s3_obj.rb', line 214 def save(={}) bucket.put(self, ) end |