Class: OCI::Devops::Models::PullRequest

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

Overview

Pull Request containing the diff between a review branch and a destination branch

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_DETAILS_ENUM =
[
  LIFECYCLE_DETAILS_OPEN = 'OPEN'.freeze,
  LIFECYCLE_DETAILS_CONFLICT = 'CONFLICT'.freeze,
  LIFECYCLE_DETAILS_CLOSED = 'CLOSED'.freeze,
  LIFECYCLE_DETAILS_MERGING = 'MERGING'.freeze,
  LIFECYCLE_DETAILS_MERGED = 'MERGED'.freeze,
  LIFECYCLE_DETAILS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PullRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/oci/devops/models/pull_request.rb', line 212

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.id = attributes[:'id'] if attributes[:'id']

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

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

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

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

  self.repository_id = attributes[:'repositoryId'] if attributes[:'repositoryId']

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

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

  self.source_branch = attributes[:'sourceBranch'] if attributes[:'sourceBranch']

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

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

  self.destination_branch = attributes[:'destinationBranch'] if attributes[:'destinationBranch']

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

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

  self.source_commit_id_at_termination = attributes[:'sourceCommitIdAtTermination'] if attributes[:'sourceCommitIdAtTermination']

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

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

  self.merge_base_commit_id_at_termination = attributes[:'mergeBaseCommitIdAtTermination'] if attributes[:'mergeBaseCommitIdAtTermination']

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

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.lifecycle_details = attributes[:'lifecycleDetails'] if attributes[:'lifecycleDetails']

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

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

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

  self.merge_checks = attributes[:'mergeChecks'] if attributes[:'mergeChecks']

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

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

  self.created_by = attributes[:'createdBy'] if attributes[:'createdBy']

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

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

  self.merged_by = attributes[:'mergedBy'] if attributes[:'mergedBy']

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

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

  self.source_repository_id = attributes[:'sourceRepositoryId'] if attributes[:'sourceRepositoryId']

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

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

  self.total_comments = attributes[:'totalComments'] if attributes[:'totalComments']

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

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

  self.total_reviewers = attributes[:'totalReviewers'] if attributes[:'totalReviewers']

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

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

  self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']

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

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

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

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

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

  self.system_tags = attributes[:'systemTags'] if attributes[:'systemTags']

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

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

Instance Attribute Details

#compartment_idString

[Required] Compartment Identifier

Returns:

  • (String)


45
46
47
# File 'lib/oci/devops/models/pull_request.rb', line 45

def compartment_id
  @compartment_id
end

#created_byOCI::Devops::Models::PrincipalDetails

This attribute is required.



92
93
94
# File 'lib/oci/devops/models/pull_request.rb', line 92

def created_by
  @created_by
end

#defined_tagsHash<String, Hash<String, Object>>

[Required] Defined tags for this resource. Each key is predefined and scoped to a namespace. See Resource Tags. Example: {\"foo-namespace\": {\"bar-key\": \"value\"}}

Returns:

  • (Hash<String, Hash<String, Object>>)


115
116
117
# File 'lib/oci/devops/models/pull_request.rb', line 115

def defined_tags
  @defined_tags
end

#descriptionString

Details of the pull request. Avoid entering confidential information.

Returns:

  • (String)


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

def description
  @description
end

#destination_branchString

[Required] The destination branch against which the changes are to be reviewed. Example: "main".

Returns:

  • (String)


57
58
59
# File 'lib/oci/devops/models/pull_request.rb', line 57

def destination_branch
  @destination_branch
end

#display_nameString

[Required] PullRequest title, can be renamed

Returns:

  • (String)


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

def display_name
  @display_name
end

#freeform_tagsHash<String, String>

[Required] Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. See Resource Tags. Example: {\"bar-key\": \"value\"}

Returns:

  • (Hash<String, String>)


111
112
113
# File 'lib/oci/devops/models/pull_request.rb', line 111

def freeform_tags
  @freeform_tags
end

#idString

[Required] Unique identifier that is immutable on creation

Returns:

  • (String)


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

def id
  @id
end

#lifecycle_detailsString

[Required] The status of the Pull Request.

Returns:

  • (String)


81
82
83
# File 'lib/oci/devops/models/pull_request.rb', line 81

def lifecycle_details
  @lifecycle_details
end

#lifecycle_stateString

[Required] The current state of the PullRequest.

Returns:

  • (String)


77
78
79
# File 'lib/oci/devops/models/pull_request.rb', line 77

def lifecycle_state
  @lifecycle_state
end

#merge_base_commit_id_at_terminationString

The merge base commit ID when the Pull Request status was last changed to merged or closed

Returns:

  • (String)


65
66
67
# File 'lib/oci/devops/models/pull_request.rb', line 65

def merge_base_commit_id_at_termination
  @merge_base_commit_id_at_termination
end

#merge_checksOCI::Devops::Models::MergeCheckCollection



88
89
90
# File 'lib/oci/devops/models/pull_request.rb', line 88

def merge_checks
  @merge_checks
end

#merged_byOCI::Devops::Models::PrincipalDetails



95
96
97
# File 'lib/oci/devops/models/pull_request.rb', line 95

def merged_by
  @merged_by
end

#repository_idString

[Required] DevOps Repository Identifier tells which repository this pull request belongs to

Returns:

  • (String)


49
50
51
# File 'lib/oci/devops/models/pull_request.rb', line 49

def repository_id
  @repository_id
end

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

List of Reviewers.

Returns:



85
86
87
# File 'lib/oci/devops/models/pull_request.rb', line 85

def reviewers
  @reviewers
end

#source_branchString

[Required] The source branch which contains the changes to be reviewed. Example: "feature/JIRA-123"

Returns:

  • (String)


53
54
55
# File 'lib/oci/devops/models/pull_request.rb', line 53

def source_branch
  @source_branch
end

#source_commit_id_at_terminationString

The source branch commit ID when the Pull Request status was last changed to merged or closed

Returns:

  • (String)


61
62
63
# File 'lib/oci/devops/models/pull_request.rb', line 61

def source_commit_id_at_termination
  @source_commit_id_at_termination
end

#source_repository_idString

The OCID of the forked repository that will act as the source of the changes to be included in the pull request against the parent repository.

Returns:

  • (String)


99
100
101
# File 'lib/oci/devops/models/pull_request.rb', line 99

def source_repository_id
  @source_repository_id
end

#system_tagsHash<String, Hash<String, Object>>

[Required] Usage of system tag keys. These predefined keys are scoped to namespaces. See Resource Tags. Example: {\"orcl-cloud\": {\"free-tier-retained\": \"true\"}}

Returns:

  • (Hash<String, Hash<String, Object>>)


119
120
121
# File 'lib/oci/devops/models/pull_request.rb', line 119

def system_tags
  @system_tags
end

#time_createdDateTime

[Required] The time the PullRequest was created. An RFC3339 formatted datetime string

Returns:

  • (DateTime)


69
70
71
# File 'lib/oci/devops/models/pull_request.rb', line 69

def time_created
  @time_created
end

#time_updatedDateTime

The time the PullRequest was updated. An RFC3339 formatted datetime string

Returns:

  • (DateTime)


73
74
75
# File 'lib/oci/devops/models/pull_request.rb', line 73

def time_updated
  @time_updated
end

#total_commentsInteger

[Required] The total number of comments on the pull request.

Returns:

  • (Integer)


103
104
105
# File 'lib/oci/devops/models/pull_request.rb', line 103

def total_comments
  @total_comments
end

#total_reviewersInteger

[Required] The total number of reviewers on the pull request.

Returns:

  • (Integer)


107
108
109
# File 'lib/oci/devops/models/pull_request.rb', line 107

def total_reviewers
  @total_reviewers
end

Class Method Details

.attribute_mapObject

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



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/oci/devops/models/pull_request.rb', line 122

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'display_name': :'displayName',
    'description': :'description',
    'compartment_id': :'compartmentId',
    'repository_id': :'repositoryId',
    'source_branch': :'sourceBranch',
    'destination_branch': :'destinationBranch',
    'source_commit_id_at_termination': :'sourceCommitIdAtTermination',
    'merge_base_commit_id_at_termination': :'mergeBaseCommitIdAtTermination',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails',
    'reviewers': :'reviewers',
    'merge_checks': :'mergeChecks',
    'created_by': :'createdBy',
    'merged_by': :'mergedBy',
    'source_repository_id': :'sourceRepositoryId',
    'total_comments': :'totalComments',
    'total_reviewers': :'totalReviewers',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'system_tags': :'systemTags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/devops/models/pull_request.rb', line 153

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'display_name': :'String',
    'description': :'String',
    'compartment_id': :'String',
    'repository_id': :'String',
    'source_branch': :'String',
    'destination_branch': :'String',
    'source_commit_id_at_termination': :'String',
    'merge_base_commit_id_at_termination': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'lifecycle_state': :'String',
    'lifecycle_details': :'String',
    'reviewers': :'Array<OCI::Devops::Models::Reviewer>',
    'merge_checks': :'OCI::Devops::Models::MergeCheckCollection',
    'created_by': :'OCI::Devops::Models::PrincipalDetails',
    'merged_by': :'OCI::Devops::Models::PrincipalDetails',
    'source_repository_id': :'String',
    'total_comments': :'Integer',
    'total_reviewers': :'Integer',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'system_tags': :'Hash<String, Hash<String, Object>>'
    # 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



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/oci/devops/models/pull_request.rb', line 378

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

  self.class == other.class &&
    id == other.id &&
    display_name == other.display_name &&
    description == other.description &&
    compartment_id == other.compartment_id &&
    repository_id == other.repository_id &&
    source_branch == other.source_branch &&
    destination_branch == other.destination_branch &&
    source_commit_id_at_termination == other.source_commit_id_at_termination &&
    merge_base_commit_id_at_termination == other.merge_base_commit_id_at_termination &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details &&
    reviewers == other.reviewers &&
    merge_checks == other.merge_checks &&
    created_by == other.created_by &&
    merged_by == other.merged_by &&
    source_repository_id == other.source_repository_id &&
    total_comments == other.total_comments &&
    total_reviewers == other.total_reviewers &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    system_tags == other.system_tags
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



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/oci/devops/models/pull_request.rb', line 430

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


410
411
412
# File 'lib/oci/devops/models/pull_request.rb', line 410

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



419
420
421
# File 'lib/oci/devops/models/pull_request.rb', line 419

def hash
  [id, display_name, description, compartment_id, repository_id, source_branch, destination_branch, source_commit_id_at_termination, merge_base_commit_id_at_termination, time_created, time_updated, lifecycle_state, lifecycle_details, reviewers, merge_checks, created_by, merged_by, source_repository_id, total_comments, total_reviewers, freeform_tags, defined_tags, system_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



463
464
465
466
467
468
469
470
471
472
# File 'lib/oci/devops/models/pull_request.rb', line 463

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



457
458
459
# File 'lib/oci/devops/models/pull_request.rb', line 457

def to_s
  to_hash.to_s
end