Class: Services::CreateConfiguredFacilityContext

Inherits:
Object
  • Object
show all
Defined in:
app/contexts/services/create_configured_facility_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_definition, cf_params, cred_params) ⇒ CreateConfiguredFacilityContext

Returns a new instance of CreateConfiguredFacilityContext.



11
12
13
14
15
16
# File 'app/contexts/services/create_configured_facility_context.rb', line 11

def initialize(service_definition, cf_params, cred_params)
  @service_definition = service_definition
  @cf_params = cf_params
  @cred_params = cred_params
  @service_definition.extend Services::ConfiguredFacilityCreator
end

Instance Attribute Details

#cf_paramsObject

Returns the value of attribute cf_params.



5
6
7
# File 'app/contexts/services/create_configured_facility_context.rb', line 5

def cf_params
  @cf_params
end

#cred_paramsObject

Returns the value of attribute cred_params.



5
6
7
# File 'app/contexts/services/create_configured_facility_context.rb', line 5

def cred_params
  @cred_params
end

#service_definitionObject

Returns the value of attribute service_definition.



5
6
7
# File 'app/contexts/services/create_configured_facility_context.rb', line 5

def service_definition
  @service_definition
end

Class Method Details

.call(service_definition, cf_params, cred_params) ⇒ Object



7
8
9
# File 'app/contexts/services/create_configured_facility_context.rb', line 7

def self.call(service_definition, cf_params, cred_params)
  CreateConfiguredFacilityContext.new(service_definition, cf_params, cred_params).call
end

Instance Method Details

#callObject



18
19
20
21
22
# File 'app/contexts/services/create_configured_facility_context.rb', line 18

def call
  service_definition.create(cf_params).tap do | configured_facility |
    CreateCredentialContext.call(configured_facility, cred_params) if cred_params.present?
  end
end