Sha256: b2bf15f6cee9e408ad2a5c13e0d3ca7755cbcc42051a1edee16dabd01be53f66

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

module SurveyGizmo; module API
  # @see SurveyGizmo::Resource::ClassMethods
  class Option
    include SurveyGizmo::Resource

    # @macro [attach] virtus_attribute
    #   @return [$2]
    attribute :id,            Integer
    attribute :survey_id,     Integer
    attribute :page_id,       Integer
    attribute :question_id,   Integer
    attribute :title,         String
    attribute :value,         String
    attribute :properties,    Hash

    # routing
    route '/survey/:survey_id/surveypage/:page_id/surveyquestion/:question_id/surveyoption',     :via => :create
    route '/survey/:survey_id/surveypage/:page_id/surveyquestion/:question_id/surveyoption/:id', :via => [:get, :update, :delete]

    # 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, :question_id => self.question_id}
    end

  end
end; end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
survey-gizmo-ruby-1.0.5 lib/survey_gizmo/api/option.rb
survey-gizmo-ruby-1.0.4 lib/survey_gizmo/api/option.rb
survey-gizmo-ruby-1.0.3 lib/survey_gizmo/api/option.rb
survey-gizmo-ruby-1.0.1 lib/survey_gizmo/api/option.rb
survey-gizmo-ruby-0.9.6 lib/survey_gizmo/api/option.rb