Class: JobInvocationComposer::ParamsForFeature

Inherits:
Object
  • Object
show all
Defined in:
app/models/job_invocation_composer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_label, hosts, provided_inputs = {}) ⇒ ParamsForFeature

Returns a new instance of ParamsForFeature.



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'app/models/job_invocation_composer.rb', line 245

def initialize(feature_label, hosts, provided_inputs = {})
  @feature = RemoteExecutionFeature.feature(feature_label)
  @provided_inputs = provided_inputs
  if hosts.is_a? Bookmark
    @host_bookmark = hosts
  elsif hosts.is_a? Host::Base
    @host_objects = [hosts]
  elsif hosts.is_a? Array
    @host_objects = hosts.map do |id|
      Host::Managed.authorized.friendly.find(id)
    end
  elsif hosts.is_a? String
    @host_scoped_search = hosts
  else
    @host_objects = hosts
  end
end

Instance Attribute Details

#featureObject (readonly)

Returns the value of attribute feature.



243
244
245
# File 'app/models/job_invocation_composer.rb', line 243

def feature
  @feature
end

#feature_labelObject (readonly)

Returns the value of attribute feature_label.



243
244
245
# File 'app/models/job_invocation_composer.rb', line 243

def feature_label
  @feature_label
end

#provided_inputsObject (readonly)

Returns the value of attribute provided_inputs.



243
244
245
# File 'app/models/job_invocation_composer.rb', line 243

def provided_inputs
  @provided_inputs
end

Instance Method Details

#paramsObject



263
264
265
266
267
268
269
270
# File 'app/models/job_invocation_composer.rb', line 263

def params
  { :job_category => job_template.job_category,
    :targeting => targeting_params,
    :triggering => {},
    :concurrency_control => {},
    :remote_execution_feature_id => @feature.id,
    :template_invocations => template_invocations_params }.with_indifferent_access
end