Module: ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Concern::InstanceMethods

Includes:
ConvenientService::Support::Copyable, ConvenientService::Support::Delegate
Defined in:
lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb

Instance Method Summary collapse

Methods included from ConvenientService::Support::Concern

included

Methods included from ConvenientService::Support::Copyable

#copy

Instance Method Details

#==(other) ⇒ Boolean?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 325

def ==(other)
  return unless other.instance_of?(self.class)

  return false if service != other.service
  return false if inputs != other.inputs
  return false if outputs != other.outputs
  return false if index != other.index
  return false if container != other.container
  return false if organizer(raise_when_missing: false) != other.organizer(raise_when_missing: false)
  return false if extra_kwargs != other.extra_kwargs

  true
end

#codeConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code



36
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 36

delegate :code, to: :result

#containerConvenientService::Service::Plugins::CanHaveSteps::Entities::Service



77
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 77

delegate :container, to: :params

#dataConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data



26
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 26

delegate :data, to: :result

#define!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



313
314
315
316
317
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 313

def define!
  outputs.each { |output| output.define_output_in_container!(container, index: index) }

  true
end

#error?Boolean

Returns:

  • (Boolean)


97
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 97

delegate :error?, to: :result

#extra_kwargsHash{Symbol => Object}

Returns:

  • (Hash{Symbol => Object})


82
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 82

delegate :extra_kwargs, to: :params

#failure?Boolean

Returns:

  • (Boolean)


92
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 92

delegate :failure?, to: :result

#has_organizer?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


245
246
247
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 245

def has_organizer?
  Utils.to_bool(organizer(raise_when_missing: false))
end

#has_reassignment?(name) ⇒ Boolean



255
256
257
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 255

def has_reassignment?(name)
  outputs.any? { |output| output.reassignment?(name) }
end

#indexInteger

Returns:

  • (Integer)


72
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 72

delegate :index, to: :params

#initialize(*args, **kwargs) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • args (Array<Object>)
  • kwargs (Hash{Symbol => Object})


121
122
123
124
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 121

def initialize(*args, **kwargs)
  @args = args
  @kwargs = kwargs
end

#input_valuesHash{Symbol => Object}



172
173
174
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 172

def input_values
  @input_values ||= calculate_input_values
end

#inputsArray<ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method>



162
163
164
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 162

def inputs
  @inputs ||= params.inputs.map { |input| input.copy(overrides: {kwargs: {organizer: organizer(raise_when_missing: false)}}) }
end

#messageConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Message



31
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 31

delegate :message, to: :result

#not_error?Boolean

Returns:

  • (Boolean)


112
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 112

delegate :not_error?, to: :result

#not_failure?Boolean

Returns:

  • (Boolean)


107
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 107

delegate :not_failure?, to: :result

#not_success?Boolean

Returns:

  • (Boolean)


102
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 102

delegate :not_success?, to: :result

#organizer(raise_when_missing: true) ⇒ ConvenientService::Service

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



149
150
151
152
153
154
155
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 149

def organizer(raise_when_missing: true)
  @organizer ||= params.organizer

  ::ConvenientService.raise Exceptions::StepHasNoOrganizer.new(step: self) if @organizer.nil? && raise_when_missing

  @organizer
end

#output_valuesHash{Symbol => Object}

Returns:

  • (Hash{Symbol => Object})

Raises:



182
183
184
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 182

def output_values
  @output_values ||= calculate_output_values
end

#outputsArray<ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method>



67
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 67

delegate :outputs, to: :params

#paramsConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Structs::Params

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



134
135
136
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 134

def params
  @params ||= resolve_params
end

#printable_containerString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


201
202
203
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 201

def printable_container
  Utils::Class.display_name(container.klass)
end

#printable_serviceString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


210
211
212
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 210

def printable_service
  Utils::Class.display_name(service.klass)
end

#reassignment(name) ⇒ ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method?



192
193
194
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 192

def reassignment(name)
  outputs.find { |output| output.reassignment?(name) }
end

#save_outputs_in_organizer!Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



278
279
280
281
282
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 278

def save_outputs_in_organizer!
  output_values.each_pair { |key, value| organizer.internals.cache.scope(:step_output_values).write(key, value) }

  true
end

#serviceConvenientService::Service::Plugins::CanHaveSteps::Entities::Service



59
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 59

delegate :service, to: :params

#service_classClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Class)


236
237
238
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 236

def service_class
  service.klass
end

#service_resultConvenientService::Service::Plugins::HasJSendResult::Entities::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

‘service_result` has middlewares.



227
228
229
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 227

def service_result
  @service_result ||= service.klass.result(**input_values)
end

#statusConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Status



21
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 21

delegate :status, to: :result

#success?Boolean

Returns:

  • (Boolean)


87
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 87

delegate :success?, to: :result

#to_argsArray<Object>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array<Object>)


354
355
356
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 354

def to_args
  to_arguments.args
end

#to_argumentsConveninentService::Support::Arguments

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (ConveninentService::Support::Arguments)


372
373
374
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 372

def to_arguments
  Support::Arguments.new(service, **kwargs.merge(in: inputs, out: outputs, index: index, container: container, organizer: organizer(raise_when_missing: false), **extra_kwargs))
end

#to_kwargsHash{Symbol => Object}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash{Symbol => Object})


363
364
365
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 363

def to_kwargs
  to_arguments.kwargs
end

#to_sString

Returns:

  • (String)


345
346
347
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 345

def to_s
  printable_service
end

#trigger_callbackvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



265
266
267
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 265

def trigger_callback
  organizer.step(index)
end

#unsafe_codeConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code



51
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 51

delegate :unsafe_code, to: :result

#unsafe_dataConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data



41
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 41

delegate :unsafe_data, to: :result

#unsafe_messageConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Message



46
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 46

delegate :unsafe_message, to: :result

#validate!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Raises:

  • (ConvenientService::Error)


300
301
302
303
304
305
306
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 300

def validate!
  inputs.each { |input| input.validate_as_input_for_container!(container) }

  outputs.each { |output| output.validate_as_output_for_container!(container) }

  true
end

#with_organizer(organizer) ⇒ ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



290
291
292
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb', line 290

def with_organizer(organizer)
  copy(overrides: {kwargs: {organizer: organizer}})
end