Class: Google::Storage::Data::BucketCors
- Inherits:
-
Object
- Object
- Google::Storage::Data::BucketCors
- Includes:
- Comparable
- Defined in:
- lib/google/storage/property/bucket_cors.rb
Overview
A class to manage data for Cors for bucket.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#max_age_seconds ⇒ Object
readonly
Returns the value of attribute max_age_seconds.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#response_header ⇒ Object
readonly
Returns the value of attribute response_header.
Instance Method Summary collapse
Instance Attribute Details
#max_age_seconds ⇒ Object (readonly)
Returns the value of attribute max_age_seconds.
38 39 40 |
# File 'lib/google/storage/property/bucket_cors.rb', line 38 def max_age_seconds @max_age_seconds end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
39 40 41 |
# File 'lib/google/storage/property/bucket_cors.rb', line 39 def method @method end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
40 41 42 |
# File 'lib/google/storage/property/bucket_cors.rb', line 40 def origin @origin end |
#response_header ⇒ Object (readonly)
Returns the value of attribute response_header.
41 42 43 |
# File 'lib/google/storage/property/bucket_cors.rb', line 41 def response_header @response_header end |
Instance Method Details
#<=>(other) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/google/storage/property/bucket_cors.rb', line 70 def <=>(other) return false unless other.is_a? BucketCors compare_fields(other).each do |compare| next if compare[:self].nil? || compare[:other].nil? result = compare[:self] <=> compare[:other] return result unless result.zero? end 0 end |
#==(other) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/google/storage/property/bucket_cors.rb', line 61 def ==(other) return false unless other.is_a? BucketCors compare_fields(other).each do |compare| next if compare[:self].nil? || compare[:other].nil? return false if compare[:self] != compare[:other] end true end |
#to_json(_arg = nil) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/google/storage/property/bucket_cors.rb', line 43 def to_json(_arg = nil) { 'maxAgeSeconds' => max_age_seconds, 'method' => method, 'origin' => origin, 'responseHeader' => response_header }.reject { |_k, v| v.nil? }.to_json end |
#to_s ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/google/storage/property/bucket_cors.rb', line 52 def to_s { max_age_seconds: max_age_seconds, method: method, origin: origin, response_header: response_header }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ') end |