summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
blob: 13a48e12019751088c68a9763bb21ad3831b2e8b (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module Gitlab
  module Entities
    class User < Grape::Entity
      expose :id, :email, :name, :bio, :skype, :linkedin, :twitter,
             :dark_scheme, :theme_id, :blocked, :created_at
    end

    class UserBasic < Grape::Entity
      expose :id, :email, :name, :blocked, :created_at
    end

    class Hook < Grape::Entity
      expose :id, :url
    end

    class Project < Grape::Entity
      expose :id, :code, :name, :description, :path, :default_branch
      expose :owner, using: Entities::UserBasic
      expose :private_flag, as: :private
      expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
    end

    class UsersProject < Grape::Entity
      expose :user, using: Entities::UserBasic
      expose :project_access
    end

    class RepoObject < Grape::Entity
      expose :name, :commit
    end

    class ProjectSnippet < Grape::Entity
      expose :id, :title, :file_name
      expose :author, using: Entities::UserBasic
      expose :expires_at, :updated_at, :created_at
    end

    class Milestone < Grape::Entity
      expose :id, :title, :description, :due_date, :closed, :updated_at, :created_at
    end

    class Issue < Grape::Entity
      expose :id
      expose (:project_id) {|issue| issue.project.id}
      expose :title, :description
      expose :label_list, as: :labels
      expose :milestone, using: Entities::Milestone
      expose :assignee, :author, using: Entities::UserBasic
      expose :closed, :updated_at, :created_at
    end

    class Key < Grape::Entity
      expose  :id, 
              :title, 
              :key
    end
  end
end