Module: AWS::S3::BitTorrent::ClassMethods
- Defined in:
- lib/aws-matt/s3/bittorrent.rb
Overview
Adds methods to S3Object for accessing the torrent of a given object.
Instance Method Summary collapse
-
#grant_torrent_access_to(key, bucket = nil) ⇒ Object
(also: #grant_torrent_access)
Grants access to the object with the given
key
to be accessible as a torrent. -
#torrent_for(key, bucket = nil) ⇒ Object
(also: #torrent)
Returns the torrent file for the object with the given
key
.
Instance Method Details
#grant_torrent_access_to(key, bucket = nil) ⇒ Object Also known as: grant_torrent_access
Grants access to the object with the given key
to be accessible as a torrent.
38 39 40 41 42 43 |
# File 'lib/aws-matt/s3/bittorrent.rb', line 38 def grant_torrent_access_to(key, bucket = nil) policy = acl(key, bucket) return true if policy.grants.include?(:public_read) policy.grants << ACL::Grant.grant(:public_read) acl(key, bucket, policy) end |
#torrent_for(key, bucket = nil) ⇒ Object Also known as: torrent
Returns the torrent file for the object with the given key
.
32 33 34 |
# File 'lib/aws-matt/s3/bittorrent.rb', line 32 def torrent_for(key, bucket = nil) get(path!(bucket, key) << '?torrent').body end |