Add issue representation
This commit is contained in:
parent
0a52ae8380
commit
0b1d1931fb
1 changed files with 57 additions and 0 deletions
57
lib/github/representation/issue.rb
Normal file
57
lib/github/representation/issue.rb
Normal file
|
@ -0,0 +1,57 @@
|
|||
module Github
|
||||
module Representation
|
||||
class Issue < Representation::Base
|
||||
def iid
|
||||
raw['number']
|
||||
end
|
||||
|
||||
def title
|
||||
raw['title']
|
||||
end
|
||||
|
||||
def description
|
||||
raw['body'] || ''
|
||||
end
|
||||
|
||||
def milestone
|
||||
return unless raw['milestone'].present?
|
||||
|
||||
@milestone ||= Github::Representation::Milestone.new(raw['milestone'])
|
||||
end
|
||||
|
||||
def author
|
||||
@author ||= Github::Representation::User.new(raw['user'])
|
||||
end
|
||||
|
||||
def assignee
|
||||
return unless assigned?
|
||||
|
||||
@assignee ||= Github::Representation::User.new(raw['assignee'])
|
||||
end
|
||||
|
||||
def state
|
||||
raw['state'] == 'closed' ? 'closed' : 'opened'
|
||||
end
|
||||
|
||||
def url
|
||||
raw['url']
|
||||
end
|
||||
|
||||
def created_at
|
||||
raw['created_at']
|
||||
end
|
||||
|
||||
def updated_at
|
||||
raw['updated_at']
|
||||
end
|
||||
|
||||
def assigned?
|
||||
raw['assignee'].present?
|
||||
end
|
||||
|
||||
def pull_request?
|
||||
raw['pull_request'].present?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue