Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2014-09-21 12:29:52 +0400
committerCiro Santilli <ciro.santilli@gmail.com>2014-09-21 13:43:05 +0400
commitad47993ac46cef672600f2384ee5fa2e661ec8be (patch)
tree07769b4efeb4c18762b3ed0e705179a5423926c1 /app/services/base_service.rb
parentfda61a047ffb9b04bc4dd38e897088fde17fb3c1 (diff)
Factor error and success methods from services.
Diffstat (limited to 'app/services/base_service.rb')
-rw-r--r--app/services/base_service.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/services/base_service.rb b/app/services/base_service.rb
index 31b38aca530..051612633cd 100644
--- a/app/services/base_service.rb
+++ b/app/services/base_service.rb
@@ -1,7 +1,7 @@
class BaseService
attr_accessor :project, :current_user, :params
- def initialize(project, user, params)
+ def initialize(project, user, params = {})
@project, @current_user, @params = project, user, params.dup
end
@@ -32,4 +32,19 @@ class BaseService
def system_hook_service
SystemHooksService.new
end
+
+ private
+
+ def error(message)
+ {
+ message: message,
+ status: :error
+ }
+ end
+
+ def success
+ {
+ status: :success
+ }
+ end
end