lib/aws/s3/presigned_post.rb in aws-sdk-1.9.0 vs lib/aws/s3/presigned_post.rb in aws-sdk-1.9.1
- old
+ new
@@ -72,11 +72,11 @@
# @return [Range] The range of acceptable object sizes for the
# upload. By default any size object may be uploaded.
attr_reader :content_length
- # @private
+ # @api private
SPECIAL_FIELDS = [:cache_control,
:content_type,
:content_disposition,
:content_encoding,
:expires_header,
@@ -84,11 +84,11 @@
:server_side_encryption,
:success_action_redirect,
:success_action_status,
:filename]
- # @private
+ # @api private
attr_reader :conditions
# @return [Array<String>] Additional fields which may be sent
# with the upload. These will be included in the policy so
# that they can be sent with any value. S3 will ignore
@@ -236,11 +236,11 @@
# Lets you specify conditions on a field. See
# {PresignedPost#where} for usage examples.
class ConditionBuilder
- # @private
+ # @api private
def initialize(post, field)
@post = post
@field = field
end
@@ -360,24 +360,24 @@
fields.merge(optional_fields)
end
- # @private
+ # @api private
def with_equality_condition(option_name, value)
field_name = field_name(option_name)
with_condition(option_name, Hash[[[field_name, value]]])
end
- # @private
+ # @api private
def with_prefix_condition(option_name, prefix)
field_name = field_name(option_name)
with_condition(option_name,
["starts-with", "$#{field_name}", prefix])
end
- # @private
+ # @api private
def refine(opts)
self.class.new(bucket, {
:conditions => conditions,
:key => key,
:metadata => metadata,
@@ -387,19 +387,19 @@
:ignore => ignored_fields
}.merge(@fields).
merge(opts))
end
- # @private
+ # @api private
private
def with_condition(field, condition)
conditions = self.conditions.dup
(conditions[field] ||= []) << condition
refine(:conditions => conditions)
end
- # @private
+ # @api private
private
def format_expiration
time = expires || Time.now.utc + 60*60
time =
case time
@@ -413,32 +413,32 @@
Time.parse(time)
end
time.utc.iso8601
end
- # @private
+ # @api private
private
def range_value(range)
case range
when Integer
range..range
when Range
range
end
end
- # @private
+ # @api private
private
def split_range(range)
range = range_value(range)
[range.begin,
(range.exclude_end? ?
range.end-1 :
range.end)]
end
- # @private
+ # @api private
private
def optional_fields
fields = (SPECIAL_FIELDS &
@fields.keys).inject({}) do |fields, option_name|
fields[field_name(option_name)] =
@@ -451,11 +451,11 @@
end
fields
end
- # @private
+ # @api private
private
def field_name(option_name)
case option_name
when :expires_header
"Expires"
@@ -470,11 +470,11 @@
field_name[0,1] = field_name[0,1].upcase
field_name
end
end
- # @private
+ # @api private
private
def field_value(option_name)
case option_name
when :acl
@fields[:acl].to_s.tr("_", "-")
@@ -488,11 +488,11 @@
else
@fields[option_name].to_s
end
end
- # @private
+ # @api private
private
def generate_conditions
conditions = self.conditions.inject([]) do |list, (field, field_conds)|
list + field_conds
@@ -510,29 +510,29 @@
conditions
end
- # @private
+ # @api private
private
def ignored_conditions
ignored_fields.map do |field|
["starts-with", "$#{field}", ""]
end
end
- # @private
+ # @api private
private
def range_conditions
if content_length
[["content-length-range", *split_range(content_length)]]
else
[]
end
end
- # @private
+ # @api private
private
def key_conditions
[if key && key.include?("${filename}")
["starts-with", "$key", key[/^(.*)\$\{filename\}/, 1]]
elsif key
@@ -540,10 +540,10 @@
else
["starts-with", "$key", ""]
end]
end
- # @private
+ # @api private
private
def build_uri(request)
uri_class = secure? ? URI::HTTPS : URI::HTTP
uri_class.build(:host => request.host,
:path => request.path,