class AWS::S3::ObjectCollection


#=> [‘photos/2010’, ‘photos/2011’]
directories = tree.children.select(&:branch?).collect(&:prefix)
tree = bucket.objects.with_prefix.prefix(‘photos’).as_tree
photos/2011/summer/family.jpg
photos/2011/summer/vacation.jpg
photos/2011/fall/leaves.jpg
photos/2010/house.jpg
videos/family_reunion.mpg
videos/wedding.mpg
README.txt
Given a bucket with the following keys:
== Exploring Objects with a Tree Interface
#=> [‘videos/comedy.mpg’, ‘videos/dancing.mpg’]
bucket.objects.with_prefix(‘videos’).collect(&:key)
You can list objects that share a prefix:
videos/dancing.mpg
videos/comedy.mpg
photos/winter.jpg
photos/sunrise.jpg
photos/sunset.jpg
Given a bucket with the following keys:
== Finding objects with a Prefix
object.key #=> ‘foo.jpg’
object = bucket.objects[‘foo.jpg’]
# this will not make any requests against S3
If you know the key of the object you want, you can reference it this way:
== Getting an S3Object by Key
Represents a collection of S3 objects.

def [] key

Returns:
  • (S3Object) -

Parameters:
  • key (String) -- The object key.
def [] key
  S3Object.new(bucket, key.to_s)
end

def create key, *args

Returns:
  • (S3Object) -

Parameters:
  • key (String) -- Where in S3 to write the object.

Other tags:
    See: S3Object#write -
def create key, *args
  self[key].write(*args)
end

def each options = {}, &block

Returns:
  • (nil) -

Options Hash: (**options)
  • :batch_size (Integer) -- The number of objects to
  • :limit (Integer) -- The maximum number of

Parameters:
  • options (Hash) --
def each options = {}, &block
  super
end

def each_member_in_page(page, &block)

def each_member_in_page(page, &block)
  super
  page.contents.each do |content|
    yield(S3Object.new(bucket, content.key))
  end
end

def initialize(bucket, options = {})

Parameters:
  • The (Bucket) -- S3 bucket this object collection belongs to.
def initialize(bucket, options = {})
  @bucket = bucket
  super
end

def limit_param

def limit_param
  :max_keys
end

def list_request(options)

def list_request(options)
  client.list_objects(options)
end

def next_markers page

def next_markers page
  { :marker => (last = page.contents.last and last.key) }
end

def page_size resp

def page_size resp
  super + resp.contents.size
end

def with_prefix prefix, mode = :replace

(see PrefixedCollection#with_prefix)
def with_prefix prefix, mode = :replace
  super(prefix, mode)
end