Class: Athenian::JIRAIssue

Inherits:
Object
  • Object
show all
Defined in:
lib/athenian/models/jira_issue.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ JIRAIssue

Initializes the object

Parameters:

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

    Model attributes in the form of hash



147
148
149
150
151
152
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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
# File 'lib/athenian/models/jira_issue.rb', line 147

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, 'The input argument (attributes) must be a hash in `Athenian::JIRAIssue` initialize method'
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Athenian::JIRAIssue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.key?(:'work_began')
    self.work_began = attributes[:'work_began']
  end

  if attributes.key?(:'resolved')
    self.resolved = attributes[:'resolved']
  end

  if attributes.key?(:'lead_time')
    self.lead_time = attributes[:'lead_time']
  end

  if attributes.key?(:'life_time')
    self.life_time = attributes[:'life_time']
  end

  if attributes.key?(:'reporter')
    self.reporter = attributes[:'reporter']
  end

  if attributes.key?(:'assignee')
    self.assignee = attributes[:'assignee']
  end

  if attributes.key?(:'comments')
    self.comments = attributes[:'comments']
  end

  if attributes.key?(:'comment_list')
    if (value = attributes[:'comment_list']).is_a?(Array)
      self.comment_list = value
    end
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.key?(:'rendered_description')
    self.rendered_description = attributes[:'rendered_description']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'story_points')
    self.story_points = attributes[:'story_points']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'project')
    self.project = attributes[:'project']
  end

  if attributes.key?(:'prs')
    if (value = attributes[:'prs']).is_a?(Array)
      self.prs = value
    end
  end
end

Instance Attribute Details

#assigneeObject

Name of the assigned person.



41
42
43
# File 'lib/athenian/models/jira_issue.rb', line 41

def assignee
  @assignee
end

#comment_listObject

The list of comments for the issue.



47
48
49
# File 'lib/athenian/models/jira_issue.rb', line 47

def comment_list
  @comment_list
end

#commentsObject

Number of comments in the issue excluding sub-tasks and children.



44
45
46
# File 'lib/athenian/models/jira_issue.rb', line 44

def comments
  @comments
end

#createdObject

When this issue was created.



22
23
24
# File 'lib/athenian/models/jira_issue.rb', line 22

def created
  @created
end

#idObject

JIRA issue key ‘PROJECT-###`.



16
17
18
# File 'lib/athenian/models/jira_issue.rb', line 16

def id
  @id
end

#lead_timeObject

Returns the value of attribute lead_time.



33
34
35
# File 'lib/athenian/models/jira_issue.rb', line 33

def lead_time
  @lead_time
end

#life_timeObject

Returns the value of attribute life_time.



35
36
37
# File 'lib/athenian/models/jira_issue.rb', line 35

def life_time
  @life_time
end

#priorityObject

Name of the priority. The details are returned in ‘FilteredJIRAStuff.priorities`.



50
51
52
# File 'lib/athenian/models/jira_issue.rb', line 50

def priority
  @priority
end

#projectObject

Identifier of the project where this issue exists.



68
69
70
# File 'lib/athenian/models/jira_issue.rb', line 68

def project
  @project
end

#prsObject

Details about the mapped PRs. ‘jira` field is unfilled.



71
72
73
# File 'lib/athenian/models/jira_issue.rb', line 71

def prs
  @prs
end

#rendered_descriptionObject

The description of the issue rendered as HTML.



53
54
55
# File 'lib/athenian/models/jira_issue.rb', line 53

def rendered_description
  @rendered_description
end

#reporterObject

Name of the person who reported the issue.



38
39
40
# File 'lib/athenian/models/jira_issue.rb', line 38

def reporter
  @reporter
end

#resolvedObject

When the issue finished: the stage is "Done" and all PRs are either released or rejected. This timestamp can be missing and is always greater than or equal to ‘work_began`.



31
32
33
# File 'lib/athenian/models/jira_issue.rb', line 31

def resolved
  @resolved
end

#statusObject

Name of the status. The details are returned in ‘FilteredJIRAStuff.statuses`.



56
57
58
# File 'lib/athenian/models/jira_issue.rb', line 56

def status
  @status
end

#story_pointsObject

Value of the "story points" field.



59
60
61
# File 'lib/athenian/models/jira_issue.rb', line 59

def story_points
  @story_points
end

#titleObject

Title of this issue.



19
20
21
# File 'lib/athenian/models/jira_issue.rb', line 19

def title
  @title
end

#typeObject

Name of the issue type. The details are returned in ‘FilteredJIRAStuff.issue_types`.



62
63
64
# File 'lib/athenian/models/jira_issue.rb', line 62

def type
  @type
end

#updatedObject

When this issue was last updated.



25
26
27
# File 'lib/athenian/models/jira_issue.rb', line 25

def updated
  @updated
end

#urlObject

Link to the issue in JIRA web application.



65
66
67
# File 'lib/athenian/models/jira_issue.rb', line 65

def url
  @url
end

#work_beganObject

When the issue entered the "In Progress" stage or received a PR. This timestamp can be missing and is always less than or equal to ‘resolved`.



