lib/survey_gizmo/api/question.rb in survey-gizmo-ruby-4.0.0 vs lib/survey_gizmo/api/question.rb in survey-gizmo-ruby-4.1.0

- old
+ new

@@ -1,12 +1,12 @@ module SurveyGizmo; module API # @see SurveyGizmo::Resource::ClassMethods class Question include SurveyGizmo::Resource + include SurveyGizmo::MultilingualTitle attribute :id, Integer - attribute :title, Hash attribute :type, String attribute :description, String attribute :shortname, String attribute :properties, Hash attribute :after, Integer @@ -15,29 +15,27 @@ attribute :sub_question_skus, Array attribute :parent_question_id, Integer alias_attribute :_subtype, :type - include SurveyGizmo::MultilingualTitle - route '/survey/:survey_id/surveyquestion/:id', via: :get route '/survey/:survey_id/surveypage/:page_id/surveyquestion', via: :create route '/survey/:survey_id/surveypage/:page_id/surveyquestion/:id', via: [:update, :delete] def survey - @survey ||= SurveyGizmo::API::Survey.first(id: survey_id) + @survey ||= Survey.first(id: survey_id) end def options - @options ||= SurveyGizmo::API::Option.all(survey_id: survey_id, page_id: page_id, question_id: id) + @options ||= Option.all(survey_id: survey_id, page_id: page_id, question_id: id, all_pages: true) end def parent_question - @parent_question ||= parent_question_id ? SurveyGizmo::API::Question.first(survey_id: survey_id, id: parent_question_id) : nil + @parent_question ||= parent_question_id ? Question.first(survey_id: survey_id, id: parent_question_id) : nil end def sub_questions - @sub_questions ||= sub_question_skus.map { |subquestion_id| SurveyGizmo::API::Question.first(survey_id: survey_id, id: subquestion_id) } + @sub_questions ||= sub_question_skus.map { |subquestion_id| Question.first(survey_id: survey_id, id: subquestion_id) } .each { |subquestion| subquestion.parent_question_id = id } end # @see SurveyGizmo::Resource#to_param_options def to_param_options