class CircleCIReporter::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_reporter/vcs/github.rb, line 15 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_reporter/vcs/github.rb, line 34 def configuration CircleCIReporter.configuration end
request(body)
click to toggle source
@param body [String] @return [Faraday::Response]
# File lib/circleci_reporter/vcs/github.rb, line 24 def request(body) url = ['https://api.github.com', 'repos', configuration.project, 'commits', configuration.current_revision, 'comments'].join('/') Faraday.post(url) do |req| req.headers['Authorization'] = "token #{token}" req.headers['Content-Type'] = 'application/json' req.body = JSON.generate(body: body) end end