Sha256: 1c1685c2c682c17139b352868d7255b3b81a159eaad767272f7e9ebbc6afd999
Contents?: true
Size: 1.9 KB
Versions: 8
Compression:
Stored size: 1.9 KB
Contents
# frozen_string_literal: true module ConvenientService module Examples module Standard module RequestParams module Services class Prepare include ConvenientService::Standard::Config attr_reader :request step Services::ExtractParamsFromPath, \ in: [:request, {pattern: raw(/^\/rules\/(?<id>\d+)\.(?<format>\w+)$/)}], out: {params: :params_from_path} step Services::ExtractParamsFromBody, \ in: :request, out: {params: :params_from_body} step Services::MergeParams, \ in: [:params_from_path, :params_from_body], out: :params step Services::LogRequestParams, \ in: [:request, :params, tag: raw("Uncasted")] step Services::FilterOutUnpermittedParams, \ in: [:params, {permitted_keys: raw([:id, :format, :title, :description, :tags, :sources])}], out: reassign(:params) step Services::ApplyDefaultParamValues, \ in: [:params, defaults: raw({format: "json", tags: [], sources: []})], out: reassign(:params) step Services::ValidateUncastedParams, \ in: :params step Services::CastParams, \ in: :params, out: [:original_params, {casted_params: reassign(:params)}] step Services::LogRequestParams, \ in: [:request, :params, tag: raw("Casted")] step Services::ValidateCastedParams, \ in: [:original_params, {casted_params: :params}] step :result, \ in: :params, out: reassign(:params) def initialize(request:) @request = request end def result success(params: params) end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems