diff options
Diffstat (limited to 'app/services/releases/links/params.rb')
-rw-r--r-- | app/services/releases/links/params.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/services/releases/links/params.rb b/app/services/releases/links/params.rb new file mode 100644 index 00000000000..124ab333bbc --- /dev/null +++ b/app/services/releases/links/params.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Releases + module Links + class Params + def initialize(params) + @params = params.with_indifferent_access + end + + def allowed_params + @allowed_params ||= params.slice(:name, :url, :link_type).tap do |hash| + hash[:filepath] = filepath if provided_filepath? + end + end + + private + + attr_reader :params + + def provided_filepath? + params.key?(:direct_asset_path) || params.key?(:filepath) + end + + def filepath + params[:direct_asset_path] || params[:filepath] + end + end + end +end |