Class: Snippets::BaseService

Inherits:
BaseProjectService show all
Defined in:
app/services/snippets/base_service.rb

Direct Known Subclasses

CreateService, UpdateService

Constant Summary collapse

UPDATE_COMMIT_MSG =
'Update snippet'
INITIAL_COMMIT_MSG =
'Initial commit'
CreateRepositoryError =
Class.new(StandardError)

Instance Attribute Summary collapse

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(project: nil, current_user: nil, params: {}) ⇒ BaseService

Returns a new instance of BaseService.



12
13
14
15
16
17
18
19
# File 'app/services/snippets/base_service.rb', line 12

def initialize(project: nil, current_user: nil, params: {})
  super

  @uploaded_assets = Array(@params.delete(:files).presence)

  input_actions = Array(@params.delete(:snippet_actions).presence)
  @snippet_actions = SnippetInputActionCollection.new(input_actions, allowed_actions: restricted_files_actions)
end

Instance Attribute Details

#snippet_actionsObject (readonly)

Returns the value of attribute snippet_actions.



10
11
12
# File 'app/services/snippets/base_service.rb', line 10

def snippet_actions
  @snippet_actions
end

#uploaded_assetsObject (readonly)

Returns the value of attribute uploaded_assets.



10
11
12
# File 'app/services/snippets/base_service.rb', line 10

def uploaded_assets
  @uploaded_assets
end