Sha256: d817de52b7b8110e2744647f50763a32d9d22fc1944154c6fe92015e51fa4bee

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

module SurveyGizmo; module API
  class Option
    include SurveyGizmo::Resource
    
    attribute :id,            Integer
    attribute :title,         String
    attribute :value,          String
    attribute :survey_id,     Integer
    attribute :page_id,       Integer
    attribute :question_id,   Integer
        
    # 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
    
    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

1 entries across 1 versions & 1 rubygems

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