28
29
30
# File 'lib/athenian/models/jira_issue.rb', line 28

def work_began
  @work_began
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



100
101
102
# File 'lib/athenian/models/jira_issue.rb', line 100

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/athenian/models/jira_issue.rb', line 74

def self.attribute_map
  {
    :'id' => :'id',
    :'title' => :'title',
    :'created' => :'created',
    :'updated' => :'updated',
    :'work_began' => :'work_began',
    :'resolved' => :'resolved',
    :'lead_time' => :'lead_time',
    :'life_time' => :'life_time',
    :'reporter' => :'reporter',
    :'assignee' => :'assignee',
    :'comments' => :'comments',
    :'comment_list' => :'comment_list',
    :'priority' => :'priority',
    :'rendered_description' => :'rendered_description',
    :'status' => :'status',
    :'story_points' => :'story_points',
    :'type' => :'type',
    :'url' => :'url',
    :'project' => :'project',
    :'prs' => :'prs'
  }
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



355
356
357
# File 'lib/athenian/models/jira_issue.rb', line 355

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



138
139
140
141
142
143
# File 'lib/athenian/models/jira_issue.rb', line 138

def self.openapi_all_of
  [
  :'JIRAEpicIssueCommon',
  :'JIRAIssueAllOf'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



131
132
133
134
135
# File 'lib/athenian/models/jira_issue.rb', line 131

def self.openapi_nullable
  Set.new([
    :'priority',
  ])
end

.openapi_typesObject

Attribute type mapping.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/athenian/models/jira_issue.rb', line 105

def self.openapi_types
  {
    :'id' => :'String',
    :'title' => :'String',
    :'created' => :'Time',
    :'updated' => :'Time',
    :'work_began' => :'Time',
    :'resolved' => :'Time',
    :'lead_time' => :'Object',
    :'life_time' => :'Object',
    :'reporter' => :'String',
    :'assignee' => :'String',
    :'comments' => :'Integer',
    :'comment_list' => :'Array<JIRAComment>',
    :'priority' => :'String',
    :'rendered_description' => :'String',
    :'status' => :'String',
    :'story_points' => :'Float',
    :'type' => :'String',
    :'url' => :'String',
    :'project' => :'String',
    :'prs' => :'Array<PullRequest>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/athenian/models/jira_issue.rb', line 315

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      title == o.title &&
      created == o.created &&
      updated == o.updated &&
      work_began == o.work_began &&
      resolved == o.resolved &&
      lead_time == o.lead_time &&
      life_time == o.life_time &&
      reporter == o.reporter &&
      assignee == o.assignee &&
      comments == o.comments &&
      comment_list == o.comment_list &&
      priority == o.priority &&
      rendered_description == o.rendered_description &&
      status == o.status &&
      story_points == o.story_points &&
      type == o.type &&
      url == o.url &&
      project == o.project &&
      prs == o.prs
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/athenian/models/jira_issue.rb', line 386

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Athenian.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/athenian/models/jira_issue.rb', line 457

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/athenian/models/jira_issue.rb', line 362

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


342
343
344
# File 'lib/athenian/models/jira_issue.rb', line 342

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



348
349
350
# File 'lib/athenian/models/jira_issue.rb', line 348

def hash
  [id, title, created, updated, work_began, resolved, lead_time, life_time, reporter, assignee, comments, comment_list, priority, rendered_description, status, story_points, type, url, project, prs].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/athenian/models/jira_issue.rb', line 247

def list_invalid_properties
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @title.nil?
    invalid_properties.push('invalid value for "title", title cannot be nil.')
  end

  if @created.nil?
    invalid_properties.push('invalid value for "created", created cannot be nil.')
  end

  if @updated.nil?
    invalid_properties.push('invalid value for "updated", updated cannot be nil.')
  end

  if @life_time.nil?
    invalid_properties.push('invalid value for "life_time", life_time cannot be nil.')
  end

  if @reporter.nil?
    invalid_properties.push('invalid value for "reporter", reporter cannot be nil.')
  end

  if @comments.nil?
    invalid_properties.push('invalid value for "comments", comments cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @url.nil?
    invalid_properties.push('invalid value for "url", url cannot be nil.')
  end

  if @project.nil?
    invalid_properties.push('invalid value for "project", project cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



433
434
435
# File 'lib/athenian/models/jira_issue.rb', line 433

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/athenian/models/jira_issue.rb', line 439

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



427
428
429
# File 'lib/athenian/models/jira_issue.rb', line 427

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/athenian/models/jira_issue.rb', line 298

def valid?
  return false if @id.nil?
  return false if @title.nil?
  return false if @created.nil?
  return false if @updated.nil?
  return false if @life_time.nil?
  return false if @reporter.nil?
  return false if @comments.nil?
  return false if @status.nil?
  return false if @type.nil?
  return false if @url.nil?
  return false if @project.nil?
  true
end