Class: Apadmi::Grout::Issue

Inherits:
Struct
  • Object
show all
Defined in:
lib/apadmi/grout/models/issue.rb

Overview

A generic issue type wrapping up the underlying JIRA & ADO object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#issue_typeObject

Returns the value of attribute issue_type

Returns:

  • (Object)

    the current value of issue_type



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def issue_type
  @issue_type
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def key
  @key
end

#raw_objectObject

Returns the value of attribute raw_object

Returns:

  • (Object)

    the current value of raw_object



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def raw_object
  @raw_object
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def status
  @status
end

#summaryObject

Returns the value of attribute summary

Returns:

  • (Object)

    the current value of summary



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def summary
  @summary
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



12
13
14
# File 'lib/apadmi/grout/models/issue.rb', line 12

def url
  @url
end

Class Method Details

.from_ado_hash(hash) ⇒ Apadmi::Grout::Issue



14
15
16
17
18
19
20
21
22
23
# File 'lib/apadmi/grout/models/issue.rb', line 14

def self.from_ado_hash(hash)
  Issue.new(
    hash["id"].to_s,
    hash["fields"]["System.Title"],
    hash["fields"]["System.State"],
    hash["fields"]["System.WorkItemType"],
    hash["url"],
    hash
  )
end

.from_ado_hashes(hashes) ⇒ Array<Apadmi::Grout::Issue>

Returns:



26
27
28
# File 'lib/apadmi/grout/models/issue.rb', line 26

def self.from_ado_hashes(hashes)
  hashes.map { |h| Issue.from_ado_hash(h) }
end

.from_jira_issue(issue, base_url) ⇒ Apadmi::Grout::Issue

Parameters:

  • issue (JIRA::Resource::Issue)

Returns:



32
33
34
35
36
37
38
39
40
41
# File 'lib/apadmi/grout/models/issue.rb', line 32

def self.from_jira_issue(issue, base_url)
  Issue.new(
    issue.key,
    issue.summary,
    issue.status.name,
    issue.issuetype.name,
    "#{base_url}/browse/#{issue.key}",
    issue
  )
end

.from_jira_issues(issues, base_url) ⇒ Array<Apadmi::Grout::Issue>

Returns:



44
45
46
# File 'lib/apadmi/grout/models/issue.rb', line 44

def self.from_jira_issues(issues, base_url)
  issues.map { |i| Issue.from_jira_issue(i, base_url) }
end