Class: Crashbreak::GithubIntegrationService

Inherits:
Object
  • Object
show all
Defined in:
lib/crashbreak/github_integration_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(error_hash) ⇒ GithubIntegrationService

Returns a new instance of GithubIntegrationService.



3
4
5
6
# File 'lib/crashbreak/github_integration_service.rb', line 3

def initialize(error_hash)
  @error_id = error_hash['id']
  @error_deploy_revision = error_hash['deploy_revision']
end

Instance Method Details

#create_pull_requestObject



18
19
20
# File 'lib/crashbreak/github_integration_service.rb', line 18

def create_pull_request
  client.create_pull_request(repo_name, development_branch_name, error_branch_name.gsub('heads/', ''), "Crashbreak - fix for error #{@error_id}", '')
end

#push_testObject



8
9
10
11
# File 'lib/crashbreak/github_integration_service.rb', line 8

def push_test
  create_branch(branch_sha)
  create_test_file
end

#remove_testObject



13
14
15
16
# File 'lib/crashbreak/github_integration_service.rb', line 13

def remove_test
  client.delete_contents(repo_name, file_path, "Remove test for error #{@error_id}",
                         test_file_sha, branch: "refs/#{error_branch_name}")
end