Class: Google::Storage::Data::BucketCondition

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

Overview

A class to manage data for Condition for bucket.

Direct Known Subclasses

BucketConditionApi, BucketConditionCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#age_daysObject (readonly)

Returns the value of attribute age_days.



37
38
39
# File 'lib/google/storage/property/bucket_condition.rb', line 37

def age_days
  @age_days
end

#created_beforeObject (readonly)

Returns the value of attribute created_before.



38
39
40
# File 'lib/google/storage/property/bucket_condition.rb', line 38

def created_before
  @created_before
end

#is_liveObject (readonly)

Returns the value of attribute is_live.



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

def is_live
  @is_live
end

#matches_storage_classObject (readonly)

Returns the value of attribute matches_storage_class.



40
41
42
# File 'lib/google/storage/property/bucket_condition.rb', line 40

def matches_storage_class
  @matches_storage_class
end

#num_newer_versionsObject (readonly)

Returns the value of attribute num_newer_versions.



41
42
43
# File 'lib/google/storage/property/bucket_condition.rb', line 41

def num_newer_versions
  @num_newer_versions
end

Instance Method Details

#<=>(other) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/google/storage/property/bucket_condition.rb', line 72

def <=>(other)
  return false unless other.is_a? BucketCondition
  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



63
64
65
66
67
68
69
70
# File 'lib/google/storage/property/bucket_condition.rb', line 63

def ==(other)
  return false unless other.is_a? BucketCondition
  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
51
# File 'lib/google/storage/property/bucket_condition.rb', line 43

def to_json(_arg = nil)
  {
    'age' => age_days,
    'createdBefore' => created_before,
    'isLive' => is_live,
    'matchesStorageClass' => matches_storage_class,
    'numNewerVersions' => num_newer_versions
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



53
54
55
56
57
58
59
60
61
# File 'lib/google/storage/property/bucket_condition.rb', line 53

def to_s
  {
    age_days: age_days,
    created_before: created_before,
    is_live: is_live,
    matches_storage_class: matches_storage_class,
    num_newer_versions: num_newer_versions
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end