class CircleCI::CoverageReporter::VCS::GitHub
Public Instance Methods
create_comment(body)
click to toggle source
@note Implement {Base#create_comment} @param body [String] @return [void] @raise [RequestError]
# File lib/circleci/coverage_reporter/vcs/github.rb, line 14 def create_comment(body) resp = request(body) raise RequestError.new(JSON.parse(resp.body)['message'], resp) unless resp.success? end
Private Instance Methods
configuration()
click to toggle source
@return [Configuration]
# File lib/circleci/coverage_reporter/vcs/github.rb, line 33 def configuration CoverageReporter.configuration end
request(body)
click to toggle source
@param body [String] @return [Faraday::Response]
# File lib/circleci/coverage_reporter/vcs/github.rb, line 23 def request(body) Faraday.new(url: 'https://api.github.com').post do |req| req.url ['/repos', configuration.project, 'commits', configuration.current_revision, 'comments'].join('/') req.headers['Authorization'] = "token #{token}" req.headers['Content-Type'] = 'application/json' req.body = JSON.generate(body: body) end end