Class: CrashReporter::GithubIssues
- Inherits:
-
Object
- Object
- CrashReporter::GithubIssues
- Defined in:
- lib/crash_reporter/reporters/github_issues.rb
Constant Summary collapse
- GH_URI =
'https://api.github.com'
Instance Method Summary collapse
-
#initialize(repo_name = CrashReporter.configuration.repo_path, token) ⇒ GithubIssues
constructor
A new instance of GithubIssues.
- #run(data) ⇒ Object
Constructor Details
#initialize(repo_name = CrashReporter.configuration.repo_path, token) ⇒ GithubIssues
Returns a new instance of GithubIssues.
7 8 9 10 |
# File 'lib/crash_reporter/reporters/github_issues.rb', line 7 def initialize(repo_name = CrashReporter.configuration.repo_path, token) @repo_name = repo_name @token = token end |
Instance Method Details
#run(data) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/crash_reporter/reporters/github_issues.rb', line 12 def run(data) # Run custom formatting on Ruby StandardError objects, otherwise, just pass through data = format(data) if data.is_a?(StandardError) HTTP.headers( accept: 'application/vnd.github.v3+json', authorization: "token #{@token}" ).post("#{GH_URI}/repos/#{@repo_name}/issues", json: { labels: CrashReporter.configuration., title: "Crash report from #{CrashReporter.configuration.project_name}", body: data }) data end |