Class: ConvenientService::Examples::Standard::RequestParams::Services::ApplyDefaultParamValues

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params:, defaults:) ⇒ ApplyDefaultParamValues

Returns a new instance of ApplyDefaultParamValues.



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

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

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



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

def defaults
  @defaults
end

#paramsObject (readonly)

Returns the value of attribute params.



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

def params
  @params
end

Instance Method Details

#resultObject



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

def result
  success(params: defaults.merge(params))
end