Class: Lazylead::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/system/jira.rb

Overview

An issue from Jira

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(issue) ⇒ Issue

Returns a new instance of Issue.



139
140
141
# File 'lib/lazylead/system/jira.rb', line 139

def initialize(issue)
  @issue = issue
end

Instance Method Details

#assigneeObject



171
172
173
# File 'lib/lazylead/system/jira.rb', line 171

def assignee
  Lazylead::User.new(@issue.assignee.attrs)
end

#commentsObject



185
186
187
# File 'lib/lazylead/system/jira.rb', line 185

def comments
  @issue.comments
end

#duedateObject



159
160
161
# File 'lib/lazylead/system/jira.rb', line 159

def duedate
  @issue.fields["duedate"]
end

#fieldsObject



175
176
177
# File 'lib/lazylead/system/jira.rb', line 175

def fields
  @issue.fields
end

#historyObject



179
180
181
182
183
# File 'lib/lazylead/system/jira.rb', line 179

def history
  return [] unless @issue.respond_to? :changelog
  return [] if @issue.changelog == nil? || @issue.changelog.empty?
  @issue.changelog["histories"]
end

#idObject



143
144
145
# File 'lib/lazylead/system/jira.rb', line 143

def id
  @issue.id
end

#inspectObject



193
194
195
# File 'lib/lazylead/system/jira.rb', line 193

def inspect
  to_s
end

#keyObject



147
148
149
# File 'lib/lazylead/system/jira.rb', line 147

def key
  @issue.key
end

#priorityObject



163
164
165
# File 'lib/lazylead/system/jira.rb', line 163

def priority
  fields["priority"]["name"]
end

#reporterObject



167
168
169
# File 'lib/lazylead/system/jira.rb', line 167

def reporter
  Lazylead::User.new(fields["reporter"])
end

#summaryObject



151
152
153
# File 'lib/lazylead/system/jira.rb', line 151

def summary
  fields["summary"]
end

#to_sObject



189
190
191
# File 'lib/lazylead/system/jira.rb', line 189

def to_s
  "#{key} #{summary}"
end

#urlObject



155
156
157
# File 'lib/lazylead/system/jira.rb', line 155

def url
  @issue.attrs["self"].split("/rest/api/").first + "/browse/" + key
end