Class: Services::CreateServiceDefinitionContext
- Inherits:
-
Object
- Object
- Services::CreateServiceDefinitionContext
- Defined in:
- app/contexts/services/create_service_definition_context.rb
Instance Attribute Summary collapse
-
#cred_params ⇒ Object
Returns the value of attribute cred_params.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#sd_params ⇒ Object
Returns the value of attribute sd_params.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(owner, sd_params, cred_params) ⇒ CreateServiceDefinitionContext
constructor
A new instance of CreateServiceDefinitionContext.
Constructor Details
#initialize(owner, sd_params, cred_params) ⇒ CreateServiceDefinitionContext
Returns a new instance of CreateServiceDefinitionContext.
11 12 13 14 15 16 |
# File 'app/contexts/services/create_service_definition_context.rb', line 11 def initialize(owner, sd_params, cred_params) @owner = owner @sd_params = sd_params @cred_params = cred_params @owner.extend Services::ServiceDefinitionCreator end |
Instance Attribute Details
#cred_params ⇒ Object
Returns the value of attribute cred_params.
5 6 7 |
# File 'app/contexts/services/create_service_definition_context.rb', line 5 def cred_params @cred_params end |
#owner ⇒ Object
Returns the value of attribute owner.
5 6 7 |
# File 'app/contexts/services/create_service_definition_context.rb', line 5 def owner @owner end |
#sd_params ⇒ Object
Returns the value of attribute sd_params.
5 6 7 |
# File 'app/contexts/services/create_service_definition_context.rb', line 5 def sd_params @sd_params end |
Class Method Details
.call(owner, sd_params, cred_params) ⇒ Object
7 8 9 |
# File 'app/contexts/services/create_service_definition_context.rb', line 7 def self.call(owner, sd_params, cred_params) CreateServiceDefinitionContext.new(owner, sd_params, cred_params).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'app/contexts/services/create_service_definition_context.rb', line 18 def call owner.create(sd_params).tap do | service_definition | CreateCredentialContext.call(service_definition, cred_params) if cred_params.present? end end |