Module: GithubApi::Client::Issues

Included in:
GithubApi::Client
Defined in:
lib/tractive/github_api/client/issues.rb

Overview

Methods for the Issues API

Instance Method Summary collapse

Instance Method Details

#create_issue(repo, params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tractive/github_api/client/issues.rb', line 7

def create_issue(repo, params)
  JSON.parse(
    Http::Client::Request.post(
      "https://api.github.com/repos/#{repo}/import/issues",
      params.to_json,
      {
        "Authorization" => "token #{@token}",
        "Content-Type" => "application/json",
        "Accept" => "application/vnd.github.golden-comet-preview+json"
      }
    )
  )
end

#issue(repo, number) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/tractive/github_api/client/issues.rb', line 34

def issue(repo, number)
  JSON.parse(
    Http::Client::Request.get(
      "https://api.github.com/repos/#{repo}/issues/#{number}",
      { "Authorization" => "token #{@token}" }
    )
  )
end

#issue_comments(repo, issue_id) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/tractive/github_api/client/issues.rb', line 55

def issue_comments(repo, issue_id)
  JSON.parse(
    Http::Client::Request.get(
      "https://api.github.com/repos/#{repo}/issues/#{issue_id}/comments",
      {
        "Authorization" => "token #{@token}",
        "Accept" => "application/vnd.github.golden-comet-preview+json"
      }
    )
  )
end

#issue_import_status(repo, id) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/tractive/github_api/client/issues.rb', line 43

def issue_import_status(repo, id)
  JSON.parse(
    Http::Client::Request.get(
      "https://api.github.com/repos/#{repo}/import/issues/#{id}",
      {
        "Authorization" => "token #{@token}",
        "Accept" => "application/vnd.github.golden-comet-preview+json"
      }
    )
  )
end

#list_issues(repo, params) ⇒ Object Also known as: issues



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tractive/github_api/client/issues.rb', line 21

def list_issues(repo, params)
  JSON.parse(
    Http::Client::Request.get(
      "https://api.github.com/repos/#{repo}/issues",
      {
        "Authorization" => "token #{@token}",
        params: params
      }
    )
  )
end

#update_issue_comment(repo, comment_id, comment_body) ⇒ Object



67
68
69
70
71
72
73
74
75
# File 'lib/tractive/github_api/client/issues.rb', line 67

def update_issue_comment(repo, comment_id, comment_body)
  JSON.parse(
    Http::Client::Request.patch(
      "https://api.github.com/repos/#{repo}/issues/comments/#{comment_id}",
      { body: comment_body }.to_json,
      { "Authorization" => "token #{@token}" }
    )
  )
end