diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-12 22:41:58 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-04-24 16:17:52 -0300 |
commit | 0b1d1931fb00f15987f695d76efb5dac9d3992d7 (patch) | |
tree | f15956d9d18697b1625e03ac8bc8f786d29d616f /lib/github/representation | |
parent | 0a52ae8380d52bf697057d32a404c93f11c9f93d (diff) | |
download | gitlab-ce-0b1d1931fb00f15987f695d76efb5dac9d3992d7.tar.gz |
Add issue representation
Diffstat (limited to 'lib/github/representation')
-rw-r--r-- | lib/github/representation/issue.rb | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/github/representation/issue.rb b/lib/github/representation/issue.rb new file mode 100644 index 00000000000..62c71cc191b --- /dev/null +++ b/lib/github/representation/issue.rb @@ -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 |