class AWS::S3::PresignedPost::ConditionBuilder

Lets you specify conditions on a field. See {PresignedPost#where} for usage examples.

Public Class Methods

new(post, field) click to toggle source

@private

# File lib/aws/s3/presigned_post.rb, line 240
def initialize(post, field)
  @post = post
  @field = field
end

Public Instance Methods

in(range) click to toggle source

Specifies that the value of the field must be in the given range. This may only be used to constrain the :content_length field, e.g. presigned_post.with(:conent_length).in(1..4).

# File lib/aws/s3/presigned_post.rb, line 278
def in(range)
  @post.refine(:content_length => range)
end
is(value) click to toggle source

Specifies that the value of the field must equal the provided value.

# File lib/aws/s3/presigned_post.rb, line 247
def is(value)
  if @field == :content_length
    self.in(value)
  else
    @post.with_equality_condition(@field, value)
  end
end
starts_with(prefix) click to toggle source

Specifies that the value of the field must begin with the provided value. If you are specifying a condition on the “key” field, note that this check takes place after the +${filename}+ variable is expanded. This is only valid for the following fields:

  • :key

  • :cache_control

  • :content_type

  • :content_disposition

  • :content_encoding

  • :expires_header

  • :acl

  • :success_action_redirect

  • metadata fields (see {#where_metadata})

# File lib/aws/s3/presigned_post.rb, line 270
def starts_with(prefix)
  @post.with_prefix_condition(@field, prefix)
end