Class: Google::Storage::Data::BucketCors

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/google/storage/property/bucket_cors.rb

Overview

A class to manage data for Cors for bucket.

Direct Known Subclasses

BucketCorsApi, BucketCorsCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#max_age_secondsObject (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

#methodObject (readonly)

Returns the value of attribute method.



39
40
41
# File 'lib/google/storage/property/bucket_cors.rb', line 39

def method
  @method
end

#originObject (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_headerObject (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_sObject



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