Class: Action::Project::ActivateHook

Inherits:
Object
  • Object
show all
Includes:
HookConfig, SetProjectAndBranch, InchCI::Action
Defined in:
app/services/action/project/activate_hook.rb

Defined Under Namespace

Modules: HookConfig

Constant Summary collapse

TRIGGER =
'activate_hook'

Constants included from HookConfig

HookConfig::HOOK_URL

Instance Method Summary collapse

Methods included from HookConfig

#hook_activate_options, #hook_create_options, #hook_deactivate_options, #hook_service, #hook_url_config

Methods included from SetProjectAndBranch

#set_project_and_branch

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(user, params) ⇒ ActivateHook

Returns a new instance of ActivateHook.


13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/action/project/activate_hook.rb', line 13

def initialize(user, params)
  set_project_and_branch(params)
  if user_access_token = user.github_access_token
    process_via_github(@project.to_model, user_access_token)
    if @project.to_model.builds.count == 0
      build(project)
    end
  else
    raise "Need access token!"
  end
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'app/services/action/project/activate_hook.rb', line 25

def success?
  !@project.github_hook_id.nil?
end