Class: Riddler::UseCases::DismissInteraction

Inherits:
Object
  • Object
show all
Defined in:
lib/riddler/use_cases/dismiss_interaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interaction_repo:, interaction_id:) ⇒ DismissInteraction

Returns a new instance of DismissInteraction.



6
7
8
9
# File 'lib/riddler/use_cases/dismiss_interaction.rb', line 6

def initialize interaction_repo:, interaction_id:
  @interaction_repo = interaction_repo
  @interaction_id = interaction_id
end

Instance Attribute Details

#interactionObject (readonly)

Returns the value of attribute interaction.



4
5
6
# File 'lib/riddler/use_cases/dismiss_interaction.rb', line 4

def interaction
  @interaction
end

#interaction_idObject (readonly)

Returns the value of attribute interaction_id.



4
5
6
# File 'lib/riddler/use_cases/dismiss_interaction.rb', line 4

def interaction_id
  @interaction_id
end

#interaction_repoObject (readonly)

Returns the value of attribute interaction_repo.



4
5
6
# File 'lib/riddler/use_cases/dismiss_interaction.rb', line 4

def interaction_repo
  @interaction_repo
end

Instance Method Details

#processObject



11
12
13
14
15
16
17
# File 'lib/riddler/use_cases/dismiss_interaction.rb', line 11

def process
  @interaction = interaction_repo.find_by id: interaction_id
  return if interaction.nil?

  interaction.dismiss
  interaction_repo.update interaction
end