Class: ConvenientService::Examples::Standard::RequestParams::Services::FilterOutUnpermittedParams

Inherits:
Object
  • Object
show all
Includes:
Service::Configs::Standard
Defined in:
lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params:, permitted_keys:) ⇒ FilterOutUnpermittedParams

Returns a new instance of FilterOutUnpermittedParams.



13
14
15
16
# File 'lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb', line 13

def initialize(params:, permitted_keys:)
  @params = params
  @permitted_keys = permitted_keys
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



11
12
13
# File 'lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb', line 11

def params
  @params
end

#permitted_keysObject (readonly)

Returns the value of attribute permitted_keys.



11
12
13
# File 'lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb', line 11

def permitted_keys
  @permitted_keys
end

Instance Method Details

#resultObject



18
19
20
# File 'lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb', line 18

def result
  success(params: params.slice(*permitted_keys))
end