Class: Riddler::UseCases::CompleteInteraction
- Inherits:
-
Object
- Object
- Riddler::UseCases::CompleteInteraction
- Defined in:
- lib/riddler/use_cases/complete_interaction.rb
Instance Attribute Summary collapse
-
#interaction_id ⇒ Object
readonly
Returns the value of attribute interaction_id.
-
#interaction_repo ⇒ Object
readonly
Returns the value of attribute interaction_repo.
Instance Method Summary collapse
-
#initialize(interaction_repo:, interaction_id:) ⇒ CompleteInteraction
constructor
A new instance of CompleteInteraction.
- #process ⇒ Object
Constructor Details
#initialize(interaction_repo:, interaction_id:) ⇒ CompleteInteraction
Returns a new instance of CompleteInteraction.
6 7 8 9 |
# File 'lib/riddler/use_cases/complete_interaction.rb', line 6 def initialize interaction_repo:, interaction_id: @interaction_repo = interaction_repo @interaction_id = interaction_id end |
Instance Attribute Details
#interaction_id ⇒ Object (readonly)
Returns the value of attribute interaction_id.
4 5 6 |
# File 'lib/riddler/use_cases/complete_interaction.rb', line 4 def interaction_id @interaction_id end |
#interaction_repo ⇒ Object (readonly)
Returns the value of attribute interaction_repo.
4 5 6 |
# File 'lib/riddler/use_cases/complete_interaction.rb', line 4 def interaction_repo @interaction_repo end |
Instance Method Details
#process ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/riddler/use_cases/complete_interaction.rb', line 11 def process interaction = interaction_repo.find_by id: interaction_id return if interaction.nil? interaction.complete interaction_repo.update interaction end |