blob: 939de982db41738730ef59821369371c56c805e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
module Releases
module Links
class BaseService
attr_accessor :release, :current_user, :params
def initialize(release, current_user = nil, params = {})
@release = release
@current_user = current_user
@params = params.dup
end
private
def allowed_params
@allowed_params ||= params.slice(:name, :url, :link_type).tap do |hash|
hash[:filepath] = filepath if provided_filepath?
end
end
def provided_filepath?
params.key?(:direct_asset_path) || params.key?(:filepath)
end
def filepath
params[:direct_asset_path] || params[:filepath]
end
end
end
end
|