Class: OCI::Devops::Models::DiffResponse

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

Overview

Response object for obtaining list of changed files.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DiffResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



89
90
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/oci/devops/models/diff_response.rb', line 89

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

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

  self.are_all_changes_included = attributes[:'areAllChangesIncluded'] unless attributes[:'areAllChangesIncluded'].nil?

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

  self.are_all_changes_included = attributes[:'are_all_changes_included'] unless attributes[:'are_all_changes_included'].nil?

  self.change_type_count = attributes[:'changeTypeCount'] if attributes[:'changeTypeCount']

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

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

  self.common_commit = attributes[:'commonCommit'] if attributes[:'commonCommit']

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

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

  self.commits_ahead_count = attributes[:'commitsAheadCount'] if attributes[:'commitsAheadCount']

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

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

  self.commits_behind_count = attributes[:'commitsBehindCount'] if attributes[:'commitsBehindCount']

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

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

  self.added_lines_count = attributes[:'addedLinesCount'] if attributes[:'addedLinesCount']

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

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

  self.deleted_lines_count = attributes[:'deletedLinesCount'] if attributes[:'deletedLinesCount']

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

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

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

Instance Attribute Details

#added_lines_countInteger

The number of lines added in whole difference.

Returns:

  • (Integer)


33
34
35
# File 'lib/oci/devops/models/diff_response.rb', line 33

def added_lines_count
  @added_lines_count
end

#are_all_changes_includedBOOLEAN

Boolean value to indicate if all changes are included in the response.

Returns:

  • (BOOLEAN)


13
14
15
# File 'lib/oci/devops/models/diff_response.rb', line 13

def are_all_changes_included
  @are_all_changes_included
end

#change_type_countHash<String, Integer>

Count of each type of change in difference.

Returns:

  • (Hash<String, Integer>)


17
18
19
# File 'lib/oci/devops/models/diff_response.rb', line 17

def change_type_count
  @change_type_count
end

#changesArray<OCI::Devops::Models::DiffResponseEntry>

[Required] List of changes in the difference.



41
42
43
# File 'lib/oci/devops/models/diff_response.rb', line 41

def changes
  @changes
end

#commits_ahead_countInteger

The number of commits source is ahead of target by.

Returns:

  • (Integer)


25
26
27
# File 'lib/oci/devops/models/diff_response.rb', line 25

def commits_ahead_count
  @commits_ahead_count
end

#commits_behind_countInteger

The number of commits source is behind target by.

Returns:

  • (Integer)


29
30
31
# File 'lib/oci/devops/models/diff_response.rb', line 29

def commits_behind_count
  @commits_behind_count
end

#common_commitString

The ID of the common commit between source and target.

Returns:

  • (String)


21
22
23
# File 'lib/oci/devops/models/diff_response.rb', line 21

def common_commit
  @common_commit
end

#deleted_lines_countInteger

The number of lines deleted in whole difference.

Returns:

  • (Integer)


37
38
39
# File 'lib/oci/devops/models/diff_response.rb', line 37

def deleted_lines_count
  @deleted_lines_count
end

Class Method Details

.attribute_mapObject

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/oci/devops/models/diff_response.rb', line 44

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'are_all_changes_included': :'areAllChangesIncluded',
    'change_type_count': :'changeTypeCount',
    'common_commit': :'commonCommit',
    'commits_ahead_count': :'commitsAheadCount',
    'commits_behind_count': :'commitsBehindCount',
    'added_lines_count': :'addedLinesCount',
    'deleted_lines_count': :'deletedLinesCount',
    'changes': :'changes'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/oci/devops/models/diff_response.rb', line 60

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'are_all_changes_included': :'BOOLEAN',
    'change_type_count': :'Hash<String, Integer>',
    'common_commit': :'String',
    'commits_ahead_count': :'Integer',
    'commits_behind_count': :'Integer',
    'added_lines_count': :'Integer',
    'deleted_lines_count': :'Integer',
    'changes': :'Array<OCI::Devops::Models::DiffResponseEntry>'
    # 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



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/devops/models/diff_response.rb', line 147

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

  self.class == other.class &&
    are_all_changes_included == other.are_all_changes_included &&
    change_type_count == other.change_type_count &&
    common_commit == other.common_commit &&
    commits_ahead_count == other.commits_ahead_count &&
    commits_behind_count == other.commits_behind_count &&
    added_lines_count == other.added_lines_count &&
    deleted_lines_count == other.deleted_lines_count &&
    changes == other.changes
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



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/oci/devops/models/diff_response.rb', line 184

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


164
165
166
# File 'lib/oci/devops/models/diff_response.rb', line 164

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



173
174
175
# File 'lib/oci/devops/models/diff_response.rb', line 173

def hash
  [are_all_changes_included, change_type_count, common_commit, commits_ahead_count, commits_behind_count, added_lines_count, deleted_lines_count, changes].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/devops/models/diff_response.rb', line 217

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



211
212
213
# File 'lib/oci/devops/models/diff_response.rb', line 211

def to_s
  to_hash.to_s
end