Class: Artisan::Iterations::IterationsInteractor
- Inherits:
-
Object
- Object
- Artisan::Iterations::IterationsInteractor
- Defined in:
- lib/artisan/iterations/iterations_interactor.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #create(iteration_attributes, callbacks) ⇒ Object
-
#find(iteration_id) ⇒ Object
TODO - PWP - check permissions.
-
#initialize(project_id, user) ⇒ IterationsInteractor
constructor
A new instance of IterationsInteractor.
- #update(id, iteration_attributes, callbacks) ⇒ Object
Constructor Details
#initialize(project_id, user) ⇒ IterationsInteractor
Returns a new instance of IterationsInteractor.
11 12 13 14 |
# File 'lib/artisan/iterations/iterations_interactor.rb', line 11 def initialize(project_id, user) @project = project_repository.find(project_id) @current_user = user end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
9 10 11 |
# File 'lib/artisan/iterations/iterations_interactor.rb', line 9 def project @project end |
Instance Method Details
#create(iteration_attributes, callbacks) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/artisan/iterations/iterations_interactor.rb', line 16 def create(iteration_attributes, callbacks) iteration_attributes.merge!(:number => Projects::IterationNumberer.new(@project).next_iteration_number) iteration = CrudStrategy.create(@project.iterations.build(iteration_attributes), callbacks, repository) Artisan::Activity::IterationAuditor.created(iteration.id, @project.id, @current_user.id, iteration_attributes) return iteration end |
#find(iteration_id) ⇒ Object
TODO - PWP - check permissions
33 34 35 |
# File 'lib/artisan/iterations/iterations_interactor.rb', line 33 def find(iteration_id) return repository.find(iteration_id) end |
#update(id, iteration_attributes, callbacks) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/artisan/iterations/iterations_interactor.rb', line 23 def update(id, iteration_attributes, callbacks) iteration = find(id) original_attributes = iteration.attributes iteration = CrudStrategy.update(iteration, iteration_attributes, @current_user, callbacks) Artisan::Activity::IterationAuditor.updated(iteration.id, @project.id, @current_user.id, original_attributes, iteration_attributes) return iteration end |