summaryrefslogtreecommitdiff
path: root/lib/github/representation/issue.rb
blob: 4f1a02cb90f58aab4a34983b971d8f2e750fed01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Github
  module Representation
    class Issue < Representation::Issuable
      def state
        raw['state'] == 'closed' ? 'closed' : 'opened'
      end

      def comments?
        raw['comments'] > 0
      end

      def pull_request?
        raw['pull_request'].present?
      end

      def assigned?
        raw['assignees'].present?
      end

      def assignees
        @assignees ||= Array(raw['assignees']).map do |user|
          Github::Representation::User.new(user, options)
        end
      end
    end
  end
end