class AWS::S3::CORSRule
@see CORSRuleCollection
rule.allowed_origins #=> [‘*’]
rule.allowed_methods #=> [‘GET’, ‘HEAD’]
rule = bucket.cors.first
@example
Represents a single CORS rule for an S3 {Bucket}.
def initialize options = {}
(**options)-
:expose_headers(Array) -- One or more headers in -
:max_age_seconds(Array) -- The time in -
:allowed_headers(Array) -- A list of headers -
:allowed_origins(required, Array) -- A list of -
:allowed_methods(required, Array) -- A list of HTTP -
:id(String) -- A unique identifier for the rule. The ID
Parameters:
-
options(Hash) -- A hash of the rule details.
def initialize options = {} @id = options[:id] @allowed_methods = options[:allowed_methods] || [] @allowed_origins = options[:allowed_origins] || [] @allowed_headers = options[:allowed_headers] || [] @max_age_seconds = options[:max_age_seconds] @expose_headers = options[:expose_headers] || [] end
def to_h
-
(Hash)-
def to_h h = {} h[:id] = id if id h[:allowed_methods] = allowed_methods h[:allowed_origins] = allowed_origins h[:allowed_headers] = allowed_headers unless allowed_headers.empty? h[:max_age_seconds] = max_age_seconds if max_age_seconds h[:expose_headers] = expose_headers unless expose_headers.empty? h end