2018-10-06 19:10:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-22 15:09:25 -04:00
|
|
|
module Bitbucket
|
|
|
|
module Representation
|
|
|
|
class Issue < Representation::Base
|
|
|
|
CLOSED_STATUS = %w(resolved invalid duplicate wontfix closed).freeze
|
|
|
|
|
|
|
|
def iid
|
|
|
|
raw['id']
|
|
|
|
end
|
|
|
|
|
2016-12-07 11:04:02 -05:00
|
|
|
def kind
|
|
|
|
raw['kind']
|
|
|
|
end
|
|
|
|
|
2016-08-22 15:09:25 -04:00
|
|
|
def author
|
2019-08-07 09:01:18 -04:00
|
|
|
raw.dig('reporter', 'nickname')
|
2016-08-22 15:09:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2016-12-16 16:51:40 -05:00
|
|
|
raw.fetch('content', {}).fetch('raw', nil)
|
2016-08-22 15:09:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def state
|
|
|
|
closed? ? 'closed' : 'opened'
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
raw['title']
|
|
|
|
end
|
|
|
|
|
2016-12-16 05:12:53 -05:00
|
|
|
def milestone
|
2016-12-16 16:51:40 -05:00
|
|
|
raw['milestone']['name'] if raw['milestone'].present?
|
2016-12-16 05:12:53 -05:00
|
|
|
end
|
|
|
|
|
2016-08-22 15:09:25 -04:00
|
|
|
def created_at
|
|
|
|
raw['created_on']
|
|
|
|
end
|
|
|
|
|
|
|
|
def updated_at
|
|
|
|
raw['edited_on']
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
iid
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def closed?
|
|
|
|
CLOSED_STATUS.include?(raw['state'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|