gitlab-org--gitlab-foss/app/services/projects/operations/update_service.rb
Reuben Pereira 43e713eb41 Refactor model and spec
- Move some specs into contexts
- Let get_slugs method take a parameter and return a specific slug.
- Add rescues when using Addressable::URI.
2019-03-01 14:51:54 +00:00

40 lines
1 KiB
Ruby

# frozen_string_literal: true
module Projects
module Operations
class UpdateService < BaseService
def execute
Projects::UpdateService
.new(project, current_user, project_update_params)
.execute
end
private
def project_update_params
error_tracking_params
end
def error_tracking_params
settings = params[:error_tracking_setting_attributes]
return {} if settings.blank?
api_url = ErrorTracking::ProjectErrorTrackingSetting.build_api_url_from(
api_host: settings[:api_host],
project_slug: settings.dig(:project, :slug),
organization_slug: settings.dig(:project, :organization_slug)
)
{
error_tracking_setting_attributes: {
api_url: api_url,
token: settings[:token],
enabled: settings[:enabled],
project_name: settings.dig(:project, :name),
organization_name: settings.dig(:project, :organization_name)
}
}
end
end
end
end