Class: CC::Service::GitHubPullRequests

Inherits:
CC::Service show all
Defined in:
lib/cc/services/github_pull_requests.rb

Defined Under Namespace

Classes: Config

Constant Summary

Constants inherited from CC::Service

ALL_EVENTS, ConfigurationError, Error

Constants included from Helper

Helper::GREEN_HEX, Helper::RED_HEX

Constants included from HTTP

HTTP::REDIRECT_CODES

Instance Attribute Summary

Attributes inherited from CC::Service

#config, #event, #payload

Instance Method Summary collapse

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, #formatted_post_response, #http, #http_method, #raw_get, #raw_post, #service_get, #service_post, #service_post_with_redirects

Constructor Details

This class inherits a constructor from CC::Service

Instance Method Details

#receive_pull_requestObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cc/services/github_pull_requests.rb', line 40

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_testObject

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.



30
31
32
33
34
35
36
37
38
# File 'lib/cc/services/github_pull_requests.rb', line 30

def receive_test
  setup_http

  if update_status?
    receive_test_status
  else
    simple_failure("Nothing happened")
  end
end