Module: GitlabApi::ApiClient::Issue
- Included in:
- GitlabKernel
- Defined in:
- lib/git/gitlab/api/issue.rb
Constant Summary collapse
- PER_PAGE =
100
- PAGE =
1
Instance Method Summary collapse
- #_issues(list, pid, page, per_page) ⇒ Object
- #all_issues(pid, page, per_page) ⇒ Object
- #issue(id) ⇒ Object
- #issues(with_closed) ⇒ Object
Instance Method Details
#_issues(list, pid, page, per_page) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/git/gitlab/api/issue.rb', line 42 def _issues(list, pid, page, per_page) i = @client.issues(pid, :page => page, :per_page => per_page) if i.count < per_page list + i else _issues(list + i, pid, page + 1, per_page) end end |
#all_issues(pid, page, per_page) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/git/gitlab/api/issue.rb', line 41 def all_issues(pid, page, per_page) def _issues(list, pid, page, per_page) i = @client.issues(pid, :page => page, :per_page => per_page) if i.count < per_page list + i else _issues(list + i, pid, page + 1, per_page) end end i = @client.issues(pid, :page => page, :per_page => per_page) if i.count < per_page i else _issues(i, pid, page + 1, per_page) end end |
#issue(id) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/git/gitlab/api/issue.rb', line 12 def issue(id) pid = project_id issues = all_issues(pid, PAGE, PER_PAGE) specfied_issue = issues.select { |issue| issue.iid == id.to_i }.first if specfied_issue == nil raise GitlabApi::Error::IssueNotFound, "Issue not find" else specfied_issue end end |