Class: Google::Cloud::Storage::Bucket::Cors::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/storage/bucket/cors.rb

Overview

Bucket Cors Rule

Represents a website CORS rule for a bucket. Accessed via Google::Cloud::Storage::Bucket#cors.

Examples:

Retrieving the bucket's CORS rules.

require "google/cloud/storage"

storage = Google::Cloud::Storage.new

bucket = storage.bucket "my-bucket"
bucket.cors.size #=> 2
rule = bucket.cors.first
rule.origin #=> ["http://example.org"]
rule.methods #=> ["GET","POST","DELETE"]
rule.headers #=> ["X-My-Custom-Header"]
rule.max_age #=> 3600

See Also:

Instance Attribute Summary collapse

Instance Attribute Details

#headersString

The list of header field names to send in the Access-Control-Allow-Headers header in the preflight response. Indicates the custom request headers that may be used in the actual request.

Returns:

  • (String)

    the current value of headers



174
175
176
# File 'lib/google/cloud/storage/bucket/cors.rb', line 174

def headers
  @headers
end

#max_ageString

The value to send in the Access-Control-Max-Age header in the preflight response. Indicates how many seconds the results of a preflight request can be cached in a preflight result cache. The default value is 1800 (30 minutes.)

Returns:

  • (String)

    the current value of max_age



174
175
176
# File 'lib/google/cloud/storage/bucket/cors.rb', line 174

def max_age
  @max_age
end

#methodsString

The list of HTTP methods permitted in cross origin resource sharing with the bucket. (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means "any method".

Returns:

  • (String)

    the current value of methods



174
175
176
# File 'lib/google/cloud/storage/bucket/cors.rb', line 174

def methods
  @methods
end

#originString

The origin or origins permitted for cross origin resource sharing with the bucket. Note: "*" is permitted in the list of origins, and means "any Origin".

Returns:

  • (String)

    the current value of origin



174
175
176
# File 'lib/google/cloud/storage/bucket/cors.rb', line 174

def origin
  @origin
end