lib/survey_gizmo/api/question.rb in survey-gizmo-ruby-2.0.1 vs lib/survey_gizmo/api/question.rb in survey-gizmo-ruby-3.0.3

- old
+ new

@@ -1,21 +1,19 @@ module SurveyGizmo; module API # @see SurveyGizmo::Resource::ClassMethods class Question include SurveyGizmo::Resource - # @macro [attach] virtus_attribute - # @return [$2] attribute :id, Integer attribute :title, String attribute :type, String attribute :description, String attribute :shortname, String attribute :properties, Hash attribute :after, Integer attribute :survey_id, Integer - attribute :page_id, Integer, :default => 1 + attribute :page_id, Integer, default: 1 attribute :sub_question_skus, Array attribute :parent_question_id, Integer alias_attribute :_subtype, :type @@ -34,22 +32,23 @@ def parent_question @parent_question ||= parent_question_id ? SurveyGizmo::API::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)} - .each {|subquestion| subquestion.parent_question_id = id} + @sub_questions ||= sub_question_skus.map { |subquestion_id| SurveyGizmo::API::Question.first(survey_id: survey_id, id: subquestion_id) } + .each { |subquestion| subquestion.parent_question_id = id } end + # survey gizmo sends a hash back for :title # @private def title_with_multilingual=(val) self.title_without_multilingual = val.is_a?(Hash) ? val['English'] : val end alias_method_chain :title=, :multilingual # @see SurveyGizmo::Resource#to_param_options def to_param_options - {id: self.id, survey_id: self.survey_id, page_id: self.page_id} + { id: self.id, survey_id: self.survey_id, page_id: self.page_id } end end end; end