Class: Snippets::BaseService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- Snippets::BaseService
- Defined in:
- app/services/snippets/base_service.rb
Direct Known Subclasses
Constant Summary collapse
- UPDATE_COMMIT_MSG =
'Update snippet'- INITIAL_COMMIT_MSG =
'Initial commit'- INVALID_PARAMS_ERROR =
:invalid_params_error- INVALID_PARAMS_MESSAGES =
{ cannot_be_used_together: 'and snippet files cannot be used together', invalid_data: 'have invalid data' }.freeze
- SNIPPET_ACCESS_ERROR =
:snippet_access_error- CreateRepositoryError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#snippet_actions ⇒ Object
readonly
Returns the value of attribute snippet_actions.
-
#uploaded_assets ⇒ Object
readonly
Returns the value of attribute uploaded_assets.
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
-
#initialize(project: nil, current_user: nil, params: {}) ⇒ BaseService
constructor
A new instance of BaseService.
Methods inherited from BaseContainerService
#group_container?, #namespace_container?, #project_container?, #project_group, #root_ancestor
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
Constructor Details
#initialize(project: nil, current_user: nil, params: {}) ⇒ BaseService
Returns a new instance of BaseService.
18 19 20 21 22 23 24 25 |
# File 'app/services/snippets/base_service.rb', line 18 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_actions ⇒ Object (readonly)
Returns the value of attribute snippet_actions.
16 17 18 |
# File 'app/services/snippets/base_service.rb', line 16 def snippet_actions @snippet_actions end |
#uploaded_assets ⇒ Object (readonly)
Returns the value of attribute uploaded_assets.
16 17 18 |
# File 'app/services/snippets/base_service.rb', line 16 def uploaded_assets @uploaded_assets end |