Sha256: 91511578e48c326e7bc6e5f598407915adfa0a58c0d626a1aa2ed9cc6be123ab
Contents?: true
Size: 956 Bytes
Versions: 7
Compression:
Stored size: 956 Bytes
Contents
# frozen_string_literal: true module Quby module Answers class API def initialize(answer_repo:) @repo = answer_repo end def find(questionnaire_key, answer_id, **options) @repo.find questionnaire_key, answer_id, **options end def reload(answer) @repo.reload answer end def all(questionnaire_key) @repo.all questionnaire_key end def create!(questionnaire_key, attributes = {}) questionnaire = Quby.questionnaires.find(questionnaire_key) answer = Services::BuildAnswer.new(questionnaire, attributes).build @repo.create! answer end def update!(answer) @repo.update! answer end def generate_outcome(answer) Services::OutcomeCalculation.new(answer).calculate end def regenerate_outcome!(answer) Services::OutcomeCalculation.new(answer).update_scores end end end end
Version data entries
7 entries across 7 versions & 1 rubygems