Class: OCI::Devops::Models::ApprovalRuleMergeCheck

Inherits:
MergeCheck
  • Object
show all
Defined in:
lib/oci/devops/models/approval_rule_merge_check.rb

Overview

The status of the approval rules.

Constant Summary collapse

STATUS_ENUM =
[
  STATUS_NEEDS_APPROVAL = 'NEEDS_APPROVAL'.freeze,
  STATUS_SUCCEEDED = 'SUCCEEDED'.freeze,
  STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LEVEL_ENUM =
[
  LEVEL_PROJECT = 'PROJECT'.freeze,
  LEVEL_REPOSITORY = 'REPOSITORY'.freeze,
  LEVEL_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from MergeCheck

MergeCheck::TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from MergeCheck

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MergeCheck

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ ApprovalRuleMergeCheck

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 91

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['type'] = 'APPROVAL_RULE'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.rule_name = attributes[:'ruleName'] if attributes[:'ruleName']

  raise 'You cannot provide both :ruleName and :rule_name' if attributes.key?(:'ruleName') && attributes.key?(:'rule_name')

  self.rule_name = attributes[:'rule_name'] if attributes[:'rule_name']

  self.status = attributes[:'status'] if attributes[:'status']

  self.total_approval_count = attributes[:'totalApprovalCount'] if attributes[:'totalApprovalCount']

  raise 'You cannot provide both :totalApprovalCount and :total_approval_count' if attributes.key?(:'totalApprovalCount') && attributes.key?(:'total_approval_count')

  self.total_approval_count = attributes[:'total_approval_count'] if attributes[:'total_approval_count']

  self.current_approval_count = attributes[:'currentApprovalCount'] if attributes[:'currentApprovalCount']

  raise 'You cannot provide both :currentApprovalCount and :current_approval_count' if attributes.key?(:'currentApprovalCount') && attributes.key?(:'current_approval_count')

  self.current_approval_count = attributes[:'current_approval_count'] if attributes[:'current_approval_count']

  self.reviewers = attributes[:'reviewers'] if attributes[:'reviewers']

  self.level = attributes[:'level'] if attributes[:'level']
end

Instance Attribute Details

#current_approval_countInteger

The current number of approvals.

Returns:

  • (Integer)


39
40
41
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 39

def current_approval_count
  @current_approval_count
end

#levelString

The level of rule.

Returns:

  • (String)


47
48
49
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 47

def level
  @level
end

#reviewersArray<OCI::Devops::Models::PrincipalDetails>

The list of default reviewers.



43
44
45
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 43

def reviewers
  @reviewers
end

#rule_nameString

The name of the rule.

Returns:

  • (String)


27
28
29
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 27

def rule_name
  @rule_name
end

#statusString

The status of the approval rule.

Returns:

  • (String)


31
32
33
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 31

def status
  @status
end

#total_approval_countInteger

The number of total approvals needed.

Returns:

  • (Integer)


35
36
37
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 35

def total_approval_count
  @total_approval_count
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'rule_name': :'ruleName',
    'status': :'status',
    'total_approval_count': :'totalApprovalCount',
    'current_approval_count': :'currentApprovalCount',
    'reviewers': :'reviewers',
    'level': :'level'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 65

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'rule_name': :'String',
    'status': :'String',
    'total_approval_count': :'Integer',
    'current_approval_count': :'Integer',
    'reviewers': :'Array<OCI::Devops::Models::PrincipalDetails>',
    'level': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 159

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    type == other.type &&
    rule_name == other.rule_name &&
    status == other.status &&
    total_approval_count == other.total_approval_count &&
    current_approval_count == other.current_approval_count &&
    reviewers == other.reviewers &&
    level == other.level
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 195

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


175
176
177
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 175

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



184
185
186
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 184

def hash
  [type, rule_name, status, total_approval_count, current_approval_count, reviewers, level].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



228
229
230
231
232
233
234
235
236
237
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 228

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



222
223
224
# File 'lib/oci/devops/models/approval_rule_merge_check.rb', line 222

def to_s
  to_hash.to_s
end