Sha256: 946be906c6e464879396e3c73a420464ca9c958aa7354855497d7774d7dae600

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasResultSteps
        module Entities
          class Step
            module Commands
              class CastParams < Support::Command
                attr_reader :original_params

                def initialize(original_params:)
                  @original_params = original_params
                end

                def call
                  Structs::Params.new(
                    service: service,
                    inputs: inputs,
                    outputs: outputs,
                    index: index,
                    container: container,
                    organizer: organizer
                  )
                end

                def service
                  @service ||= Entities::Service.cast!(original_params.service)
                end

                ##
                # TODO: `cast_many`, `cast_many!`.
                #
                def inputs
                  @inputs ||= original_params.inputs.map { |input| Entities::Method.cast!(input, direction: :input) }
                end

                def outputs
                  @outputs ||= original_params.outputs.map { |output| Entities::Method.cast!(output, direction: :output) }
                end

                def index
                  @index ||= original_params.index
                end

                def container
                  @container ||= Entities::Service.cast!(original_params.container)
                end

                def organizer
                  @organizer ||= original_params.organizer
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
convenient_service-0.10.1 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.10.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.9.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.8.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.7.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.6.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.5.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.4.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.3.1 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.3.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.2.1 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.2.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb
convenient_service-0.1.0 lib/convenient_service/service/plugins/has_result_steps/entities/step/commands/cast_params.rb