Class: Decidim::Proposals::Import::ProposalAnswerCreator
- Inherits:
-
Admin::Import::Creator
- Object
- Admin::Import::Creator
- Decidim::Proposals::Import::ProposalAnswerCreator
- Defined in:
- lib/decidim/proposals/import/proposal_answer_creator.rb
Overview
This class is responsible for creating the imported proposal answers and must be included in proposals component’s import manifest.
Constant Summary collapse
- POSSIBLE_ANSWER_STATES =
%w(evaluating accepted rejected).freeze
Class Method Summary collapse
-
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
-
.verifier_klass ⇒ Object
Returns a verifier class to be used to verify the correctness of the import data.
Instance Method Summary collapse
- #finish! ⇒ Object
-
#produce ⇒ Object
Add answer to proposal.
Class Method Details
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
12 13 14 |
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 12 def self.resource_klass Decidim::Proposals::Proposal end |
.verifier_klass ⇒ Object
Returns a verifier class to be used to verify the correctness of the import data.
18 19 20 |
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 18 def self.verifier_klass Decidim::Proposals::Import::ProposalsAnswersVerifier end |
Instance Method Details
#finish! ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 29 def finish! Decidim.traceability.perform_action!( "answer", resource, current_user ) do resource.save! end notify(resource) end |
#produce ⇒ Object
Add answer to proposal
Returns a proposal
25 26 27 |
# File 'lib/decidim/proposals/import/proposal_answer_creator.rb', line 25 def produce resource end |