Class: CC::Service::GitHubPullRequests
- Inherits:
-
CC::Service
- Object
- CC::Service
- CC::Service::GitHubPullRequests
- Defined in:
- lib/cc/services/github_pull_requests.rb
Defined Under Namespace
Classes: Config
Constant Summary collapse
- BODY_REGEX =
%r{<b>Code Climate</b> has <a href=".*">analyzed this pull request</a>}- COMMENT_BODY =
'<img src="https://codeclimate.com/favicon.png" width="20" height="20" /> <b>Code Climate</b> has <a href="%s">analyzed this pull request</a>.'
Constants inherited from CC::Service
ALL_EVENTS, ConfigurationError, Error
Constants included from Helper
Helper::GREEN_HEX, Helper::RED_HEX
Instance Attribute Summary
Attributes inherited from CC::Service
Instance Method Summary collapse
- #receive_pull_request ⇒ Object
-
#receive_test ⇒ Object
Just make sure we can access GH using the configured token.
Methods inherited from CC::Service
by_slug, inherited, #initialize, load_services, #receive, services, slug
Methods included from Helper
#changed, #color, #compare_url, #details_url, #emoji, #hex_color, #improved?, #repo_name
Methods included from HTTP
#ca_file, #http, #http_method, #raw_get, #raw_post, #service_get, #service_post
Constructor Details
This class inherits a constructor from CC::Service
Instance Method Details
#receive_pull_request ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cc/services/github_pull_requests.rb', line 50 def receive_pull_request setup_http state = @payload["state"] if %w[pending success failure skipped error].include?(state) send("update_status_#{state}") else @response = simple_failure("Unknown state") end response end |
#receive_test ⇒ Object
Just make sure we can access GH using the configured token. Without additional information (github-slug, PR number, etc) we can’t test much else.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cc/services/github_pull_requests.rb', line 35 def receive_test setup_http if update_status? && add_comment? receive_test_status receive_test_comment elsif update_status? receive_test_status elsif add_comment? receive_test_comment else simple_failure("Nothing happened") end end |