diff options
author | Kirilll Zaitsev <kirik910@gmail.com> | 2015-08-27 02:58:49 +0300 |
---|---|---|
committer | Kirilll Zaitsev <kirik910@gmail.com> | 2015-09-02 05:52:16 +0300 |
commit | 263abda3fd7ddfb826cd17ae88fb47d0e1d67fae (patch) | |
tree | 14a7085fc1998bbb0d30b7d1e5dca71f6b599193 /lib/api/helpers.rb | |
parent | 308c6428aef2a46b0370a24d85a97b0e133283a8 (diff) | |
download | gitlab-ce-263abda3fd7ddfb826cd17ae88fb47d0e1d67fae.tar.gz |
Drone CI service
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 1ebf9a1f022..76c9cc2e3a4 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -55,6 +55,32 @@ module API end end + def project_service + @project_service ||= begin + underscored_service = params[:service_slug].underscore + + if Service.available_services_names.include?(underscored_service) + user_project.build_missing_services + + service_method = "#{underscored_service}_service" + + send_service(service_method) + end + end + + @project_service || not_found!("Service") + end + + def send_service(service_method) + user_project.send(service_method) + end + + def service_attributes + @service_attributes ||= project_service.fields.inject([]) do |arr, hash| + arr << hash[:name].to_sym + end + end + def find_group(id) begin group = Group.find(id) |