Class: Decidim::Proposals::Import::ProposalAnswerCreator
- Inherits:
-
Admin::Import::Creator
- Object
- Admin::Import::Creator
- Decidim::Proposals::Import::ProposalAnswerCreator
- Defined in:
- decidim-proposals/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
Instance Attribute Summary
Attributes inherited from Admin::Import::Creator
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.
Methods inherited from Admin::Import::Creator
#initialize, localize_headers, required_headers, #resource_attributes
Constructor Details
This class inherits a constructor from Decidim::Admin::Import::Creator
Class Method Details
.resource_klass ⇒ Object
Retuns the resource class to be created with the provided data.
12 13 14 |
# File 'decidim-proposals/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 'decidim-proposals/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 39 |
# File 'decidim-proposals/lib/decidim/proposals/import/proposal_answer_creator.rb', line 29 def finish! Decidim.traceability.perform_action!( "answer", resource, current_user ) do resource.try(:save!) end notify end |
#produce ⇒ Object
Add answer to proposal
Returns a proposal
25 26 27 |
# File 'decidim-proposals/lib/decidim/proposals/import/proposal_answer_creator.rb', line 25 def produce resource end |