Sha256: 0da7fb525908e3b298ca45235fd5b5dd68390d368e04e36357b017ef8147c0d0

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module SurveyGizmo; module API
  class Question
    include SurveyGizmo::Resource
    
    attribute :id,            Integer
    attribute :title,         String
    attribute :type,          String
    attribute :description,   String
    attribute :properties,    Hash
    attribute :after,         Integer
    attribute :survey_id,     Integer
    attribute :page_id,       Integer
    
    alias_attribute :_subtype, :type
    
    # routing
    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]
    
    collection :options
    
    # 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
    
    def to_param_options
      {:id => self.id, :survey_id => self.survey_id, :page_id => self.page_id}
    end
  end
end; end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
survey-gizmo-ruby-0.5.0 lib/survey_gizmo/api/question.rb