Class: Google::Cloud::Storage::Bucket::Cors::Rule
- Inherits:
-
Object
- Object
- Google::Cloud::Storage::Bucket::Cors::Rule
- Defined in:
- lib/google/cloud/storage/bucket/cors.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#max_age ⇒ Object
Returns the value of attribute max_age.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#origin ⇒ Object
Returns the value of attribute origin.
Class Method Summary collapse
Instance Method Summary collapse
- #freeze ⇒ Object
-
#initialize(origin, methods, headers: nil, max_age: nil) ⇒ Rule
constructor
A new instance of Rule.
- #to_gapi ⇒ Object
Constructor Details
#initialize(origin, methods, headers: nil, max_age: nil) ⇒ Rule
Returns a new instance of Rule.
126 127 128 129 130 131 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 126 def initialize origin, methods, headers: nil, max_age: nil @origin = Array(origin) @methods = Array(methods) @headers = Array(headers) @max_age = (max_age||1800) end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
124 125 126 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 124 def headers @headers end |
#max_age ⇒ Object
Returns the value of attribute max_age.
124 125 126 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 124 def max_age @max_age end |
#methods ⇒ Object
Returns the value of attribute methods.
124 125 126 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 124 def methods @methods end |
#origin ⇒ Object
Returns the value of attribute origin.
124 125 126 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 124 def origin @origin end |
Class Method Details
.from_gapi(gapi) ⇒ Object
140 141 142 143 144 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 140 def self.from_gapi gapi new gapi.origin.dup, gapi.http_method.dup, \ headers: gapi.response_header.dup, max_age: gapi.max_age_seconds end |
Instance Method Details
#freeze ⇒ Object
146 147 148 149 150 151 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 146 def freeze @origin.freeze @methods.freeze @headers.freeze super end |
#to_gapi ⇒ Object
133 134 135 136 137 138 |
# File 'lib/google/cloud/storage/bucket/cors.rb', line 133 def to_gapi Google::Apis::StorageV1::Bucket::CorsConfiguration.new( origin: Array(origin).dup, http_method: Array(methods).dup, response_header: Array(headers).dup, max_age_seconds: max_age ) end |